staging/lustre/libcfs: remove cfs_capable
authorPeng Tao <bergwolf@gmail.com>
Wed, 22 Jan 2014 13:47:37 +0000 (21:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Feb 2014 17:46:18 +0000 (09:46 -0800)
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 files changed:
drivers/staging/lustre/include/linux/libcfs/curproc.h
drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
drivers/staging/lustre/lustre/llite/dir.c
drivers/staging/lustre/lustre/llite/file.c
drivers/staging/lustre/lustre/llite/llite_lib.c
drivers/staging/lustre/lustre/llite/xattr.c
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
drivers/staging/lustre/lustre/obdclass/obdo.c
drivers/staging/lustre/lustre/obdecho/echo_client.c
drivers/staging/lustre/lustre/osc/osc_cache.c
drivers/staging/lustre/lustre/osc/osc_io.c
drivers/staging/lustre/lustre/osc/osc_page.c

index d12cfb176457051f730040deac1fb09183f4a851..8fd47c98fd330eaffed0fe27b319a49fbe9759bc 100644 (file)
@@ -84,7 +84,6 @@ void cfs_cap_raise(cfs_cap_t cap);
 void cfs_cap_lower(cfs_cap_t cap);
 int cfs_cap_raised(cfs_cap_t cap);
 cfs_cap_t cfs_curproc_cap_pack(void);
-int cfs_capable(cfs_cap_t cap);
 
 /* __LIBCFS_CURPROC_H__ */
 #endif
index 8b3af7f2c432e7811fa2e1cca63b13941b629a45..6d0bd220d53d2ea2a7ec833b39f8fc4b3718b650 100644 (file)
@@ -96,11 +96,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)
        return cap;
 }
 
-int cfs_capable(cfs_cap_t cap)
-{
-       return capable(cap);
-}
-
 static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr,
                                 void *buf, int len, int write)
 {
@@ -257,7 +252,6 @@ EXPORT_SYMBOL(cfs_cap_raise);
 EXPORT_SYMBOL(cfs_cap_lower);
 EXPORT_SYMBOL(cfs_cap_raised);
 EXPORT_SYMBOL(cfs_curproc_cap_pack);
-EXPORT_SYMBOL(cfs_capable);
 
 /*
  * Local variables:
index 55296a3591d5159a40d67a95997c2972a90496a4..e6eae0666f0d30c599960431a2b530235f98e0ab 100644 (file)
@@ -150,12 +150,12 @@ static long libcfs_ioctl(struct file *file,
        /* Handle platform-dependent IOC requests */
        switch (cmd) {
        case IOC_LIBCFS_PANIC:
-               if (!cfs_capable(CFS_CAP_SYS_BOOT))
+               if (!capable(CFS_CAP_SYS_BOOT))
                        return (-EPERM);
                panic("debugctl-invoked panic");
                return (0);
        case IOC_LIBCFS_MEMHOG:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        return -EPERM;
                /* go thought */
        }
index 1b217c8802b07544d49973c26187a6e533939d96..a6860e895d047274b73bd428bb694bc68a8bd918 100644 (file)
@@ -1085,7 +1085,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
        case Q_QUOTAOFF:
        case Q_SETQUOTA:
        case Q_SETINFO:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+               if (!capable(CFS_CAP_SYS_ADMIN) ||
                    sbi->ll_flags & LL_SBI_RMT_CLIENT)
                        return -EPERM;
                break;
@@ -1094,7 +1094,7 @@ static int quotactl_ioctl(struct ll_sb_info *sbi, struct if_quotactl *qctl)
                      uid_eq(current_euid(), make_kuid(&init_user_ns, id))) ||
                     (type == GRPQUOTA &&
                      !in_egroup_p(make_kgid(&init_user_ns, id)))) &&
-                   (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+                   (!capable(CFS_CAP_SYS_ADMIN) ||
                     sbi->ll_flags & LL_SBI_RMT_CLIENT))
                        return -EPERM;
                break;
@@ -1602,7 +1602,7 @@ out_rmdir:
                struct obd_quotactl *oqctl;
                int error = 0;
 
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+               if (!capable(CFS_CAP_SYS_ADMIN) ||
                    sbi->ll_flags & LL_SBI_RMT_CLIENT)
                        return -EPERM;
 
