From 4b899da50dcf1a7850715650281b5d76af8a5eb4 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 29 Sep 2016 17:48:36 +0200 Subject: ecryptfs: Switch to generic xattr handlers Signed-off-by: Andreas Gruenbacher Signed-off-by: Al Viro --- fs/ecryptfs/ecryptfs_kernel.h | 2 ++ fs/ecryptfs/inode.c | 62 +++++++++++++++++++++++++++++++++---------- fs/ecryptfs/main.c | 1 + 3 files changed, 51 insertions(+), 14 deletions(-) (limited to 'fs/ecryptfs') diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 4ba1547bb9ad..599a29237cfe 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h @@ -715,4 +715,6 @@ int ecryptfs_set_f_namelen(long *namelen, long lower_namelen, int ecryptfs_derive_iv(char *iv, struct ecryptfs_crypt_stat *crypt_stat, loff_t offset); +extern const struct xattr_handler *ecryptfs_xattr_handlers[]; + #endif /* #ifndef ECRYPTFS_KERNEL_H */ diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 9d153b6a1d72..cef32ccc3fcb 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -1066,19 +1066,22 @@ out: return rc; } -static int ecryptfs_removexattr(struct dentry *dentry, const char *name) +static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode, + const char *name) { int rc = 0; struct dentry *lower_dentry; + struct inode *lower_inode; lower_dentry = ecryptfs_dentry_to_lower(dentry); - if (!d_inode(lower_dentry)->i_op->removexattr) { + lower_inode = ecryptfs_inode_to_lower(inode); + if (!lower_inode->i_op->removexattr) { rc = -EOPNOTSUPP; goto out; } - inode_lock(d_inode(lower_dentry)); - rc = d_inode(lower_dentry)->i_op->removexattr(lower_dentry, name); - inode_unlock(d_inode(lower_dentry)); + inode_lock(lower_inode); + rc = lower_inode->i_op->removexattr(lower_dentry, name); + inode_unlock(lower_inode); out: return rc; } @@ -1089,10 +1092,10 @@ const struct inode_operations ecryptfs_symlink_iops = { .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, .getattr = ecryptfs_getattr_link, - .setxattr = ecryptfs_setxattr, - .getxattr = ecryptfs_getxattr, + .setxattr = generic_setxattr, + .getxattr = generic_getxattr, .listxattr = ecryptfs_listxattr, - .removexattr = ecryptfs_removexattr + .removexattr = generic_removexattr }; const struct inode_operations ecryptfs_dir_iops = { @@ -1107,18 +1110,49 @@ const struct inode_operations ecryptfs_dir_iops = { .rename = ecryptfs_rename, .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, - .setxattr = ecryptfs_setxattr, - .getxattr = ecryptfs_getxattr, + .setxattr = generic_setxattr, + .getxattr = generic_getxattr, .listxattr = ecryptfs_listxattr, - .removexattr = ecryptfs_removexattr + .removexattr = generic_removexattr }; const struct inode_operations ecryptfs_main_iops = { .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, .getattr = ecryptfs_getattr, - .setxattr = ecryptfs_setxattr, - .getxattr = ecryptfs_getxattr, + .setxattr = generic_setxattr, + .getxattr = generic_getxattr, .listxattr = ecryptfs_listxattr, - .removexattr = ecryptfs_removexattr + .removexattr = generic_removexattr +}; + +static int ecryptfs_xattr_get(const struct xattr_handler *handler, + struct dentry *dentry, struct inode *inode, + const char *name, void *buffer, size_t size) +{ + return ecryptfs_getxattr(dentry, inode, name, buffer, size); +} + +static int ecryptfs_xattr_set(const struct xattr_handler *handler, + struct dentry *dentry, struct inode *inode, + const char *name, const void *value, size_t size, + int flags) +{ + if (value) + return ecryptfs_setxattr(dentry, inode, name, value, size, flags); + else { + BUG_ON(flags != XATTR_REPLACE); + return ecryptfs_removexattr(dentry, inode, name); + } +} + +const struct xattr_handler ecryptfs_xattr_handler = { + .prefix = "", /* match anything */ + .get = ecryptfs_xattr_get, + .set = ecryptfs_xattr_set, +}; + +const struct xattr_handler *ecryptfs_xattr_handlers[] = { + &ecryptfs_xattr_handler, + NULL }; diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 612004495141..151872dcc1f4 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -529,6 +529,7 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags /* ->kill_sb() will take care of sbi after that point */ sbi = NULL; s->s_op = &ecryptfs_sops; + s->s_xattr = ecryptfs_xattr_handlers; s->s_d_op = &ecryptfs_dops; err = "Reading sb failed"; -- cgit v1.2.3 From 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 29 Sep 2016 17:48:42 +0200 Subject: xattr: Add __vfs_{get,set,remove}xattr helpers Right now, various places in the kernel check for the existence of getxattr, setxattr, and removexattr inode operations and directly call those operations. Switch to helper functions and test for the IOP_XATTR flag instead. Signed-off-by: Andreas Gruenbacher Acked-by: James Morris Signed-off-by: Al Viro --- fs/cachefiles/bind.c | 4 ++-- fs/cachefiles/namei.c | 4 ++-- fs/ecryptfs/inode.c | 18 +++++++------- fs/ecryptfs/mmap.c | 13 +++++------ fs/overlayfs/copy_up.c | 4 ++-- fs/overlayfs/super.c | 4 ++-- fs/xattr.c | 44 ++++++++++++++++++++++++++--------- include/linux/xattr.h | 3 +++ security/commoncap.c | 25 ++++++++------------ security/integrity/evm/evm_crypto.c | 7 +++--- security/integrity/evm/evm_main.c | 4 ++-- security/integrity/ima/ima_appraise.c | 21 ++++++++--------- security/selinux/hooks.c | 19 ++++++--------- security/smack/smack_lsm.c | 12 +++++----- 14 files changed, 97 insertions(+), 85 deletions(-) (limited to 'fs/ecryptfs') diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c index 6af790fc3df8..3ff867f87d73 100644 --- a/fs/cachefiles/bind.c +++ b/fs/cachefiles/bind.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "internal.h" static int cachefiles_daemon_add_cache(struct cachefiles_cache *caches); @@ -126,8 +127,7 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache) if (d_is_negative(root) || !d_backing_inode(root)->i_op->lookup || !d_backing_inode(root)->i_op->mkdir || - !d_backing_inode(root)->i_op->setxattr || - !d_backing_inode(root)->i_op->getxattr || + !(d_backing_inode(root)->i_opflags & IOP_XATTR) || !root->d_sb->s_op->statfs || !root->d_sb->s_op->sync_fs) goto error_unsupported; diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 3f7c2cd41f8f..6eb3dec2adbb 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "internal.h" #define CACHEFILES_KEYBUF_SIZE 512 @@ -799,8 +800,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, } ret = -EPERM; - if (!d_backing_inode(subdir)->i_op->setxattr || - !d_backing_inode(subdir)->i_op->getxattr || + if (!(d_backing_inode(subdir)->i_opflags & IOP_XATTR) || !d_backing_inode(subdir)->i_op->lookup || !d_backing_inode(subdir)->i_op->mkdir || !d_backing_inode(subdir)->i_op->create || diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index cef32ccc3fcb..32fee255d7b5 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -1005,15 +1005,14 @@ ecryptfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { - int rc = 0; + int rc; struct dentry *lower_dentry; lower_dentry = ecryptfs_dentry_to_lower(dentry); - if (!d_inode(lower_dentry)->i_op->setxattr) { + if (!(d_inode(lower_dentry)->i_opflags & IOP_XATTR)) { rc = -EOPNOTSUPP; goto out; } - rc = vfs_setxattr(lower_dentry, name, value, size, flags); if (!rc && inode) fsstack_copy_attr_all(inode, d_inode(lower_dentry)); @@ -1025,15 +1024,14 @@ ssize_t ecryptfs_getxattr_lower(struct dentry *lower_dentry, struct inode *lower_inode, const char *name, void *value, size_t size) { - int rc = 0; + int rc; - if (!lower_inode->i_op->getxattr) { + if (!(lower_inode->i_opflags & IOP_XATTR)) { rc = -EOPNOTSUPP; goto out; } inode_lock(lower_inode); - rc = lower_inode->i_op->getxattr(lower_dentry, lower_inode, - name, value, size); + rc = __vfs_getxattr(lower_dentry, lower_inode, name, value, size); inode_unlock(lower_inode); out: return rc; @@ -1069,18 +1067,18 @@ out: static int ecryptfs_removexattr(struct dentry *dentry, struct inode *inode, const char *name) { - int rc = 0; + int rc; struct dentry *lower_dentry; struct inode *lower_inode; lower_dentry = ecryptfs_dentry_to_lower(dentry); lower_inode = ecryptfs_inode_to_lower(inode); - if (!lower_inode->i_op->removexattr) { + if (!(lower_inode->i_opflags & IOP_XATTR)) { rc = -EOPNOTSUPP; goto out; } inode_lock(lower_inode); - rc = lower_inode->i_op->removexattr(lower_dentry, name); + rc = __vfs_removexattr(lower_dentry, name); inode_unlock(lower_inode); out: return rc; diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 9c3437c8a5b1..1f0c471b4ba3 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "ecryptfs_kernel.h" @@ -422,7 +423,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) struct inode *lower_inode = d_inode(lower_dentry); int rc; - if (!lower_inode->i_op->getxattr || !lower_inode->i_op->setxattr) { + if (!(lower_inode->i_opflags & IOP_XATTR)) { printk(KERN_WARNING "No support for setting xattr in lower filesystem\n"); rc = -ENOSYS; @@ -436,15 +437,13 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) goto out; } inode_lock(lower_inode); - size = lower_inode->i_op->getxattr(lower_dentry, lower_inode, - ECRYPTFS_XATTR_NAME, - xattr_virt, PAGE_SIZE); + size = __vfs_getxattr(lower_dentry, lower_inode, ECRYPTFS_XATTR_NAME, + xattr_virt, PAGE_SIZE); if (size < 0) size = 8; put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt); - rc = lower_inode->i_op->setxattr(lower_dentry, lower_inode, - ECRYPTFS_XATTR_NAME, - xattr_virt, size, 0); + rc = __vfs_setxattr(lower_dentry, lower_inode, ECRYPTFS_XATTR_NAME, + xattr_virt, size, 0); inode_unlock(lower_inode); if (rc) printk(KERN_ERR "Error whilst attempting to write inode size " diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 43fdc2765aea..807951cb438c 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -58,8 +58,8 @@ int ovl_copy_xattr(struct dentry *old, struct dentry *new) char *buf, *name, *value = NULL; int uninitialized_var(error); - if (!old->d_inode->i_op->getxattr || - !new->d_inode->i_op->getxattr) + if (!(old->d_inode->i_opflags & IOP_XATTR) || + !(new->d_inode->i_opflags & IOP_XATTR)) return 0; list_size = vfs_listxattr(old, NULL, 0); diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index e2a94a26767b..f170114481f7 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -275,10 +275,10 @@ static bool ovl_is_opaquedir(struct dentry *dentry) char val; struct inode *inode = dentry->d_inode; - if (!S_ISDIR(inode->i_mode) || !inode->i_op->getxattr) + if (!S_ISDIR(inode->i_mode) || !(inode->i_opflags & IOP_XATTR)) return false; - res = inode->i_op->getxattr(dentry, inode, OVL_XATTR_OPAQUE, &val, 1); + res = __vfs_getxattr(dentry, inode, OVL_XATTR_OPAQUE, &val, 1); if (res == 1 && val == 'y') return true; diff --git a/fs/xattr.c b/fs/xattr.c index 1f5d0b48422a..54a411519127 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -136,6 +136,16 @@ xattr_permission(struct inode *inode, const char *name, int mask) return inode_permission(inode, mask); } +int +__vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, + const void *value, size_t size, int flags) +{ + if (!inode->i_op->setxattr) + return -EOPNOTSUPP; + return inode->i_op->setxattr(dentry, inode, name, value, size, flags); +} +EXPORT_SYMBOL(__vfs_setxattr); + /** * __vfs_setxattr_noperm - perform setxattr operation without performing * permission checks. @@ -163,7 +173,7 @@ int __vfs_setxattr_noperm(struct dentry *dentry, const char *name, if (issec) inode->i_flags &= ~S_NOSEC; if (inode->i_op->setxattr) { - error = inode->i_op->setxattr(dentry, inode, name, value, size, flags); + error = __vfs_setxattr(dentry, inode, name, value, size, flags); if (!error) { fsnotify_xattr(dentry); security_inode_post_setxattr(dentry, name, value, @@ -274,6 +284,16 @@ vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value, return error; } +ssize_t +__vfs_getxattr(struct dentry *dentry, struct inode *inode, const char *name, + void *value, size_t size) +{ + if (!inode->i_op->getxattr) + return -EOPNOTSUPP; + return inode->i_op->getxattr(dentry, inode, name, value, size); +} +EXPORT_SYMBOL(__vfs_getxattr); + ssize_t vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) { @@ -301,13 +321,7 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) return ret; } nolsm: - if (inode->i_op->getxattr) - error = inode->i_op->getxattr(dentry, inode, name, value, size); - else - error = -EOPNOTSUPP; - - return error; - + return __vfs_getxattr(dentry, inode, name, value, size); } EXPORT_SYMBOL_GPL(vfs_getxattr); @@ -332,13 +346,21 @@ vfs_listxattr(struct dentry *d, char *list, size_t size) EXPORT_SYMBOL_GPL(vfs_listxattr); int -vfs_removexattr(struct dentry *dentry, const char *name) +__vfs_removexattr(struct dentry *dentry, const char *name) { struct inode *inode = dentry->d_inode; - int error; if (!inode->i_op->removexattr) return -EOPNOTSUPP; + return inode->i_op->removexattr(dentry, name); +} +EXPORT_SYMBOL(__vfs_removexattr); + +int +vfs_removexattr(struct dentry *dentry, const char *name) +{ + struct inode *inode = dentry->d_inode; + int error; error = xattr_permission(inode, name, MAY_WRITE); if (error) @@ -349,7 +371,7 @@ vfs_removexattr(struct dentry *dentry, const char *name) if (error) goto out; - error = inode->i_op->removexattr(dentry, name); + error = __vfs_removexattr(dentry, name); if (!error) { fsnotify_xattr(dentry); diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 94079bab9243..6ae6b2e68efb 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -46,10 +46,13 @@ struct xattr { }; ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t); +ssize_t __vfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t); ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t); ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size); +int __vfs_setxattr(struct dentry *, struct inode *, const char *, const void *, size_t, int); int __vfs_setxattr_noperm(struct dentry *, const char *, const void *, size_t, int); int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); +int __vfs_removexattr(struct dentry *, const char *); int vfs_removexattr(struct dentry *, const char *); ssize_t generic_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size); diff --git a/security/commoncap.c b/security/commoncap.c index 14540bd78561..8df676fbd393 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -310,13 +310,8 @@ int cap_inode_need_killpriv(struct dentry *dentry) struct inode *inode = d_backing_inode(dentry); int error; - if (!inode->i_op->getxattr) - return 0; - - error = inode->i_op->getxattr(dentry, inode, XATTR_NAME_CAPS, NULL, 0); - if (error <= 0) - return 0; - return 1; + error = __vfs_getxattr(dentry, inode, XATTR_NAME_CAPS, NULL, 0); + return error > 0; } /** @@ -329,12 +324,12 @@ int cap_inode_need_killpriv(struct dentry *dentry) */ int cap_inode_killpriv(struct dentry *dentry) { - struct inode *inode = d_backing_inode(dentry); - - if (!inode->i_op->removexattr) - return 0; + int error; - return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS); + error = __vfs_removexattr(dentry, XATTR_NAME_CAPS); + if (error == -EOPNOTSUPP) + error = 0; + return error; } /* @@ -394,11 +389,11 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data)); - if (!inode || !inode->i_op->getxattr) + if (!inode) return -ENODATA; - size = inode->i_op->getxattr((struct dentry *)dentry, inode, - XATTR_NAME_CAPS, &caps, XATTR_CAPS_SZ); + size = __vfs_getxattr((struct dentry *)dentry, inode, + XATTR_NAME_CAPS, &caps, XATTR_CAPS_SZ); if (size == -ENODATA || size == -EOPNOTSUPP) /* no data, that's ok */ return -ENODATA; diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c index 11c1d30bd705..bf663915412e 100644 --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c @@ -182,8 +182,9 @@ static int evm_calc_hmac_or_hash(struct dentry *dentry, int error; int size; - if (!inode->i_op->getxattr) + if (!(inode->i_opflags & IOP_XATTR)) return -EOPNOTSUPP; + desc = init_desc(type); if (IS_ERR(desc)) return PTR_ERR(desc); @@ -253,8 +254,8 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM, &xattr_data, sizeof(xattr_data), 0); - } else if (rc == -ENODATA && inode->i_op->removexattr) { - rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); + } else if (rc == -ENODATA && (inode->i_opflags & IOP_XATTR)) { + rc = __vfs_removexattr(dentry, XATTR_NAME_EVM); } return rc; } diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index b9e26288d30c..ba8615576d4d 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c @@ -78,11 +78,11 @@ static int evm_find_protected_xattrs(struct dentry *dentry) int error; int count = 0; - if (!inode->i_op->getxattr) + if (!(inode->i_opflags & IOP_XATTR)) return -EOPNOTSUPP; for (xattr = evm_config_xattrnames; *xattr != NULL; xattr++) { - error = inode->i_op->getxattr(dentry, inode, *xattr, NULL, 0); + error = __vfs_getxattr(dentry, inode, *xattr, NULL, 0); if (error < 0) { if (error == -ENODATA) continue; diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 4b9b4a4e1b89..0cc40af9c218 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -165,13 +165,13 @@ enum hash_algo ima_get_hash_algo(struct evm_ima_xattr_data *xattr_value, int ima_read_xattr(struct dentry *dentry, struct evm_ima_xattr_data **xattr_value) { - struct inode *inode = d_backing_inode(dentry); - - if (!inode->i_op->getxattr) - return 0; + ssize_t ret; - return vfs_getxattr_alloc(dentry, XATTR_NAME_IMA, (char **)xattr_value, - 0, GFP_NOFS); + ret = vfs_getxattr_alloc(dentry, XATTR_NAME_IMA, (char **)xattr_value, + 0, GFP_NOFS); + if (ret == -EOPNOTSUPP) + ret = 0; + return ret; } /* @@ -195,7 +195,7 @@ int ima_appraise_measurement(enum ima_hooks func, enum integrity_status status = INTEGRITY_UNKNOWN; int rc = xattr_len, hash_start = 0; - if (!inode->i_op->getxattr) + if (!(inode->i_opflags & IOP_XATTR)) return INTEGRITY_UNKNOWN; if (rc <= 0) { @@ -322,10 +322,10 @@ void ima_inode_post_setattr(struct dentry *dentry) { struct inode *inode = d_backing_inode(dentry); struct integrity_iint_cache *iint; - int must_appraise, rc; + int must_appraise; if (!(ima_policy_flag & IMA_APPRAISE) || !S_ISREG(inode->i_mode) - || !inode->i_op->removexattr) + || !(inode->i_opflags & IOP_XATTR)) return; must_appraise = ima_must_appraise(inode, MAY_ACCESS, POST_SETATTR); @@ -338,8 +338,7 @@ void ima_inode_post_setattr(struct dentry *dentry) iint->flags |= IMA_APPRAISE; } if (!must_appraise) - rc = inode->i_op->removexattr(dentry, XATTR_NAME_IMA); - return; + __vfs_removexattr(dentry, XATTR_NAME_IMA); } /* diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 13185a6c266a..3db31ac7986b 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -507,14 +507,14 @@ static int sb_finish_set_opts(struct super_block *sb) the root directory. -ENODATA is ok, as this may be the first boot of the SELinux kernel before we have assigned xattr values to the filesystem. */ - if (!root_inode->i_op->getxattr) { + if (!(root_inode->i_opflags & IOP_XATTR)) { printk(KERN_WARNING "SELinux: (dev %s, type %s) has no " "xattr support\n", sb->s_id, sb->s_type->name); rc = -EOPNOTSUPP; goto out; } - rc = root_inode->i_op->getxattr(root, root_inode, - XATTR_NAME_SELINUX, NULL, 0); + + rc = __vfs_getxattr(root, root_inode, XATTR_NAME_SELINUX, NULL, 0); if (rc < 0 && rc != -ENODATA) { if (rc == -EOPNOTSUPP) printk(KERN_WARNING "SELinux: (dev %s, type " @@ -1410,11 +1410,10 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent case SECURITY_FS_USE_NATIVE: break; case SECURITY_FS_USE_XATTR: - if (!inode->i_op->getxattr) { + if (!(inode->i_opflags & IOP_XATTR)) { isec->sid = sbsec->def_sid; break; } - /* Need a dentry, since the xattr API requires one. Life would be simpler if we could just pass the inode. */ if (opt_dentry) { @@ -1445,14 +1444,12 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent goto out_unlock; } context[len] = '\0'; - rc = inode->i_op->getxattr(dentry, inode, XATTR_NAME_SELINUX, - context, len); + rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len); if (rc == -ERANGE) { kfree(context); /* Need a larger buffer. Query for the right size. */ - rc = inode->i_op->getxattr(dentry, inode, XATTR_NAME_SELINUX, - NULL, 0); + rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, NULL, 0); if (rc < 0) { dput(dentry); goto out_unlock; @@ -1465,9 +1462,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent goto out_unlock; } context[len] = '\0'; - rc = inode->i_op->getxattr(dentry, inode, - XATTR_NAME_SELINUX, - context, len); + rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len); } dput(dentry); if (rc < 0) { diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 87a9741b0d02..516b3f50f23d 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -265,14 +265,14 @@ static struct smack_known *smk_fetch(const char *name, struct inode *ip, char *buffer; struct smack_known *skp = NULL; - if (ip->i_op->getxattr == NULL) + if (!(ip->i_opflags & IOP_XATTR)) return ERR_PTR(-EOPNOTSUPP); buffer = kzalloc(SMK_LONGLABEL, GFP_KERNEL); if (buffer == NULL) return ERR_PTR(-ENOMEM); - rc = ip->i_op->getxattr(dp, ip, name, buffer, SMK_LONGLABEL); + rc = __vfs_getxattr(dp, ip, name, buffer, SMK_LONGLABEL); if (rc < 0) skp = ERR_PTR(rc); else if (rc == 0) @@ -3520,8 +3520,8 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) * It would be curious if the label of the task * does not match that assigned. */ - if (inode->i_op->getxattr == NULL) - break; + if (!(inode->i_opflags & IOP_XATTR)) + break; /* * Get the dentry for xattr. */ @@ -3545,12 +3545,12 @@ static void smack_d_instantiate(struct dentry *opt_dentry, struct inode *inode) */ if (isp->smk_flags & SMK_INODE_CHANGED) { isp->smk_flags &= ~SMK_INODE_CHANGED; - rc = inode->i_op->setxattr(dp, inode, + rc = __vfs_setxattr(dp, inode, XATTR_NAME_SMACKTRANSMUTE, TRANS_TRUE, TRANS_TRUE_SIZE, 0); } else { - rc = inode->i_op->getxattr(dp, inode, + rc = __vfs_getxattr(dp, inode, XATTR_NAME_SMACKTRANSMUTE, trattr, TRANS_TRUE_SIZE); if (rc >= 0 && strncmp(trattr, TRANS_TRUE, -- cgit v1.2.3 From fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 29 Sep 2016 17:48:45 +0200 Subject: vfs: Remove {get,set,remove}xattr inode operations These inode operations are no longer used; remove them. Signed-off-by: Andreas Gruenbacher Signed-off-by: Al Viro --- drivers/staging/lustre/lustre/llite/file.c | 3 -- drivers/staging/lustre/lustre/llite/namei.c | 6 --- drivers/staging/lustre/lustre/llite/symlink.c | 3 -- fs/9p/vfs_inode_dotl.c | 9 ----- fs/btrfs/inode.c | 12 ------ fs/ceph/dir.c | 3 -- fs/ceph/inode.c | 6 --- fs/cifs/cifsfs.c | 9 ----- fs/ecryptfs/inode.c | 9 ----- fs/ext2/file.c | 3 -- fs/ext2/namei.c | 6 --- fs/ext2/symlink.c | 6 --- fs/ext4/file.c | 3 -- fs/ext4/namei.c | 6 --- fs/ext4/symlink.c | 9 ----- fs/f2fs/file.c | 3 -- fs/f2fs/namei.c | 12 ------ fs/fuse/dir.c | 9 ----- fs/gfs2/inode.c | 9 ----- fs/hfs/inode.c | 2 - fs/hfsplus/dir.c | 3 -- fs/hfsplus/inode.c | 3 -- fs/jffs2/dir.c | 3 -- fs/jffs2/file.c | 3 -- fs/jffs2/symlink.c | 3 -- fs/jfs/file.c | 3 -- fs/jfs/namei.c | 3 -- fs/jfs/symlink.c | 6 --- fs/kernfs/dir.c | 3 -- fs/kernfs/inode.c | 3 -- fs/kernfs/symlink.c | 3 -- fs/nfs/nfs3proc.c | 6 --- fs/nfs/nfs4proc.c | 6 --- fs/ocfs2/file.c | 3 -- fs/ocfs2/namei.c | 3 -- fs/ocfs2/symlink.c | 3 -- fs/orangefs/inode.c | 3 -- fs/orangefs/namei.c | 3 -- fs/orangefs/symlink.c | 1 - fs/overlayfs/dir.c | 3 -- fs/overlayfs/inode.c | 6 --- fs/reiserfs/file.c | 3 -- fs/reiserfs/namei.c | 9 ----- fs/squashfs/inode.c | 1 - fs/squashfs/namei.c | 1 - fs/squashfs/symlink.c | 1 - fs/squashfs/xattr.h | 1 - fs/ubifs/dir.c | 3 -- fs/ubifs/file.c | 6 --- fs/xattr.c | 53 --------------------------- fs/xfs/xfs_iops.c | 15 -------- include/linux/fs.h | 5 --- include/linux/xattr.h | 4 -- mm/shmem.c | 15 -------- net/socket.c | 1 - 55 files changed, 319 deletions(-) (limited to 'fs/ecryptfs') diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 58a7401046e0..e8c81e821188 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3213,10 +3213,7 @@ const struct inode_operations ll_file_inode_operations = { .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ll_listxattr, - .removexattr = generic_removexattr, .fiemap = ll_fiemap, .get_acl = ll_get_acl, }; diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 09e180170de2..f9822403026e 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -1106,10 +1106,7 @@ const struct inode_operations ll_dir_inode_operations = { .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ll_listxattr, - .removexattr = generic_removexattr, .get_acl = ll_get_acl, }; @@ -1117,9 +1114,6 @@ const struct inode_operations ll_special_inode_operations = { .setattr = ll_setattr, .getattr = ll_getattr, .permission = ll_inode_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ll_listxattr, - .removexattr = generic_removexattr, .get_acl = ll_get_acl, }; diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 4601be94dd22..d82dab2cc6f6 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -155,8 +155,5 @@ const struct inode_operations ll_fast_symlink_inode_operations = { .get_link = ll_get_link, .getattr = ll_getattr, .permission = ll_inode_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ll_listxattr, - .removexattr = generic_removexattr, }; diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index eeabcb0bad12..d8220efdd752 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -967,9 +967,6 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = { .rename = v9fs_vfs_rename, .getattr = v9fs_vfs_getattr_dotl, .setattr = v9fs_vfs_setattr_dotl, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = v9fs_listxattr, .get_acl = v9fs_iop_get_acl, }; @@ -977,9 +974,6 @@ const struct inode_operations v9fs_dir_inode_operations_dotl = { const struct inode_operations v9fs_file_inode_operations_dotl = { .getattr = v9fs_vfs_getattr_dotl, .setattr = v9fs_vfs_setattr_dotl, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = v9fs_listxattr, .get_acl = v9fs_iop_get_acl, }; @@ -989,8 +983,5 @@ const struct inode_operations v9fs_symlink_inode_operations_dotl = { .get_link = v9fs_vfs_get_link_dotl, .getattr = v9fs_vfs_getattr_dotl, .setattr = v9fs_vfs_setattr_dotl, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = v9fs_listxattr, }; diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e6811c42e41e..d06c6a288512 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -10570,10 +10570,7 @@ static const struct inode_operations btrfs_dir_inode_operations = { .symlink = btrfs_symlink, .setattr = btrfs_setattr, .mknod = btrfs_mknod, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = btrfs_listxattr, - .removexattr = generic_removexattr, .permission = btrfs_permission, .get_acl = btrfs_get_acl, .set_acl = btrfs_set_acl, @@ -10647,10 +10644,7 @@ static const struct address_space_operations btrfs_symlink_aops = { static const struct inode_operations btrfs_file_inode_operations = { .getattr = btrfs_getattr, .setattr = btrfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = btrfs_listxattr, - .removexattr = generic_removexattr, .permission = btrfs_permission, .fiemap = btrfs_fiemap, .get_acl = btrfs_get_acl, @@ -10661,10 +10655,7 @@ static const struct inode_operations btrfs_special_inode_operations = { .getattr = btrfs_getattr, .setattr = btrfs_setattr, .permission = btrfs_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = btrfs_listxattr, - .removexattr = generic_removexattr, .get_acl = btrfs_get_acl, .set_acl = btrfs_set_acl, .update_time = btrfs_update_time, @@ -10675,10 +10666,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = { .getattr = btrfs_getattr, .setattr = btrfs_setattr, .permission = btrfs_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = btrfs_listxattr, - .removexattr = generic_removexattr, .update_time = btrfs_update_time, }; diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index df4b3e6fa563..e33bd0933396 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1486,10 +1486,7 @@ const struct inode_operations ceph_dir_iops = { .permission = ceph_permission, .getattr = ceph_getattr, .setattr = ceph_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ceph_listxattr, - .removexattr = generic_removexattr, .get_acl = ceph_get_acl, .set_acl = ceph_set_acl, .mknod = ceph_mknod, diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index dd3a6dbf71eb..e70b4f535c79 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -94,10 +94,7 @@ const struct inode_operations ceph_file_iops = { .permission = ceph_permission, .setattr = ceph_setattr, .getattr = ceph_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ceph_listxattr, - .removexattr = generic_removexattr, .get_acl = ceph_get_acl, .set_acl = ceph_set_acl, }; @@ -1885,10 +1882,7 @@ static const struct inode_operations ceph_symlink_iops = { .get_link = simple_get_link, .setattr = ceph_setattr, .getattr = ceph_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ceph_listxattr, - .removexattr = generic_removexattr, }; int __ceph_setattr(struct inode *inode, struct iattr *attr) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 14ae4b8e1a3c..34aac1c73ee1 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -901,30 +901,21 @@ const struct inode_operations cifs_dir_inode_ops = { .setattr = cifs_setattr, .symlink = cifs_symlink, .mknod = cifs_mknod, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = cifs_listxattr, - .removexattr = generic_removexattr, }; const struct inode_operations cifs_file_inode_ops = { .setattr = cifs_setattr, .getattr = cifs_getattr, .permission = cifs_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = cifs_listxattr, - .removexattr = generic_removexattr, }; const struct inode_operations cifs_symlink_inode_ops = { .readlink = generic_readlink, .get_link = cifs_get_link, .permission = cifs_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = cifs_listxattr, - .removexattr = generic_removexattr, }; static int cifs_clone_file_range(struct file *src_file, loff_t off, diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 32fee255d7b5..3f2575ddd45e 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -1090,10 +1090,7 @@ const struct inode_operations ecryptfs_symlink_iops = { .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, .getattr = ecryptfs_getattr_link, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ecryptfs_listxattr, - .removexattr = generic_removexattr }; const struct inode_operations ecryptfs_dir_iops = { @@ -1108,20 +1105,14 @@ const struct inode_operations ecryptfs_dir_iops = { .rename = ecryptfs_rename, .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ecryptfs_listxattr, - .removexattr = generic_removexattr }; const struct inode_operations ecryptfs_main_iops = { .permission = ecryptfs_permission, .setattr = ecryptfs_setattr, .getattr = ecryptfs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ecryptfs_listxattr, - .removexattr = generic_removexattr }; static int ecryptfs_xattr_get(const struct xattr_handler *handler, diff --git a/fs/ext2/file.c b/fs/ext2/file.c index 5efeefe17abb..538f77616f3c 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c @@ -178,10 +178,7 @@ const struct file_operations ext2_file_operations = { const struct inode_operations ext2_file_inode_operations = { #ifdef CONFIG_EXT2_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext2_listxattr, - .removexattr = generic_removexattr, #endif .setattr = ext2_setattr, .get_acl = ext2_get_acl, diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index d446203127fc..ff32ea799496 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c @@ -428,10 +428,7 @@ const struct inode_operations ext2_dir_inode_operations = { .mknod = ext2_mknod, .rename = ext2_rename, #ifdef CONFIG_EXT2_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext2_listxattr, - .removexattr = generic_removexattr, #endif .setattr = ext2_setattr, .get_acl = ext2_get_acl, @@ -441,10 +438,7 @@ const struct inode_operations ext2_dir_inode_operations = { const struct inode_operations ext2_special_inode_operations = { #ifdef CONFIG_EXT2_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext2_listxattr, - .removexattr = generic_removexattr, #endif .setattr = ext2_setattr, .get_acl = ext2_get_acl, diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c index 3495d8ae4b33..8437b191bf5d 100644 --- a/fs/ext2/symlink.c +++ b/fs/ext2/symlink.c @@ -25,10 +25,7 @@ const struct inode_operations ext2_symlink_inode_operations = { .get_link = page_get_link, .setattr = ext2_setattr, #ifdef CONFIG_EXT2_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext2_listxattr, - .removexattr = generic_removexattr, #endif }; @@ -37,9 +34,6 @@ const struct inode_operations ext2_fast_symlink_inode_operations = { .get_link = simple_get_link, .setattr = ext2_setattr, #ifdef CONFIG_EXT2_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext2_listxattr, - .removexattr = generic_removexattr, #endif }; diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 261ac3734c58..93072dbcb3ac 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -711,10 +711,7 @@ const struct file_operations ext4_file_operations = { const struct inode_operations ext4_file_inode_operations = { .setattr = ext4_setattr, .getattr = ext4_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext4_listxattr, - .removexattr = generic_removexattr, .get_acl = ext4_get_acl, .set_acl = ext4_set_acl, .fiemap = ext4_fiemap, diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 34c0142caf6a..ddc309e8471e 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3882,10 +3882,7 @@ const struct inode_operations ext4_dir_inode_operations = { .tmpfile = ext4_tmpfile, .rename2 = ext4_rename2, .setattr = ext4_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext4_listxattr, - .removexattr = generic_removexattr, .get_acl = ext4_get_acl, .set_acl = ext4_set_acl, .fiemap = ext4_fiemap, @@ -3893,10 +3890,7 @@ const struct inode_operations ext4_dir_inode_operations = { const struct inode_operations ext4_special_inode_operations = { .setattr = ext4_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext4_listxattr, - .removexattr = generic_removexattr, .get_acl = ext4_get_acl, .set_acl = ext4_set_acl, }; diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c index 4d83d9e05f2e..128ea78b8958 100644 --- a/fs/ext4/symlink.c +++ b/fs/ext4/symlink.c @@ -90,28 +90,19 @@ const struct inode_operations ext4_encrypted_symlink_inode_operations = { .readlink = generic_readlink, .get_link = ext4_encrypted_get_link, .setattr = ext4_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext4_listxattr, - .removexattr = generic_removexattr, }; const struct inode_operations ext4_symlink_inode_operations = { .readlink = generic_readlink, .get_link = page_get_link, .setattr = ext4_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext4_listxattr, - .removexattr = generic_removexattr, }; const struct inode_operations ext4_fast_symlink_inode_operations = { .readlink = generic_readlink, .get_link = simple_get_link, .setattr = ext4_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ext4_listxattr, - .removexattr = generic_removexattr, }; diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 28f4f4cbb8d8..2ebc4c79562c 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -732,10 +732,7 @@ const struct inode_operations f2fs_file_inode_operations = { .get_acl = f2fs_get_acl, .set_acl = f2fs_set_acl, #ifdef CONFIG_F2FS_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = f2fs_listxattr, - .removexattr = generic_removexattr, #endif .fiemap = f2fs_fiemap, }; diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 73fa356f8fbb..1c481c9dc088 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -1077,10 +1077,7 @@ const struct inode_operations f2fs_encrypted_symlink_inode_operations = { .getattr = f2fs_getattr, .setattr = f2fs_setattr, #ifdef CONFIG_F2FS_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = f2fs_listxattr, - .removexattr = generic_removexattr, #endif }; @@ -1100,10 +1097,7 @@ const struct inode_operations f2fs_dir_inode_operations = { .get_acl = f2fs_get_acl, .set_acl = f2fs_set_acl, #ifdef CONFIG_F2FS_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = f2fs_listxattr, - .removexattr = generic_removexattr, #endif }; @@ -1113,10 +1107,7 @@ const struct inode_operations f2fs_symlink_inode_operations = { .getattr = f2fs_getattr, .setattr = f2fs_setattr, #ifdef CONFIG_F2FS_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = f2fs_listxattr, - .removexattr = generic_removexattr, #endif }; @@ -1126,9 +1117,6 @@ const struct inode_operations f2fs_special_inode_operations = { .get_acl = f2fs_get_acl, .set_acl = f2fs_set_acl, #ifdef CONFIG_F2FS_FS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = f2fs_listxattr, - .removexattr = generic_removexattr, #endif }; diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 7490db141dd9..dbf77fe1dc2e 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1739,10 +1739,7 @@ static const struct inode_operations fuse_dir_inode_operations = { .mknod = fuse_mknod, .permission = fuse_permission, .getattr = fuse_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = fuse_listxattr, - .removexattr = generic_removexattr, }; static const struct file_operations fuse_dir_operations = { @@ -1760,10 +1757,7 @@ static const struct inode_operations fuse_common_inode_operations = { .setattr = fuse_setattr, .permission = fuse_permission, .getattr = fuse_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = fuse_listxattr, - .removexattr = generic_removexattr, }; static const struct inode_operations fuse_symlink_inode_operations = { @@ -1771,10 +1765,7 @@ static const struct inode_operations fuse_symlink_inode_operations = { .get_link = fuse_get_link, .readlink = generic_readlink, .getattr = fuse_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = fuse_listxattr, - .removexattr = generic_removexattr, }; void fuse_init_common(struct inode *inode) diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index e4da0ecd3285..9cbd4b6ebff1 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -2036,10 +2036,7 @@ const struct inode_operations gfs2_file_iops = { .permission = gfs2_permission, .setattr = gfs2_setattr, .getattr = gfs2_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = gfs2_listxattr, - .removexattr = generic_removexattr, .fiemap = gfs2_fiemap, .get_acl = gfs2_get_acl, .set_acl = gfs2_set_acl, @@ -2058,10 +2055,7 @@ const struct inode_operations gfs2_dir_iops = { .permission = gfs2_permission, .setattr = gfs2_setattr, .getattr = gfs2_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = gfs2_listxattr, - .removexattr = generic_removexattr, .fiemap = gfs2_fiemap, .get_acl = gfs2_get_acl, .set_acl = gfs2_set_acl, @@ -2074,10 +2068,7 @@ const struct inode_operations gfs2_symlink_iops = { .permission = gfs2_permission, .setattr = gfs2_setattr, .getattr = gfs2_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = gfs2_listxattr, - .removexattr = generic_removexattr, .fiemap = gfs2_fiemap, }; diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 7f44f1a4e4c0..a181bd709b1e 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -688,7 +688,5 @@ static const struct file_operations hfs_file_operations = { static const struct inode_operations hfs_file_inode_operations = { .lookup = hfs_file_lookup, .setattr = hfs_inode_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = generic_listxattr, }; diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 42e128661dc1..9cbe43075de5 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -562,10 +562,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { .symlink = hfsplus_symlink, .mknod = hfsplus_mknod, .rename = hfsplus_rename, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr, - .removexattr = generic_removexattr, #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL .get_acl = hfsplus_get_posix_acl, .set_acl = hfsplus_set_posix_acl, diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 19462d773fe2..4a7c9241213d 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -333,10 +333,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, static const struct inode_operations hfsplus_file_inode_operations = { .setattr = hfsplus_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr, - .removexattr = generic_removexattr, #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL .get_acl = hfsplus_get_posix_acl, .set_acl = hfsplus_set_posix_acl, diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 8aa2f8936c3a..9b242434adf2 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c @@ -61,10 +61,7 @@ const struct inode_operations jffs2_dir_inode_operations = .get_acl = jffs2_get_acl, .set_acl = jffs2_set_acl, .setattr = jffs2_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jffs2_listxattr, - .removexattr = generic_removexattr }; /***********************************************************************/ diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index fdf9e1cb2e48..c12476e309c6 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -66,10 +66,7 @@ const struct inode_operations jffs2_file_inode_operations = .get_acl = jffs2_get_acl, .set_acl = jffs2_set_acl, .setattr = jffs2_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jffs2_listxattr, - .removexattr = generic_removexattr }; const struct address_space_operations jffs2_file_address_operations = diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index afe2d75ae395..8f3f0855fcd2 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c @@ -16,8 +16,5 @@ const struct inode_operations jffs2_symlink_inode_operations = .readlink = generic_readlink, .get_link = simple_get_link, .setattr = jffs2_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jffs2_listxattr, - .removexattr = generic_removexattr }; diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 7f1a585a0a94..f6eb0417a909 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c @@ -140,10 +140,7 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) } const struct inode_operations jfs_file_inode_operations = { - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jfs_listxattr, - .removexattr = generic_removexattr, .setattr = jfs_setattr, #ifdef CONFIG_JFS_POSIX_ACL .get_acl = jfs_get_acl, diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 814b0c58016c..e420c6088336 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c @@ -1537,10 +1537,7 @@ const struct inode_operations jfs_dir_inode_operations = { .rmdir = jfs_rmdir, .mknod = jfs_mknod, .rename = jfs_rename, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jfs_listxattr, - .removexattr = generic_removexattr, .setattr = jfs_setattr, #ifdef CONFIG_JFS_POSIX_ACL .get_acl = jfs_get_acl, diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c index c94c7e4a1323..c82404fee6cd 100644 --- a/fs/jfs/symlink.c +++ b/fs/jfs/symlink.c @@ -25,19 +25,13 @@ const struct inode_operations jfs_fast_symlink_inode_operations = { .readlink = generic_readlink, .get_link = simple_get_link, .setattr = jfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jfs_listxattr, - .removexattr = generic_removexattr, }; const struct inode_operations jfs_symlink_inode_operations = { .readlink = generic_readlink, .get_link = page_get_link, .setattr = jfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = jfs_listxattr, - .removexattr = generic_removexattr, }; diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index a6e430adf67d..2b23ad91a464 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -1126,9 +1126,6 @@ const struct inode_operations kernfs_dir_iops = { .permission = kernfs_iop_permission, .setattr = kernfs_iop_setattr, .getattr = kernfs_iop_getattr, - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, - .getxattr = generic_getxattr, .listxattr = kernfs_iop_listxattr, .mkdir = kernfs_iop_mkdir, diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 6bc87547dede..2b735ce0268a 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -28,9 +28,6 @@ static const struct inode_operations kernfs_iops = { .permission = kernfs_iop_permission, .setattr = kernfs_iop_setattr, .getattr = kernfs_iop_getattr, - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, - .getxattr = generic_getxattr, .listxattr = kernfs_iop_listxattr, }; diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c index 549a14c7c50a..9b43ca02b7ab 100644 --- a/fs/kernfs/symlink.c +++ b/fs/kernfs/symlink.c @@ -134,9 +134,6 @@ static const char *kernfs_iop_get_link(struct dentry *dentry, } const struct inode_operations kernfs_symlink_iops = { - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, - .getxattr = generic_getxattr, .listxattr = kernfs_iop_listxattr, .readlink = generic_readlink, .get_link = kernfs_iop_get_link, diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 698be9361280..dc925b531f32 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -899,9 +899,6 @@ static const struct inode_operations nfs3_dir_inode_operations = { .setattr = nfs_setattr, #ifdef CONFIG_NFS_V3_ACL .listxattr = nfs3_listxattr, - .getxattr = generic_getxattr, - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, .get_acl = nfs3_get_acl, .set_acl = nfs3_set_acl, #endif @@ -913,9 +910,6 @@ static const struct inode_operations nfs3_file_inode_operations = { .setattr = nfs_setattr, #ifdef CONFIG_NFS_V3_ACL .listxattr = nfs3_listxattr, - .getxattr = generic_getxattr, - .setxattr = generic_setxattr, - .removexattr = generic_removexattr, .get_acl = nfs3_get_acl, .set_acl = nfs3_set_acl, #endif diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a9dec32ba9ba..0e327528a3ce 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -8941,20 +8941,14 @@ static const struct inode_operations nfs4_dir_inode_operations = { .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr, - .getxattr = generic_getxattr, - .setxattr = generic_setxattr, .listxattr = nfs4_listxattr, - .removexattr = generic_removexattr, }; static const struct inode_operations nfs4_file_inode_operations = { .permission = nfs_permission, .getattr = nfs_getattr, .setattr = nfs_setattr, - .getxattr = generic_getxattr, - .setxattr = generic_setxattr, .listxattr = nfs4_listxattr, - .removexattr = generic_removexattr, }; const struct nfs_rpc_ops nfs_v4_clientops = { diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 0b055bfb8e86..63316db763da 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -2474,10 +2474,7 @@ const struct inode_operations ocfs2_file_iops = { .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ocfs2_listxattr, - .removexattr = generic_removexattr, .fiemap = ocfs2_fiemap, .get_acl = ocfs2_iop_get_acl, .set_acl = ocfs2_iop_set_acl, diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index a8f1225e6d9b..6cc043ebb9fa 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -2913,10 +2913,7 @@ const struct inode_operations ocfs2_dir_iops = { .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ocfs2_listxattr, - .removexattr = generic_removexattr, .fiemap = ocfs2_fiemap, .get_acl = ocfs2_iop_get_acl, .set_acl = ocfs2_iop_set_acl, diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index 6c2a3e3c521c..6ad8eecefe21 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c @@ -91,9 +91,6 @@ const struct inode_operations ocfs2_symlink_inode_operations = { .get_link = page_get_link, .getattr = ocfs2_getattr, .setattr = ocfs2_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ocfs2_listxattr, - .removexattr = generic_removexattr, .fiemap = ocfs2_fiemap, }; diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 28a0557a69be..a9407eeecb21 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -296,10 +296,7 @@ const struct inode_operations orangefs_file_inode_operations = { .set_acl = orangefs_set_acl, .setattr = orangefs_setattr, .getattr = orangefs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = orangefs_listxattr, - .removexattr = generic_removexattr, .permission = orangefs_permission, }; diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 62c525936ee8..ccca5186d5cd 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -462,9 +462,6 @@ const struct inode_operations orangefs_dir_inode_operations = { .rename = orangefs_rename, .setattr = orangefs_setattr, .getattr = orangefs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = orangefs_listxattr, .permission = orangefs_permission, }; diff --git a/fs/orangefs/symlink.c b/fs/orangefs/symlink.c index 8fecf823f5ba..10b0b06e075e 100644 --- a/fs/orangefs/symlink.c +++ b/fs/orangefs/symlink.c @@ -14,6 +14,5 @@ const struct inode_operations orangefs_symlink_inode_operations = { .setattr = orangefs_setattr, .getattr = orangefs_getattr, .listxattr = orangefs_listxattr, - .setxattr = generic_setxattr, .permission = orangefs_permission, }; diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 1560fdc09a5f..463a18477a10 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -1003,10 +1003,7 @@ const struct inode_operations ovl_dir_inode_operations = { .mknod = ovl_mknod, .permission = ovl_permission, .getattr = ovl_dir_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ovl_listxattr, - .removexattr = generic_removexattr, .get_acl = ovl_get_acl, .update_time = ovl_update_time, }; diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index c75625c1efa3..b4c35594d9d8 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -367,10 +367,7 @@ static const struct inode_operations ovl_file_inode_operations = { .setattr = ovl_setattr, .permission = ovl_permission, .getattr = ovl_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ovl_listxattr, - .removexattr = generic_removexattr, .get_acl = ovl_get_acl, .update_time = ovl_update_time, }; @@ -380,10 +377,7 @@ static const struct inode_operations ovl_symlink_inode_operations = { .get_link = ovl_get_link, .readlink = ovl_readlink, .getattr = ovl_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ovl_listxattr, - .removexattr = generic_removexattr, .update_time = ovl_update_time, }; diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 90f815bdfa8a..2f8c5c9bdaf6 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c @@ -260,10 +260,7 @@ const struct file_operations reiserfs_file_operations = { const struct inode_operations reiserfs_file_inode_operations = { .setattr = reiserfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = reiserfs_listxattr, - .removexattr = generic_removexattr, .permission = reiserfs_permission, .get_acl = reiserfs_get_acl, .set_acl = reiserfs_set_acl, diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 8a36696d6df9..fd7d0606aa96 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c @@ -1650,10 +1650,7 @@ const struct inode_operations reiserfs_dir_inode_operations = { .mknod = reiserfs_mknod, .rename = reiserfs_rename, .setattr = reiserfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = reiserfs_listxattr, - .removexattr = generic_removexattr, .permission = reiserfs_permission, .get_acl = reiserfs_get_acl, .set_acl = reiserfs_set_acl, @@ -1667,10 +1664,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = { .readlink = generic_readlink, .get_link = page_get_link, .setattr = reiserfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = reiserfs_listxattr, - .removexattr = generic_removexattr, .permission = reiserfs_permission, }; @@ -1679,10 +1673,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = { */ const struct inode_operations reiserfs_special_inode_operations = { .setattr = reiserfs_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = reiserfs_listxattr, - .removexattr = generic_removexattr, .permission = reiserfs_permission, .get_acl = reiserfs_get_acl, .set_acl = reiserfs_set_acl, diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c index 0927b1e80ab6..e9793b1e49a5 100644 --- a/fs/squashfs/inode.c +++ b/fs/squashfs/inode.c @@ -425,7 +425,6 @@ failed_read: const struct inode_operations squashfs_inode_ops = { - .getxattr = generic_getxattr, .listxattr = squashfs_listxattr }; diff --git a/fs/squashfs/namei.c b/fs/squashfs/namei.c index 67cad77fefb4..40c10d9974c9 100644 --- a/fs/squashfs/namei.c +++ b/fs/squashfs/namei.c @@ -247,6 +247,5 @@ failed: const struct inode_operations squashfs_dir_inode_ops = { .lookup = squashfs_lookup, - .getxattr = generic_getxattr, .listxattr = squashfs_listxattr }; diff --git a/fs/squashfs/symlink.c b/fs/squashfs/symlink.c index d688ef42a6a1..79b9c31a0c8f 100644 --- a/fs/squashfs/symlink.c +++ b/fs/squashfs/symlink.c @@ -120,7 +120,6 @@ const struct address_space_operations squashfs_symlink_aops = { const struct inode_operations squashfs_symlink_inode_ops = { .readlink = generic_readlink, .get_link = page_get_link, - .getxattr = generic_getxattr, .listxattr = squashfs_listxattr }; diff --git a/fs/squashfs/xattr.h b/fs/squashfs/xattr.h index c83f5d9ec125..afe70f815e3d 100644 --- a/fs/squashfs/xattr.h +++ b/fs/squashfs/xattr.h @@ -42,6 +42,5 @@ static inline int squashfs_xattr_lookup(struct super_block *sb, return 0; } #define squashfs_listxattr NULL -#define generic_getxattr NULL #define squashfs_xattr_handlers NULL #endif diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 4b86d3a738e1..1d55aeaebf23 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -1182,10 +1182,7 @@ const struct inode_operations ubifs_dir_inode_operations = { .rename = ubifs_rename, .setattr = ubifs_setattr, .getattr = ubifs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ubifs_listxattr, - .removexattr = generic_removexattr, #ifdef CONFIG_UBIFS_ATIME_SUPPORT .update_time = ubifs_update_time, #endif diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 7bbf420d1289..4360c6625e77 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1621,10 +1621,7 @@ const struct address_space_operations ubifs_file_address_operations = { const struct inode_operations ubifs_file_inode_operations = { .setattr = ubifs_setattr, .getattr = ubifs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ubifs_listxattr, - .removexattr = generic_removexattr, #ifdef CONFIG_UBIFS_ATIME_SUPPORT .update_time = ubifs_update_time, #endif @@ -1635,10 +1632,7 @@ const struct inode_operations ubifs_symlink_inode_operations = { .get_link = simple_get_link, .setattr = ubifs_setattr, .getattr = ubifs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = ubifs_listxattr, - .removexattr = generic_removexattr, #ifdef CONFIG_UBIFS_ATIME_SUPPORT .update_time = ubifs_update_time, #endif diff --git a/fs/xattr.c b/fs/xattr.c index 2432442656a2..3368659c471e 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -740,22 +740,6 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) return error; } -/* - * Find the handler for the prefix and dispatch its get() operation. - */ -ssize_t -generic_getxattr(struct dentry *dentry, struct inode *inode, - const char *name, void *buffer, size_t size) -{ - const struct xattr_handler *handler; - - handler = xattr_resolve_name(inode, &name); - if (IS_ERR(handler)) - return PTR_ERR(handler); - return handler->get(handler, dentry, inode, - name, buffer, size); -} - /* * Combine the results of the list() operation from every xattr_handler in the * list. @@ -792,44 +776,7 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) } return size; } - -/* - * Find the handler for the prefix and dispatch its set() operation. - */ -int -generic_setxattr(struct dentry *dentry, struct inode *inode, const char *name, - const void *value, size_t size, int flags) -{ - const struct xattr_handler *handler; - - if (size == 0) - value = ""; /* empty EA, do not remove */ - handler = xattr_resolve_name(inode, &name); - if (IS_ERR(handler)) - return PTR_ERR(handler); - return handler->set(handler, dentry, inode, name, value, size, flags); -} - -/* - * Find the handler for the prefix and dispatch its set() operation to remove - * any associated extended attribute. - */ -int -generic_removexattr(struct dentry *dentry, const char *name) -{ - const struct xattr_handler *handler; - - handler = xattr_resolve_name(d_inode(dentry), &name); - if (IS_ERR(handler)) - return PTR_ERR(handler); - return handler->set(handler, dentry, d_inode(dentry), name, NULL, - 0, XATTR_REPLACE); -} - -EXPORT_SYMBOL(generic_getxattr); EXPORT_SYMBOL(generic_listxattr); -EXPORT_SYMBOL(generic_setxattr); -EXPORT_SYMBOL(generic_removexattr); /** * xattr_full_name - Compute full attribute name from suffix diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index b24c3102fa93..37eeb37319f0 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1036,9 +1036,6 @@ static const struct inode_operations xfs_inode_operations = { .set_acl = xfs_set_acl, .getattr = xfs_vn_getattr, .setattr = xfs_vn_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = xfs_vn_listxattr, .fiemap = xfs_vn_fiemap, .update_time = xfs_vn_update_time, @@ -1064,9 +1061,6 @@ static const struct inode_operations xfs_dir_inode_operations = { .set_acl = xfs_set_acl, .getattr = xfs_vn_getattr, .setattr = xfs_vn_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = xfs_vn_listxattr, .update_time = xfs_vn_update_time, .tmpfile = xfs_vn_tmpfile, @@ -1092,9 +1086,6 @@ static const struct inode_operations xfs_dir_ci_inode_operations = { .set_acl = xfs_set_acl, .getattr = xfs_vn_getattr, .setattr = xfs_vn_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = xfs_vn_listxattr, .update_time = xfs_vn_update_time, .tmpfile = xfs_vn_tmpfile, @@ -1105,9 +1096,6 @@ static const struct inode_operations xfs_symlink_inode_operations = { .get_link = xfs_vn_get_link, .getattr = xfs_vn_getattr, .setattr = xfs_vn_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = xfs_vn_listxattr, .update_time = xfs_vn_update_time, }; @@ -1117,9 +1105,6 @@ static const struct inode_operations xfs_inline_symlink_inode_operations = { .get_link = xfs_vn_get_link_inline, .getattr = xfs_vn_getattr, .setattr = xfs_vn_setattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = xfs_vn_listxattr, .update_time = xfs_vn_update_time, }; diff --git a/include/linux/fs.h b/include/linux/fs.h index 91a7245e58c7..788261b74d45 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1739,12 +1739,7 @@ struct inode_operations { struct inode *, struct dentry *, unsigned int); int (*setattr) (struct dentry *, struct iattr *); int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); - int (*setxattr) (struct dentry *, struct inode *, - const char *, const void *, size_t, int); - ssize_t (*getxattr) (struct dentry *, struct inode *, - const char *, void *, size_t); ssize_t (*listxattr) (struct dentry *, char *, size_t); - int (*removexattr) (struct dentry *, const char *); int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); int (*update_time)(struct inode *, struct timespec *, int); diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 6ae6b2e68efb..e77605a0c8da 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -55,11 +55,7 @@ int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int); int __vfs_removexattr(struct dentry *, const char *); int vfs_removexattr(struct dentry *, const char *); -ssize_t generic_getxattr(struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size); ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); -int generic_setxattr(struct dentry *dentry, struct inode *inode, - const char *name, const void *value, size_t size, int flags); -int generic_removexattr(struct dentry *dentry, const char *name); ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name, char **xattr_value, size_t size, gfp_t flags); diff --git a/mm/shmem.c b/mm/shmem.c index 971fc83e6402..6505c8b99f31 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3288,10 +3288,7 @@ static const struct inode_operations shmem_short_symlink_operations = { .readlink = generic_readlink, .get_link = simple_get_link, #ifdef CONFIG_TMPFS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = shmem_listxattr, - .removexattr = generic_removexattr, #endif }; @@ -3299,10 +3296,7 @@ static const struct inode_operations shmem_symlink_inode_operations = { .readlink = generic_readlink, .get_link = shmem_get_link, #ifdef CONFIG_TMPFS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = shmem_listxattr, - .removexattr = generic_removexattr, #endif }; @@ -3796,10 +3790,7 @@ static const struct inode_operations shmem_inode_operations = { .getattr = shmem_getattr, .setattr = shmem_setattr, #ifdef CONFIG_TMPFS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = shmem_listxattr, - .removexattr = generic_removexattr, .set_acl = simple_set_acl, #endif }; @@ -3818,10 +3809,7 @@ static const struct inode_operations shmem_dir_inode_operations = { .tmpfile = shmem_tmpfile, #endif #ifdef CONFIG_TMPFS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = shmem_listxattr, - .removexattr = generic_removexattr, #endif #ifdef CONFIG_TMPFS_POSIX_ACL .setattr = shmem_setattr, @@ -3831,10 +3819,7 @@ static const struct inode_operations shmem_dir_inode_operations = { static const struct inode_operations shmem_special_inode_operations = { #ifdef CONFIG_TMPFS_XATTR - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = shmem_listxattr, - .removexattr = generic_removexattr, #endif #ifdef CONFIG_TMPFS_POSIX_ACL .setattr = shmem_setattr, diff --git a/net/socket.c b/net/socket.c index 976f7324887b..5a9bf5ee2464 100644 --- a/net/socket.c +++ b/net/socket.c @@ -519,7 +519,6 @@ static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer, } static const struct inode_operations sockfs_inode_ops = { - .getxattr = generic_getxattr, .listxattr = sockfs_listxattr, }; -- cgit v1.2.3