Skip to content

Commit ade46c3

Browse files
ubifs: Export xattr get and set functions
For fscrypto we need this function outside of xattr.c. Signed-off-by: Richard Weinberger <[email protected]>
1 parent f6337d8 commit ade46c3

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

fs/ubifs/ubifs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,10 @@ extern const struct xattr_handler *ubifs_xattr_handlers[];
17351735
ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
17361736
int ubifs_init_security(struct inode *dentry, struct inode *inode,
17371737
const struct qstr *qstr);
1738+
int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
1739+
size_t size, int flags);
1740+
ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
1741+
size_t size);
17381742

17391743
/* super.c */
17401744
struct inode *ubifs_iget(struct super_block *sb, unsigned long inum);

fs/ubifs/xattr.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum)
269269
return ERR_PTR(-EINVAL);
270270
}
271271

272-
static int __ubifs_setxattr(struct inode *host, const char *name,
273-
const void *value, size_t size, int flags)
272+
int ubifs_xattr_set(struct inode *host, const char *name, const void *value,
273+
size_t size, int flags)
274274
{
275275
struct inode *inode;
276276
struct ubifs_info *c = host->i_sb->s_fs_info;
@@ -329,8 +329,8 @@ static int __ubifs_setxattr(struct inode *host, const char *name,
329329
return err;
330330
}
331331

332-
static ssize_t __ubifs_getxattr(struct inode *host, const char *name,
333-
void *buf, size_t size)
332+
ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf,
333+
size_t size)
334334
{
335335
struct inode *inode;
336336
struct ubifs_info *c = host->i_sb->s_fs_info;
@@ -486,7 +486,7 @@ static int remove_xattr(struct ubifs_info *c, struct inode *host,
486486
return err;
487487
}
488488

489-
static int __ubifs_removexattr(struct inode *host, const char *name)
489+
static int ubifs_xattr_remove(struct inode *host, const char *name)
490490
{
491491
struct inode *inode;
492492
struct ubifs_info *c = host->i_sb->s_fs_info;
@@ -548,7 +548,8 @@ static int init_xattrs(struct inode *inode, const struct xattr *xattr_array,
548548
}
549549
strcpy(name, XATTR_SECURITY_PREFIX);
550550
strcpy(name + XATTR_SECURITY_PREFIX_LEN, xattr->name);
551-
err = __ubifs_setxattr(inode, name, xattr->value, xattr->value_len, 0);
551+
err = ubifs_xattr_set(inode, name, xattr->value,
552+
xattr->value_len, 0);
552553
kfree(name);
553554
if (err < 0)
554555
break;
@@ -572,18 +573,18 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode,
572573
return err;
573574
}
574575

575-
static int ubifs_xattr_get(const struct xattr_handler *handler,
576+
static int xattr_get(const struct xattr_handler *handler,
576577
struct dentry *dentry, struct inode *inode,
577578
const char *name, void *buffer, size_t size)
578579
{
579580
dbg_gen("xattr '%s', ino %lu ('%pd'), buf size %zd", name,
580581
inode->i_ino, dentry, size);
581582

582583
name = xattr_full_name(handler, name);
583-
return __ubifs_getxattr(inode, name, buffer, size);
584+
return ubifs_xattr_get(inode, name, buffer, size);
584585
}
585586

586-
static int ubifs_xattr_set(const struct xattr_handler *handler,
587+
static int xattr_set(const struct xattr_handler *handler,
587588
struct dentry *dentry, struct inode *inode,
588589
const char *name, const void *value,
589590
size_t size, int flags)
@@ -594,27 +595,27 @@ static int ubifs_xattr_set(const struct xattr_handler *handler,
594595
name = xattr_full_name(handler, name);
595596

596597
if (value)
597-
return __ubifs_setxattr(inode, name, value, size, flags);
598+
return ubifs_xattr_set(inode, name, value, size, flags);
598599
else
599-
return __ubifs_removexattr(inode, name);
600+
return ubifs_xattr_remove(inode, name);
600601
}
601602

602603
static const struct xattr_handler ubifs_user_xattr_handler = {
603604
.prefix = XATTR_USER_PREFIX,
604-
.get = ubifs_xattr_get,
605-
.set = ubifs_xattr_set,
605+
.get = xattr_get,
606+
.set = xattr_set,
606607
};
607608

608609
static const struct xattr_handler ubifs_trusted_xattr_handler = {
609610
.prefix = XATTR_TRUSTED_PREFIX,
610-
.get = ubifs_xattr_get,
611-
.set = ubifs_xattr_set,
611+
.get = xattr_get,
612+
.set = xattr_set,
612613
};
613614

614615
static const struct xattr_handler ubifs_security_xattr_handler = {
615616
.prefix = XATTR_SECURITY_PREFIX,
616-
.get = ubifs_xattr_get,
617-
.set = ubifs_xattr_set,
617+
.get = xattr_get,
618+
.set = xattr_set,
618619
};
619620

620621
const struct xattr_handler *ubifs_xattr_handlers[] = {

0 commit comments

Comments
 (0)