]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: hoist project id get/set functions to libxfs
authorDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 01:09:24 +0000 (18:09 -0700)
committerAndrey Albershteyn <aalbersh@redhat.com>
Fri, 4 Oct 2024 10:42:07 +0000 (12:42 +0200)
Source kernel commit: fcea5b35f36233c04003ab8b3eb081b5e20e1aa4

Move the project id get and set functions into libxfs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_inode_util.c
libxfs/xfs_inode_util.h

index 868a77cafa67690667f4a4c4fc427d7c97435426..0a9ea03e2788e36f1994b13b7d030fd65540d34c 100644 (file)
@@ -122,3 +122,13 @@ xfs_ip2xflags(
                flags |= FS_XFLAG_HASATTR;
        return flags;
 }
+
+prid_t
+xfs_get_initial_prid(struct xfs_inode *dp)
+{
+       if (dp->i_diflags & XFS_DIFLAG_PROJINHERIT)
+               return dp->i_projid;
+
+       /* Assign to the root project by default. */
+       return 0;
+}
index 6ad1898a0f73ffc619187d7443772fcea56baa73..f7e4d5a8235dda8562621db20faf27248a6fe70f 100644 (file)
@@ -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__ */