+ error = xfs_attr_get(ip, &name, (unsigned char **)&xfs_acl, &len,
+ ATTR_ALLOC | ATTR_ROOT);
if (error) {
/*
* If the attribute doesn't exist make sure we have a negative
@@ -167,17 +167,17 @@ int
__xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{
struct xfs_inode *ip = XFS_I(inode);
- unsigned char *ea_name;
+ struct xfs_name name;
int error;
switch (type) {
case ACL_TYPE_ACCESS:
- ea_name = SGI_ACL_FILE;
+ name.name = SGI_ACL_FILE;
break;
case ACL_TYPE_DEFAULT:
if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0;
- ea_name = SGI_ACL_DEFAULT;
+ name.name = SGI_ACL_DEFAULT;
break;
default:
return -EINVAL;
@@ -197,17 +197,16 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
len -= sizeof(struct xfs_acl_entry) *
(XFS_ACL_MAX_ENTRIES(ip->i_mount) - acl->a_count);
- error = xfs_attr_set(ip, ea_name, strlen(ea_name),
- (unsigned char *)xfs_acl, len, ATTR_ROOT);
+ xfs_name_init(&name, name.name);
+ error = xfs_attr_set(ip, &name, (unsigned char *)xfs_acl, len,
+ ATTR_ROOT);
kmem_free(xfs_acl);
} else {
/*
* A NULL ACL argument means we want to remove the ACL.
*/
- error = xfs_attr_remove(ip, ea_name,
- strlen(ea_name),
- ATTR_ROOT);
+ error = xfs_attr_remove(ip, &name, ATTR_ROOT);
/*
* If the attribute didn't exist to start with that's fine.
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index f5a9bf9..4fc8698 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -357,7 +357,9 @@ xfs_attrmulti_attr_get(
{
unsigned char *kbuf;
int error = -EFAULT;
- size_t namelen;
+ struct xfs_name xname;
+
+ xfs_name_init(&xname, name);
if (*len > XFS_XATTR_SIZE_MAX)
return -EINVAL;
@@ -365,9 +367,7 @@ xfs_attrmulti_attr_get(
if (!kbuf)
return -ENOMEM;
- namelen = strlen(name);
- error = xfs_attr_get(XFS_I(inode), name, namelen, &kbuf, (int *)len,
- flags);
+ error = xfs_attr_get(XFS_I(inode), &xname, &kbuf, (int *)len, flags);
if (error)
goto out_kfree;
@@ -389,7 +389,9 @@ xfs_attrmulti_attr_set(
{
unsigned char *kbuf;
int error;
- size_t namelen;
+ struct xfs_name xname;
+
+ xfs_name_init(&xname, name);
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
@@ -400,8 +402,7 @@ xfs_attrmulti_attr_set(
if (IS_ERR(kbuf))
return PTR_ERR(kbuf);
- namelen = strlen(name);
- error = xfs_attr_set(XFS_I(inode), name, namelen, kbuf, len, flags);
+ error = xfs_attr_set(XFS_I(inode), &xname, kbuf, len, flags);
if (!error)
xfs_forget_acl(inode, name, flags);
kfree(kbuf);
@@ -415,12 +416,14 @@ xfs_attrmulti_attr_remove(
uint32_t flags)
{
int error;
- size_t namelen;
+ struct xfs_name xname;
+
+ xfs_name_init(&xname, name);
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
- namelen = strlen(name);
- error = xfs_attr_remove(XFS_I(inode), name, namelen, flags);
+
+ error = xfs_attr_remove(XFS_I(inode), &xname, flags);
if (!error)
xfs_forget_acl(inode, name, flags);
return error;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 81f2f93..e85bbf5 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -48,11 +48,11 @@ xfs_initxattrs(
const struct xattr *xattr;
struct xfs_inode *ip = XFS_I(inode);
int error = 0;
+ struct xfs_name name;
for (xattr = xattr_array; xattr->name != NULL; xattr++) {
- error = xfs_attr_set(ip, xattr->name,
- strlen(xattr->name),
- xattr->value, xattr->value_len,
+ xfs_name_init(&name, xattr->name);
+ error = xfs_attr_set(ip, &name, xattr->value, xattr->value_len,
ATTR_SECURE);
if (error < 0)
break;
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 1f1601f..5623682 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -21,10 +21,12 @@ static int
xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
struct inode *inode, const char *name, void *value, size_t size)
{
- int xflags = handler->flags;
- struct xfs_inode *ip = XFS_I(inode);
- int error, asize = size;
- size_t namelen = strlen(name);
+ int xflags = handler->flags;
+ struct xfs_inode *ip = XFS_I(inode);
+ int error, asize = size;
+ struct xfs_name xname;
+
+ xfs_name_init(&xname, name);
/* Convert Linux syscall to XFS internal ATTR flags */
if (!size) {
@@ -32,8 +34,8 @@ xfs_xattr_get(const struct xattr_handler *handler, struct dentry *unused,
value = NULL;
}
- error = xfs_attr_get(ip, name, namelen, (unsigned char **)&value,
- &asize, xflags);
+ error = xfs_attr_get(ip, &xname, (unsigned char **)&value, &asize,
+ xflags);
if (error)
return error;
return asize;
@@ -69,7 +71,9 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
int xflags = handler->flags;
struct xfs_inode *ip = XFS_I(inode);
int error;
- size_t namelen = strlen(name);
+ struct xfs_name xname;
+
+ xfs_name_init(&xname, name);
/* Convert Linux syscall to XFS internal ATTR flags */
if (flags & XATTR_CREATE)
@@ -78,9 +82,8 @@ xfs_xattr_set(const struct xattr_handler *handler, struct dentry *unused,
xflags |= ATTR_REPLACE;
if (!value)
- return xfs_attr_remove(ip, name,
- namelen, xflags);
- error = xfs_attr_set(ip, name, namelen, (void *)value, size, xflags);
+ return xfs_attr_remove(ip, &xname, xflags);
+ error = xfs_attr_set(ip, &xname, (void *)value, size, xflags);
if (!error)
xfs_forget_acl(inode, name, xflags);
--
2.7.4