[linux-yocto] [PATCH 2/3] fs: yaffs2: switch to the generic xattr handler
Kevin Hao
kexin.hao at windriver.com
Tue Jan 31 00:24:25 PST 2017
The {get, set, remove}xattr inode operations have been already removed
in commit fd50ecaddf83("vfs: Remove {get,set,remove}xattr inode operations").
Adjust the yaffs2 to use the generic xattr handler.
Signed-off-by: Kevin Hao <kexin.hao at windriver.com>
---
fs/yaffs2/yaffs_vfs.c | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
index e5e0c650baca..efcb118d2ba1 100644
--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -1029,10 +1029,7 @@ static ssize_t yaffs_listxattr(struct dentry * dentry, char *buff, size_t size)
static const struct inode_operations yaffs_file_inode_operations = {
.setattr = yaffs_setattr,
- .setxattr = yaffs_setxattr,
- .getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
- .removexattr = yaffs_removexattr,
};
@@ -1125,10 +1122,7 @@ static const struct inode_operations yaffs_symlink_inode_operations = {
.follow_link = yaffs_follow_link,
#endif
.setattr = yaffs_setattr,
- .setxattr = yaffs_setxattr,
- .getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
- .removexattr = yaffs_removexattr,
};
#ifdef YAFFS_USE_OWN_IGET
@@ -1581,10 +1575,7 @@ static const struct inode_operations yaffs_dir_inode_operations = {
.mknod = yaffs_mknod,
.rename = yaffs_rename,
.setattr = yaffs_setattr,
- .setxattr = yaffs_setxattr,
- .getxattr = yaffs_getxattr,
.listxattr = yaffs_listxattr,
- .removexattr = yaffs_removexattr,
};
/*-----------------------------------------------------------------*/
@@ -2771,7 +2762,34 @@ static struct dentry *yaffs_make_root(struct inode *inode)
}
+static int yaffs_xattr_get(const struct xattr_handler *handler,
+ struct dentry *dentry, struct inode *inode,
+ const char *name, void *buff, size_t size)
+{
+ return yaffs_getxattr(dentry, inode, name, buff, size);
+}
+static int yaffs_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 yaffs_setxattr(dentry, inode, name, value, size, flags);
+ else
+ return yaffs_removexattr(dentry, name);
+}
+
+static const struct xattr_handler yaffs_xattr_handler = {
+ .prefix = "", /* match anything */
+ .get = yaffs_xattr_get,
+ .set = yaffs_xattr_set,
+};
+
+static const struct xattr_handler *yaffs_xattr_handlers[] = {
+ &yaffs_xattr_handler,
+ NULL
+};
static struct super_block *yaffs_internal_read_super(int yaffs_version,
struct super_block *sb,
@@ -2805,6 +2823,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
sb->s_magic = YAFFS_MAGIC;
sb->s_op = &yaffs_super_ops;
+ sb->s_xattr = yaffs_xattr_handlers;
sb->s_flags |= MS_NOATIME;
read_only = ((sb->s_flags & MS_RDONLY) != 0);
--
2.9.3
More information about the linux-yocto
mailing list