From: Gou Hao gouhao@uniontech.com
uniontech inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I40JRR CVE: NA
--------------
Add inode and super block callback interface of extended attribute.
Signed-off-by: Gou Hao gouhao@uniontech.com --- fs/eulerfs/euler.h | 1 + fs/eulerfs/file.c | 1 + fs/eulerfs/inode.c | 1 + fs/eulerfs/namei.c | 2 ++ fs/eulerfs/super.c | 4 +++- fs/eulerfs/symlink.c | 1 + 6 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/fs/eulerfs/euler.h b/fs/eulerfs/euler.h index 0abb7602bb63..10ba7238a56b 100644 --- a/fs/eulerfs/euler.h +++ b/fs/eulerfs/euler.h @@ -56,6 +56,7 @@ #include "euler_common.h" #include "inode.h" #include "nvalloc.h" +#include "xattr.h"
extern int num_sockets;
diff --git a/fs/eulerfs/file.c b/fs/eulerfs/file.c index d5a743c102e3..d3181abeac33 100644 --- a/fs/eulerfs/file.c +++ b/fs/eulerfs/file.c @@ -291,4 +291,5 @@ const struct file_operations eufs_file_operations = { const struct inode_operations eufs_file_inode_operations = { .setattr = eufs_notify_change, .getattr = eufs_file_getattr, + .listxattr = eufs_listxattr, }; diff --git a/fs/eulerfs/inode.c b/fs/eulerfs/inode.c index 414ccf6d80a0..3504e6b84de4 100644 --- a/fs/eulerfs/inode.c +++ b/fs/eulerfs/inode.c @@ -303,6 +303,7 @@ void eufs_evict_inode(struct inode *inode) eufs_iwrite_nlink(fresh_pi, 0); eufs_iwrite_mode(fresh_pi, 0); eufs_flush_cacheline(fresh_pi); + eufs_xattr_delete_inode(inode); WARN_ON(!EUFS_IS_HEAD_PI(pi)); nv_free(sb, pi); } else if (!is_bad_inode(inode)) { diff --git a/fs/eulerfs/namei.c b/fs/eulerfs/namei.c index e4c6c36575f2..be0ef352215c 100644 --- a/fs/eulerfs/namei.c +++ b/fs/eulerfs/namei.c @@ -865,8 +865,10 @@ const struct inode_operations eufs_dir_inode_operations = { .mknod = eufs_mknod, .rename = eufs_rename, .setattr = eufs_notify_change, + .listxattr = eufs_listxattr, };
const struct inode_operations eufs_special_inode_operations = { .setattr = eufs_notify_change, + .listxattr = eufs_listxattr, }; diff --git a/fs/eulerfs/super.c b/fs/eulerfs/super.c index eeec16d10baf..d1886b5d3545 100644 --- a/fs/eulerfs/super.c +++ b/fs/eulerfs/super.c @@ -493,7 +493,9 @@ static int eufs_fill_super(struct super_block *sb, void *data, int silent) sb->s_op = &eufs_sops; sb->s_maxbytes = EUFS_MAX_FILE_SIZE; sb->s_time_gran = NSEC_PER_SEC; - +#ifdef CONFIG_EULER_FS_XATTR + sb->s_xattr = eufs_xattr_handlers; +#endif err = dep_init(sb); if (err) goto out; diff --git a/fs/eulerfs/symlink.c b/fs/eulerfs/symlink.c index 831c5c8758ea..2527b93e50b4 100644 --- a/fs/eulerfs/symlink.c +++ b/fs/eulerfs/symlink.c @@ -26,4 +26,5 @@ static const char *eufs_get_link(struct dentry *dentry, struct inode *inode, const struct inode_operations eufs_symlink_inode_operations = { .get_link = eufs_get_link, .setattr = eufs_notify_change, + .listxattr = eufs_listxattr, };