Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1239163
| From | Andreas Gruenbacher <agruenba@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 7/7] f2fs: xattr simplifications |
| Date | 2015-10-04 19:30 +0200 |
| Message-ID | <qfVgK-6VO-17@gated-at.bofh.it> (permalink) |
| References | <qfVgK-6VO-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Now that the xattr handler is passed to the xattr handler operations, we
have access to the attribute name prefix, so simplify
f2fs_xattr_generic_list.
Also, f2fs_xattr_advise_list is only ever called for
f2fs_xattr_advise_handler; there is no need to double check for that.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Changman Lee <cm224.lee@samsung.com>
Cc: Chao Yu <chao2.yu@samsung.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
---
fs/f2fs/xattr.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index e643173..862368a 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -30,33 +30,27 @@ static size_t f2fs_xattr_generic_list(const struct xattr_handler *handler,
const char *name, size_t len)
{
struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
- int total_len, prefix_len = 0;
- const char *prefix = NULL;
+ int total_len, prefix_len;
switch (handler->flags) {
case F2FS_XATTR_INDEX_USER:
if (!test_opt(sbi, XATTR_USER))
return -EOPNOTSUPP;
- prefix = XATTR_USER_PREFIX;
- prefix_len = XATTR_USER_PREFIX_LEN;
break;
case F2FS_XATTR_INDEX_TRUSTED:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- prefix = XATTR_TRUSTED_PREFIX;
- prefix_len = XATTR_TRUSTED_PREFIX_LEN;
break;
case F2FS_XATTR_INDEX_SECURITY:
- prefix = XATTR_SECURITY_PREFIX;
- prefix_len = XATTR_SECURITY_PREFIX_LEN;
break;
default:
return -EINVAL;
}
+ prefix_len = strlen(handler->prefix);
total_len = prefix_len + len + 1;
if (list && total_len <= list_size) {
- memcpy(list, prefix, prefix_len);
+ memcpy(list, handler->prefix, prefix_len);
memcpy(list + prefix_len, name, len);
list[prefix_len + len] = '\0';
}
@@ -123,9 +117,6 @@ static size_t f2fs_xattr_advise_list(const struct xattr_handler *handler,
const char *xname = F2FS_SYSTEM_ADVISE_PREFIX;
size_t size;
- if (handler->flags != F2FS_XATTR_INDEX_ADVISE)
- return 0;
-
size = strlen(xname) + 1;
if (list && size <= list_size)
memcpy(list, xname, size);
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/7] Pass xattr handler to xattr handler operations Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-04 19:30 +0200 [PATCH v3 3/7] jffs2: Add missing capability check for listing trusted xattrs Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-04 19:30 +0200 [PATCH v3 7/7] f2fs: xattr simplifications Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-04 19:30 +0200 [PATCH v3 5/7] 9p: xattr simplifications Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-04 19:30 +0200 [PATCH v3 1/7] ubifs: Remove unused security xattr handler Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-04 19:30 +0200 [PATCH v3 2/7] hfsplus: Remove unused xattr handler list operations Andreas Gruenbacher <agruenba@redhat.com> - 2015-10-04 19:30 +0200
csiph-web