return generic_permission(inode, mask);
}
-static int kernfs_node_xattr_get(const struct xattr_handler *handler,
- struct kernfs_node *kn, const char *suffix,
- void *value, size_t size)
+int kernfs_xattr_get(struct kernfs_node *kn, const char *name,
+ void *value, size_t size)
{
- const char *name = xattr_full_name(handler, suffix);
- struct kernfs_iattrs *attrs;
-
- attrs = kernfs_iattrs_noalloc(kn);
+ struct kernfs_iattrs *attrs = kernfs_iattrs_noalloc(kn);
if (!attrs)
return -ENODATA;
return simple_xattr_get(&attrs->xattrs, name, value, size);
}
-static int kernfs_node_xattr_set(const struct xattr_handler *handler,
- struct kernfs_node *kn, const char *suffix,
- const void *value, size_t size, int flags)
+int kernfs_xattr_set(struct kernfs_node *kn, const char *name,
+ const void *value, size_t size, int flags)
{
- const char *name = xattr_full_name(handler, suffix);
- struct kernfs_iattrs *attrs;
-
- attrs = kernfs_iattrs(kn);
+ struct kernfs_iattrs *attrs = kernfs_iattrs(kn);
if (!attrs)
return -ENOMEM;
return simple_xattr_set(&attrs->xattrs, name, value, size, flags);
}
-static int kernfs_xattr_get(const struct xattr_handler *handler,
- struct dentry *unused, struct inode *inode,
- const char *suffix, void *value, size_t size)
+static int kernfs_vfs_xattr_get(const struct xattr_handler *handler,
+ struct dentry *unused, struct inode *inode,
+ const char *suffix, void *value, size_t size)
{
+ const char *name = xattr_full_name(handler, suffix);
struct kernfs_node *kn = inode->i_private;
- return kernfs_node_xattr_get(handler, kn, suffix, value, size);
+ return kernfs_xattr_get(kn, name, value, size);
}
-static int kernfs_xattr_set(const struct xattr_handler *handler,
- struct dentry *unused, struct inode *inode,
- const char *suffix, const void *value,
- size_t size, int flags)
+static int kernfs_vfs_xattr_set(const struct xattr_handler *handler,
+ struct dentry *unused, struct inode *inode,
+ const char *suffix, const void *value,
+ size_t size, int flags)
{
+ const char *name = xattr_full_name(handler, suffix);
struct kernfs_node *kn = inode->i_private;
- return kernfs_node_xattr_set(handler, kn, suffix, value, size, flags);
+ return kernfs_xattr_set(kn, name, value, size, flags);
}
static const struct xattr_handler kernfs_trusted_xattr_handler = {
.prefix = XATTR_TRUSTED_PREFIX,
- .get = kernfs_xattr_get,
- .set = kernfs_xattr_set,
+ .get = kernfs_vfs_xattr_get,
+ .set = kernfs_vfs_xattr_set,
};
static const struct xattr_handler kernfs_security_xattr_handler = {
.prefix = XATTR_SECURITY_PREFIX,
- .get = kernfs_xattr_get,
- .set = kernfs_xattr_set,
+ .get = kernfs_vfs_xattr_get,
+ .set = kernfs_vfs_xattr_set,
};
const struct xattr_handler *kernfs_xattr_handlers[] = {
&kernfs_security_xattr_handler,
NULL
};
-
-int kernfs_security_xattr_get(struct kernfs_node *kn, const char *suffix,
- void *value, size_t size)
-{
- return kernfs_node_xattr_get(&kernfs_security_xattr_handler,
- kn, suffix, value, size);
-}
-
-int kernfs_security_xattr_set(struct kernfs_node *kn, const char *suffix,
- void *value, size_t size, int flags)
-{
- return kernfs_node_xattr_set(&kernfs_security_xattr_handler,
- kn, suffix, value, size, flags);
-}
struct poll_table_struct *pt);
void kernfs_notify(struct kernfs_node *kn);
-int kernfs_security_xattr_get(struct kernfs_node *kn, const char *suffix,
- void *value, size_t size);
-int kernfs_security_xattr_set(struct kernfs_node *kn, const char *suffix,
- void *value, size_t size, int flags);
+int kernfs_xattr_get(struct kernfs_node *kn, const char *name,
+ void *value, size_t size);
+int kernfs_xattr_set(struct kernfs_node *kn, const char *name,
+ const void *value, size_t size, int flags);
const void *kernfs_super_ns(struct super_block *sb);
int kernfs_get_tree(struct fs_context *fc);
static inline void kernfs_notify(struct kernfs_node *kn) { }
-static inline int kernfs_security_xattr_get(struct kernfs_node *kn,
- const char *suffix, void *value,
- size_t size)
+static inline int kernfs_xattr_get(struct kernfs_node *kn, const char *name,
+ void *value, size_t size)
{ return -ENOSYS; }
-static inline int kernfs_security_xattr_set(struct kernfs_node *kn,
- const char *suffix, void *value,
- size_t size, int flags)
+static inline int kernfs_xattr_set(struct kernfs_node *kn, const char *name,
+ const void *value, size_t size, int flags)
{ return -ENOSYS; }
static inline const void *kernfs_super_ns(struct super_block *sb)