Create two helper functions to convert project id between user and kernel space. Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx> --- fs/xfs/xfs_linux.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index f9bb590..cc9cc5b 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -215,6 +215,25 @@ static inline kgid_t xfs_gid_to_kgid(__uint32_t gid) return make_kgid(&init_user_ns, gid); } +static inline int +xfs_convert_to_kernel_projid(__uint32_t prid, prid_t *kprid) +{ + kprojid_t kprojid = make_kprojid(current_user_ns(), prid); + if (!projid_valid(kprojid)) + return -1; + + *kprid = from_kprojid(&init_user_ns, kprojid); + return 0; +} + +static inline __uint32_t +xfs_convert_to_user_projid(prid_t kprid) +{ + kprojid_t kprojid = make_kprojid(&init_user_ns, kprid); + + return from_kprojid(current_user_ns(), kprojid); +} + /* * Various platform dependent calls that don't fit anywhere else */ -- 1.8.3.1 _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs