Whamcloud - gitweb
LU-9859 libcfs: simplify capability dropping.
[fs/lustre-release.git] / libcfs / include / libcfs / curproc.h
index 6a2b09a..197c0c9 100644 (file)
 
 typedef __u32 cfs_cap_t;
 
-#define CFS_CAP_CHOWN                   0
-#define CFS_CAP_DAC_OVERRIDE            1
-#define CFS_CAP_DAC_READ_SEARCH         2
-#define CFS_CAP_FOWNER                  3
-#define CFS_CAP_FSETID                  4
-#define CFS_CAP_LINUX_IMMUTABLE         9
-#define CFS_CAP_SYS_ADMIN              21
-#define CFS_CAP_SYS_BOOT               23
-#define CFS_CAP_SYS_RESOURCE           24
-
-#define CFS_CAP_FS_MASK ((1 << CFS_CAP_CHOWN) |                 \
-                         (1 << CFS_CAP_DAC_OVERRIDE) |          \
-                         (1 << CFS_CAP_DAC_READ_SEARCH) |       \
-                         (1 << CFS_CAP_FOWNER) |                \
-                         (1 << CFS_CAP_FSETID ) |               \
-                         (1 << CFS_CAP_LINUX_IMMUTABLE) |       \
-                         (1 << CFS_CAP_SYS_ADMIN) |             \
-                         (1 << CFS_CAP_SYS_BOOT) |              \
-                         (1 << CFS_CAP_SYS_RESOURCE))
-
-cfs_cap_t cfs_curproc_cap_pack(void);
-void cfs_curproc_cap_unpack(cfs_cap_t cap);
-int cfs_capable(cfs_cap_t cap);
+static inline cfs_cap_t cfs_curproc_cap_pack(void)
+{
+       /* cfs_cap_t is only the first word of kernel_cap_t */
+       return (cfs_cap_t)(current_cap().cap[0]);
+}
 
 /* __LIBCFS_CURPROC_H__ */
 #endif