Whamcloud - gitweb
LU-9859 libcfs: simplify capability dropping.
[fs/lustre-release.git] / libcfs / include / libcfs / curproc.h
index 8501041..197c0c9 100644 (file)
 
 typedef __u32 cfs_cap_t;
 
-#define CFS_CAP_FS_MASK        (BIT(CAP_CHOWN)                 |       \
-                        BIT(CAP_DAC_OVERRIDE)          |       \
-                        BIT(CAP_DAC_READ_SEARCH)       |       \
-                        BIT(CAP_FOWNER)                |       \
-                        BIT(CAP_FSETID)                |       \
-                        BIT(CAP_LINUX_IMMUTABLE)       |       \
-                        BIT(CAP_SYS_ADMIN)             |       \
-                        BIT(CAP_SYS_BOOT)              |       \
-                        BIT(CAP_SYS_RESOURCE))
-
-cfs_cap_t cfs_curproc_cap_pack(void);
-void cfs_curproc_cap_unpack(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