@@ -1626,7 +1626,7 @@ out_rmdir:
        case OBD_IOC_POLL_QUOTACHECK: {
                struct if_quotacheck *check;
 
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
+               if (!capable(CFS_CAP_SYS_ADMIN) ||
                    sbi->ll_flags & LL_SBI_RMT_CLIENT)
                        return -EPERM;
 
index c12821aedc2fd6f76d6f7db2c2ee8945f54bf8ca..19125d5c991a9d13692e8af41ba6c14e57f2505f 100644 (file)
@@ -1340,7 +1340,7 @@ static int ll_lov_recreate_obj(struct inode *inode, unsigned long arg)
        struct ll_recreate_obj ucreat;
        struct ost_id           oi;
 
-       if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+       if (!capable(CFS_CAP_SYS_ADMIN))
                return -EPERM;
 
        if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
@@ -1358,7 +1358,7 @@ static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
        struct ost_id   oi;
        obd_count       ost_idx;
 
-       if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+       if (!capable(CFS_CAP_SYS_ADMIN))
                return -EPERM;
 
        if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
@@ -1497,7 +1497,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file,
                                            sizeof(struct lov_user_ost_data);
        int                      rc;
 
-       if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+       if (!capable(CFS_CAP_SYS_ADMIN))
                return -EPERM;
 
        OBD_ALLOC_LARGE(lump, lum_size);
@@ -1747,7 +1747,7 @@ int ll_fid2path(struct inode *inode, void *arg)
        struct getinfo_fid2path *gfout, *gfin;
        int                      outsize, rc;
 
-       if (!cfs_capable(CFS_CAP_DAC_READ_SEARCH) &&
+       if (!capable(CFS_CAP_DAC_READ_SEARCH) &&
            !(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
                return -EPERM;
 
@@ -2093,7 +2093,7 @@ static int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss)
        /* Non-root users are forbidden to set or clear flags which are
         * NOT defined in HSM_USER_MASK. */
        if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK) &&
-           !cfs_capable(CFS_CAP_SYS_ADMIN))
+           !capable(CFS_CAP_SYS_ADMIN))
                return -EPERM;
 
        op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
index b0b69413886918dd84c234bde02ccdc94b37e2cd..85c01e155680acb875ff8fd49a88850be56c88c4 100644 (file)
@@ -1403,7 +1403,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
        /* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */
        if (attr->ia_valid & TIMES_SET_FLAGS) {
                if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
-                   !cfs_capable(CFS_CAP_FOWNER))
+                   !capable(CFS_CAP_FOWNER))
                        return -EPERM;
        }
 
index 3a7d03c12dd92ab4626e62ea73ffcb266814fbf7..af83580c6d48bd290487c692e229d2b833d153c4 100644 (file)
@@ -95,7 +95,7 @@ int xattr_type_filter(struct ll_sb_info *sbi, int xattr_type)
 
        if (xattr_type == XATTR_USER_T && !(sbi->ll_flags & LL_SBI_USER_XATTR))
                return -EOPNOTSUPP;
-       if (xattr_type == XATTR_TRUSTED_T && !cfs_capable(CFS_CAP_SYS_ADMIN))
+       if (xattr_type == XATTR_TRUSTED_T && !capable(CFS_CAP_SYS_ADMIN))
                return -EPERM;
        if (xattr_type == XATTR_OTHER_T)
                return -EOPNOTSUPP;
index 121a856d505276b6b56c5e7e0c82c868d35b6589..ba20776ebfa142ec36ee358ba67287d782ecdf57 100644 (file)
@@ -184,7 +184,7 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd,
        int err = 0;
 
        /* Allow non-root access for OBD_IOC_PING_TARGET - used by lfs check */
