From: Darrick J. Wong <djwong@xxxxxxxxxx> Move the project id get and set functions into libxfs. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- libxfs/libxfs_api_defs.h | 2 ++ libxfs/xfs_inode_util.c | 11 +++++++++++ libxfs/xfs_inode_util.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h index 49372a44029..3455c014832 100644 --- a/libxfs/libxfs_api_defs.h +++ b/libxfs/libxfs_api_defs.h @@ -150,6 +150,7 @@ #define xfs_free_extent_later libxfs_free_extent_later #define xfs_free_perag libxfs_free_perag #define xfs_fs_geometry libxfs_fs_geometry +#define xfs_get_projid libxfs_get_projid #define xfs_highbit32 libxfs_highbit32 #define xfs_highbit64 libxfs_highbit64 #define xfs_ialloc_calc_rootino libxfs_ialloc_calc_rootino @@ -252,6 +253,7 @@ #define xfs_sb_read_secondary libxfs_sb_read_secondary #define xfs_sb_to_disk libxfs_sb_to_disk #define xfs_sb_version_to_features libxfs_sb_version_to_features +#define xfs_set_projid libxfs_set_projid #define xfs_symlink_blocks libxfs_symlink_blocks #define xfs_symlink_hdr_ok libxfs_symlink_hdr_ok #define xfs_symlink_write_target libxfs_symlink_write_target diff --git a/libxfs/xfs_inode_util.c b/libxfs/xfs_inode_util.c index 868a77cafa6..89fb58807a1 100644 --- a/libxfs/xfs_inode_util.c +++ b/libxfs/xfs_inode_util.c @@ -122,3 +122,14 @@ xfs_ip2xflags( flags |= FS_XFLAG_HASATTR; return flags; } + +#define XFS_PROJID_DEFAULT 0 + +prid_t +xfs_get_initial_prid(struct xfs_inode *dp) +{ + if (dp->i_diflags & XFS_DIFLAG_PROJINHERIT) + return dp->i_projid; + + return XFS_PROJID_DEFAULT; +} diff --git a/libxfs/xfs_inode_util.h b/libxfs/xfs_inode_util.h index 6ad1898a0f7..f7e4d5a8235 100644 --- a/libxfs/xfs_inode_util.h +++ b/libxfs/xfs_inode_util.h @@ -11,4 +11,6 @@ uint64_t xfs_flags2diflags2(struct xfs_inode *ip, unsigned int xflags); uint32_t xfs_dic2xflags(struct xfs_inode *ip); uint32_t xfs_ip2xflags(struct xfs_inode *ip); +prid_t xfs_get_initial_prid(struct xfs_inode *dp); + #endif /* __XFS_INODE_UTIL_H__ */