diff options
Diffstat (limited to 'fs/xfs/xfs_linux.h')
-rw-r--r-- | fs/xfs/xfs_linux.h | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index 800f896a6cc4..f9bb590acc0e 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h | |||
@@ -32,6 +32,38 @@ | |||
32 | # define XFS_BIG_INUMS 0 | 32 | # define XFS_BIG_INUMS 0 |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* | ||
36 | * Kernel specific type declarations for XFS | ||
37 | */ | ||
38 | typedef signed char __int8_t; | ||
39 | typedef unsigned char __uint8_t; | ||
40 | typedef signed short int __int16_t; | ||
41 | typedef unsigned short int __uint16_t; | ||
42 | typedef signed int __int32_t; | ||
43 | typedef unsigned int __uint32_t; | ||
44 | typedef signed long long int __int64_t; | ||
45 | typedef unsigned long long int __uint64_t; | ||
46 | |||
47 | typedef __uint32_t inst_t; /* an instruction */ | ||
48 | |||
49 | typedef __s64 xfs_off_t; /* <file offset> type */ | ||
50 | typedef unsigned long long xfs_ino_t; /* <inode> type */ | ||
51 | typedef __s64 xfs_daddr_t; /* <disk address> type */ | ||
52 | typedef char * xfs_caddr_t; /* <core address> type */ | ||
53 | typedef __u32 xfs_dev_t; | ||
54 | typedef __u32 xfs_nlink_t; | ||
55 | |||
56 | /* __psint_t is the same size as a pointer */ | ||
57 | #if (BITS_PER_LONG == 32) | ||
58 | typedef __int32_t __psint_t; | ||
59 | typedef __uint32_t __psunsigned_t; | ||
60 | #elif (BITS_PER_LONG == 64) | ||
61 | typedef __int64_t __psint_t; | ||
62 | typedef __uint64_t __psunsigned_t; | ||
63 | #else | ||
64 | #error BITS_PER_LONG must be 32 or 64 | ||
65 | #endif | ||
66 | |||
35 | #include "xfs_types.h" | 67 | #include "xfs_types.h" |
36 | 68 | ||
37 | #include "kmem.h" | 69 | #include "kmem.h" |
@@ -114,8 +146,6 @@ | |||
114 | #define xfs_inherit_sync xfs_params.inherit_sync.val | 146 | #define xfs_inherit_sync xfs_params.inherit_sync.val |
115 | #define xfs_inherit_nodump xfs_params.inherit_nodump.val | 147 | #define xfs_inherit_nodump xfs_params.inherit_nodump.val |
116 | #define xfs_inherit_noatime xfs_params.inherit_noatim.val | 148 | #define xfs_inherit_noatime xfs_params.inherit_noatim.val |
117 | #define xfs_buf_timer_centisecs xfs_params.xfs_buf_timer.val | ||
118 | #define xfs_buf_age_centisecs xfs_params.xfs_buf_age.val | ||
119 | #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val | 149 | #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val |
120 | #define xfs_rotorstep xfs_params.rotorstep.val | 150 | #define xfs_rotorstep xfs_params.rotorstep.val |
121 | #define xfs_inherit_nodefrag xfs_params.inherit_nodfrg.val | 151 | #define xfs_inherit_nodefrag xfs_params.inherit_nodfrg.val |
@@ -159,6 +189,32 @@ | |||
159 | #define MAX(a,b) (max(a,b)) | 189 | #define MAX(a,b) (max(a,b)) |
160 | #define howmany(x, y) (((x)+((y)-1))/(y)) | 190 | #define howmany(x, y) (((x)+((y)-1))/(y)) |
161 | 191 | ||
192 | /* Kernel uid/gid conversion. These are used to convert to/from the on disk | ||
193 | * uid_t/gid_t types to the kuid_t/kgid_t types that the kernel uses internally. | ||
194 | * The conversion here is type only, the value will remain the same since we | ||
195 | * are converting to the init_user_ns. The uid is later mapped to a particular | ||
196 | * user namespace value when crossing the kernel/user boundary. | ||
197 | */ | ||
198 | static inline __uint32_t xfs_kuid_to_uid(kuid_t uid) | ||
199 | { | ||
200 | return from_kuid(&init_user_ns, uid); | ||
201 | } | ||
202 | |||
203 | static inline kuid_t xfs_uid_to_kuid(__uint32_t uid) | ||
204 | { | ||
205 | return make_kuid(&init_user_ns, uid); | ||
206 | } | ||
207 | |||
208 | static inline __uint32_t xfs_kgid_to_gid(kgid_t gid) | ||
209 | { | ||
210 | return from_kgid(&init_user_ns, gid); | ||
211 | } | ||
212 | |||
213 | static inline kgid_t xfs_gid_to_kgid(__uint32_t gid) | ||
214 | { | ||
215 | return make_kgid(&init_user_ns, gid); | ||
216 | } | ||
217 | |||
162 | /* | 218 | /* |
163 | * Various platform dependent calls that don't fit anywhere else | 219 | * Various platform dependent calls that don't fit anywhere else |
164 | */ | 220 | */ |