Skip to content

Commit d5dc748

Browse files
author
Miklos Szeredi
committed
ovl: use ovl_do_getxattr() for private xattr
Use the convention of calling ovl_do_foo() for operations which are overlay specific. This patch is a no-op, and will have significance for supporting "user.overlay." xattr namespace. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 92f0d6c commit d5dc748

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

fs/overlayfs/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,8 @@ unsigned int ovl_get_nlink(struct dentry *lowerdentry,
748748
if (!lowerdentry || !upperdentry || d_inode(lowerdentry)->i_nlink == 1)
749749
return fallback;
750750

751-
err = vfs_getxattr(upperdentry, OVL_XATTR_NLINK, &buf, sizeof(buf) - 1);
751+
err = ovl_do_getxattr(upperdentry, OVL_XATTR_NLINK,
752+
&buf, sizeof(buf) - 1);
752753
if (err < 0)
753754
goto fail;
754755

fs/overlayfs/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static struct ovl_fh *ovl_get_fh(struct dentry *dentry, const char *name)
109109
int res, err;
110110
struct ovl_fh *fh = NULL;
111111

112-
res = vfs_getxattr(dentry, name, NULL, 0);
112+
res = ovl_do_getxattr(dentry, name, NULL, 0);
113113
if (res < 0) {
114114
if (res == -ENODATA || res == -EOPNOTSUPP)
115115
return NULL;
@@ -123,7 +123,7 @@ static struct ovl_fh *ovl_get_fh(struct dentry *dentry, const char *name)
123123
if (!fh)
124124
return ERR_PTR(-ENOMEM);
125125

126-
res = vfs_getxattr(dentry, name, fh->buf, res);
126+
res = ovl_do_getxattr(dentry, name, fh->buf, res);
127127
if (res < 0)
128128
goto fail;
129129

fs/overlayfs/overlayfs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ static inline int ovl_do_symlink(struct inode *dir, struct dentry *dentry,
170170
return err;
171171
}
172172

173+
static inline ssize_t ovl_do_getxattr(struct dentry *dentry, const char *name,
174+
void *value, size_t size)
175+
{
176+
return vfs_getxattr(dentry, name, value, size);
177+
}
178+
173179
static inline int ovl_do_setxattr(struct dentry *dentry, const char *name,
174180
const void *value, size_t size, int flags)
175181
{

fs/overlayfs/util.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ bool ovl_check_origin_xattr(struct dentry *dentry)
548548
{
549549
int res;
550550

551-
res = vfs_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0);
551+
res = ovl_do_getxattr(dentry, OVL_XATTR_ORIGIN, NULL, 0);
552552

553553
/* Zero size value means "copied up but origin unknown" */
554554
if (res >= 0)
@@ -565,7 +565,7 @@ bool ovl_check_dir_xattr(struct dentry *dentry, const char *name)
565565
if (!d_is_dir(dentry))
566566
return false;
567567

568-
res = vfs_getxattr(dentry, name, &val, 1);
568+
res = ovl_do_getxattr(dentry, name, &val, 1);
569569
if (res == 1 && val == 'y')
570570
return true;
571571

@@ -853,7 +853,7 @@ int ovl_check_metacopy_xattr(struct dentry *dentry)
853853
if (!S_ISREG(d_inode(dentry)->i_mode))
854854
return 0;
855855

856-
res = vfs_getxattr(dentry, OVL_XATTR_METACOPY, NULL, 0);
856+
res = ovl_do_getxattr(dentry, OVL_XATTR_METACOPY, NULL, 0);
857857
if (res < 0) {
858858
if (res == -ENODATA || res == -EOPNOTSUPP)
859859
return 0;
@@ -887,7 +887,7 @@ char *ovl_get_redirect_xattr(struct dentry *dentry, int padding)
887887
int res;
888888
char *s, *next, *buf = NULL;
889889

890-
res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, NULL, 0);
890+
res = ovl_do_getxattr(dentry, OVL_XATTR_REDIRECT, NULL, 0);
891891
if (res == -ENODATA || res == -EOPNOTSUPP)
892892
return NULL;
893893
if (res < 0)
@@ -899,7 +899,7 @@ char *ovl_get_redirect_xattr(struct dentry *dentry, int padding)
899899
if (!buf)
900900
return ERR_PTR(-ENOMEM);
901901

902-
res = vfs_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res);
902+
res = ovl_do_getxattr(dentry, OVL_XATTR_REDIRECT, buf, res);
903903
if (res < 0)
904904
goto fail;
905905
if (res == 0)

0 commit comments

Comments
 (0)