-       if (!cfs_capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
+       if (!capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
                return err = -EACCES;
        if ((cmd & 0xffffff00) == ((int)'T') << 8) /* ignore all tty ioctls */
                return err = -ENOTTY;
index 70997648a4f3c935bf160d13fe3ba8eaa8676f5b..e9cd6db43eeb88a2a839aee4e61d9360d37e0b31 100644 (file)
@@ -233,7 +233,7 @@ void obdo_from_iattr(struct obdo *oa, struct iattr *attr, unsigned int ia_valid)
                oa->o_mode = attr->ia_mode;
                oa->o_valid |= OBD_MD_FLTYPE | OBD_MD_FLMODE;
                if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
-                   !cfs_capable(CFS_CAP_FSETID))
+                   !capable(CFS_CAP_FSETID))
                        oa->o_mode &= ~S_ISGID;
        }
        if (ia_valid & ATTR_UID) {
@@ -282,7 +282,7 @@ void iattr_from_obdo(struct iattr *attr, struct obdo *oa, obd_flag valid)
                attr->ia_mode = (attr->ia_mode & S_IFMT)|(oa->o_mode & ~S_IFMT);
                attr->ia_valid |= ATTR_MODE;
                if (!in_group_p(make_kgid(&init_user_ns, oa->o_gid)) &&
-                   !cfs_capable(CFS_CAP_FSETID))
+                   !capable(CFS_CAP_FSETID))
                        attr->ia_mode &= ~S_ISGID;
        }
        if (valid & OBD_MD_FLUID) {
index 9b2dea29236380ed8796cff1ffb1e8a2568cbfe4..268a202c21e54a8e446abd4827875b3832f8c8eb 100644 (file)
@@ -2764,7 +2764,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
        switch (cmd) {
        case OBD_IOC_CREATE:                /* may create echo object */
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO (out, rc = -EPERM);
 
                rc = echo_create_object(env, ed, 1, oa, data->ioc_pbuf1,
@@ -2778,7 +2778,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                int dirlen;
                __u64 id;
 
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                count = data->ioc_count;
@@ -2806,7 +2806,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                __u64       seq;
                int           max_count;
 
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO(out, rc = -EPERM);
 
                cl_env = cl_env_get(&refcheck);
@@ -2838,7 +2838,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc);
        }
        case OBD_IOC_DESTROY:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO (out, rc = -EPERM);
 
                rc = echo_get_object(&eco, ed, oa);
@@ -2863,7 +2863,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc);
 
        case OBD_IOC_SETATTR:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO (out, rc = -EPERM);
 
                rc = echo_get_object(&eco, ed, oa);
@@ -2878,7 +2878,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc);
 
        case OBD_IOC_BRW_WRITE:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO (out, rc = -EPERM);
 
                rw = OBD_BRW_WRITE;
@@ -2897,7 +2897,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc);
 
        case ECHO_IOC_SET_STRIPE:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO (out, rc = -EPERM);
 
                if (data->ioc_pbuf1 == NULL) {  /* unset */
@@ -2914,7 +2914,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO (out, rc);
 
        case ECHO_IOC_ENQUEUE:
-               if (!cfs_capable(CFS_CAP_SYS_ADMIN))
+               if (!capable(CFS_CAP_SYS_ADMIN))
                        GOTO (out, rc = -EPERM);
 
                rc = echo_client_enqueue(exp, oa,
index be4511e78c04095abb423cf76f19c91c84ab7f35..b92a02efad439a12206cd3c455bc4629d1ea1ec2 100644 (file)
@@ -2146,7 +2146,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops,
        oap->oap_obj_off = offset;
        LASSERT(!(offset & ~CFS_PAGE_MASK));
 
-       if (!client_is_remote(exp) && cfs_capable(CFS_CAP_SYS_RESOURCE))
+       if (!client_is_remote(exp) && capable(CFS_CAP_SYS_RESOURCE))
                oap->oap_brw_flags = OBD_BRW_NOQUOTA;
 
        INIT_LIST_HEAD(&oap->oap_pending_item);
@@ -2186,7 +2186,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
        /* Set the OBD_BRW_SRVLOCK before the page is queued. */
        brw_flags |= ops->ops_srvlock ? OBD_BRW_SRVLOCK : 0;
        if (!client_is_remote(osc_export(osc)) &&
-           cfs_capable(CFS_CAP_SYS_RESOURCE)) {
+           capable(CFS_CAP_SYS_RESOURCE)) {
                brw_flags |= OBD_BRW_NOQUOTA;
                cmd |= OBD_BRW_NOQUOTA;
        }
index 681d60a7d5efc3faf0696f0a17fc1931d424cde7..777ae24bbfff465aa91c2e5169da20c662300e6a 100644 (file)
@@ -297,7 +297,7 @@ static int osc_io_commit_write(const struct lu_env *env,
         */
        osc_page_touch(env, cl2osc_page(slice), to);
        if (!client_is_remote(osc_export(obj)) &&
-           cfs_capable(CFS_CAP_SYS_RESOURCE))
+           capable(CFS_CAP_SYS_RESOURCE))
                oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
 
        if (oio->oi_lockless)
index 4909e486dc5c83d1dd0e1a1fc8afc46c2695e745..96cb6e2b9c4e22f2af71367104e11aea76f93a1d 100644 (file)
@@ -561,7 +561,7 @@ void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
        oap->oap_brw_flags = OBD_BRW_SYNC | brw_flags;
 
        if (!client_is_remote(osc_export(obj)) &&
-                       cfs_capable(CFS_CAP_SYS_RESOURCE)) {
+                       capable(CFS_CAP_SYS_RESOURCE)) {
                oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
                oap->oap_cmd |= OBD_BRW_NOQUOTA;
        }