diff options
author | Dave Chinner <david@fromorbit.com> | 2010-01-19 18:47:48 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-01-19 18:47:48 -0500 |
commit | a9273ca5c6814f393e18ed66645f817b2b71e9ad (patch) | |
tree | 3714b7de8b233a31ea6995754f80349327738a88 /fs/xfs/linux-2.6 | |
parent | b9c48649577dfc4a8c263c106d518effa24ea54b (diff) |
xfs: convert attr to use unsigned names
To be consistent with the directory code, the attr code should use
unsigned names. Convert the names from the vfs at the highest level
to unsigned, and ænsure they are consistenly used as unsigned down
to disk.
Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_acl.c | 11 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 18 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.h | 12 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_xattr.c | 27 |
6 files changed, 44 insertions, 32 deletions
diff --git a/fs/xfs/linux-2.6/xfs_acl.c b/fs/xfs/linux-2.6/xfs_acl.c index 883ca5ab8af5..bf85bbe4a9ae 100644 --- a/fs/xfs/linux-2.6/xfs_acl.c +++ b/fs/xfs/linux-2.6/xfs_acl.c | |||
@@ -106,7 +106,7 @@ xfs_get_acl(struct inode *inode, int type) | |||
106 | struct posix_acl *acl; | 106 | struct posix_acl *acl; |
107 | struct xfs_acl *xfs_acl; | 107 | struct xfs_acl *xfs_acl; |
108 | int len = sizeof(struct xfs_acl); | 108 | int len = sizeof(struct xfs_acl); |
109 | char *ea_name; | 109 | unsigned char *ea_name; |
110 | int error; | 110 | int error; |
111 | 111 | ||
112 | acl = get_cached_acl(inode, type); | 112 | acl = get_cached_acl(inode, type); |
@@ -133,7 +133,8 @@ xfs_get_acl(struct inode *inode, int type) | |||
133 | if (!xfs_acl) | 133 | if (!xfs_acl) |
134 | return ERR_PTR(-ENOMEM); | 134 | return ERR_PTR(-ENOMEM); |
135 | 135 | ||
136 | error = -xfs_attr_get(ip, ea_name, (char *)xfs_acl, &len, ATTR_ROOT); | 136 | error = -xfs_attr_get(ip, ea_name, (unsigned char *)xfs_acl, |
137 | &len, ATTR_ROOT); | ||
137 | if (error) { | 138 | if (error) { |
138 | /* | 139 | /* |
139 | * If the attribute doesn't exist make sure we have a negative | 140 | * If the attribute doesn't exist make sure we have a negative |
@@ -162,7 +163,7 @@ STATIC int | |||
162 | xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) | 163 | xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) |
163 | { | 164 | { |
164 | struct xfs_inode *ip = XFS_I(inode); | 165 | struct xfs_inode *ip = XFS_I(inode); |
165 | char *ea_name; | 166 | unsigned char *ea_name; |
166 | int error; | 167 | int error; |
167 | 168 | ||
168 | if (S_ISLNK(inode->i_mode)) | 169 | if (S_ISLNK(inode->i_mode)) |
@@ -194,7 +195,7 @@ xfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
194 | (sizeof(struct xfs_acl_entry) * | 195 | (sizeof(struct xfs_acl_entry) * |
195 | (XFS_ACL_MAX_ENTRIES - acl->a_count)); | 196 | (XFS_ACL_MAX_ENTRIES - acl->a_count)); |
196 | 197 | ||
197 | error = -xfs_attr_set(ip, ea_name, (char *)xfs_acl, | 198 | error = -xfs_attr_set(ip, ea_name, (unsigned char *)xfs_acl, |
198 | len, ATTR_ROOT); | 199 | len, ATTR_ROOT); |
199 | 200 | ||
200 | kfree(xfs_acl); | 201 | kfree(xfs_acl); |
@@ -262,7 +263,7 @@ xfs_set_mode(struct inode *inode, mode_t mode) | |||
262 | } | 263 | } |
263 | 264 | ||
264 | static int | 265 | static int |
265 | xfs_acl_exists(struct inode *inode, char *name) | 266 | xfs_acl_exists(struct inode *inode, unsigned char *name) |
266 | { | 267 | { |
267 | int len = sizeof(struct xfs_acl); | 268 | int len = sizeof(struct xfs_acl); |
268 | 269 | ||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index a034cf624437..3906e85abfdc 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -447,12 +447,12 @@ xfs_attrlist_by_handle( | |||
447 | int | 447 | int |
448 | xfs_attrmulti_attr_get( | 448 | xfs_attrmulti_attr_get( |
449 | struct inode *inode, | 449 | struct inode *inode, |
450 | char *name, | 450 | unsigned char *name, |
451 | char __user *ubuf, | 451 | unsigned char __user *ubuf, |
452 | __uint32_t *len, | 452 | __uint32_t *len, |
453 | __uint32_t flags) | 453 | __uint32_t flags) |
454 | { | 454 | { |
455 | char *kbuf; | 455 | unsigned char *kbuf; |
456 | int error = EFAULT; | 456 | int error = EFAULT; |
457 | 457 | ||
458 | if (*len > XATTR_SIZE_MAX) | 458 | if (*len > XATTR_SIZE_MAX) |
@@ -476,12 +476,12 @@ xfs_attrmulti_attr_get( | |||
476 | int | 476 | int |
477 | xfs_attrmulti_attr_set( | 477 | xfs_attrmulti_attr_set( |
478 | struct inode *inode, | 478 | struct inode *inode, |
479 | char *name, | 479 | unsigned char *name, |
480 | const char __user *ubuf, | 480 | const unsigned char __user *ubuf, |
481 | __uint32_t len, | 481 | __uint32_t len, |
482 | __uint32_t flags) | 482 | __uint32_t flags) |
483 | { | 483 | { |
484 | char *kbuf; | 484 | unsigned char *kbuf; |
485 | int error = EFAULT; | 485 | int error = EFAULT; |
486 | 486 | ||
487 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | 487 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
@@ -501,7 +501,7 @@ xfs_attrmulti_attr_set( | |||
501 | int | 501 | int |
502 | xfs_attrmulti_attr_remove( | 502 | xfs_attrmulti_attr_remove( |
503 | struct inode *inode, | 503 | struct inode *inode, |
504 | char *name, | 504 | unsigned char *name, |
505 | __uint32_t flags) | 505 | __uint32_t flags) |
506 | { | 506 | { |
507 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | 507 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
@@ -519,7 +519,7 @@ xfs_attrmulti_by_handle( | |||
519 | xfs_fsop_attrmulti_handlereq_t am_hreq; | 519 | xfs_fsop_attrmulti_handlereq_t am_hreq; |
520 | struct dentry *dentry; | 520 | struct dentry *dentry; |
521 | unsigned int i, size; | 521 | unsigned int i, size; |
522 | char *attr_name; | 522 | unsigned char *attr_name; |
523 | 523 | ||
524 | if (!capable(CAP_SYS_ADMIN)) | 524 | if (!capable(CAP_SYS_ADMIN)) |
525 | return -XFS_ERROR(EPERM); | 525 | return -XFS_ERROR(EPERM); |
@@ -547,7 +547,7 @@ xfs_attrmulti_by_handle( | |||
547 | 547 | ||
548 | error = 0; | 548 | error = 0; |
549 | for (i = 0; i < am_hreq.opcount; i++) { | 549 | for (i = 0; i < am_hreq.opcount; i++) { |
550 | ops[i].am_error = strncpy_from_user(attr_name, | 550 | ops[i].am_error = strncpy_from_user((char *)attr_name, |
551 | ops[i].am_attrname, MAXNAMELEN); | 551 | ops[i].am_attrname, MAXNAMELEN); |
552 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) | 552 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) |
553 | error = -ERANGE; | 553 | error = -ERANGE; |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.h b/fs/xfs/linux-2.6/xfs_ioctl.h index 7bd7c6afc1eb..d56173b34a2a 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.h +++ b/fs/xfs/linux-2.6/xfs_ioctl.h | |||
@@ -45,23 +45,23 @@ xfs_readlink_by_handle( | |||
45 | extern int | 45 | extern int |
46 | xfs_attrmulti_attr_get( | 46 | xfs_attrmulti_attr_get( |
47 | struct inode *inode, | 47 | struct inode *inode, |
48 | char *name, | 48 | unsigned char *name, |
49 | char __user *ubuf, | 49 | unsigned char __user *ubuf, |
50 | __uint32_t *len, | 50 | __uint32_t *len, |
51 | __uint32_t flags); | 51 | __uint32_t flags); |
52 | 52 | ||
53 | extern int | 53 | extern int |
54 | xfs_attrmulti_attr_set( | 54 | xfs_attrmulti_attr_set( |
55 | struct inode *inode, | 55 | struct inode *inode, |
56 | char *name, | 56 | unsigned char *name, |
57 | const char __user *ubuf, | 57 | const unsigned char __user *ubuf, |
58 | __uint32_t len, | 58 | __uint32_t len, |
59 | __uint32_t flags); | 59 | __uint32_t flags); |
60 | 60 | ||
61 | extern int | 61 | extern int |
62 | xfs_attrmulti_attr_remove( | 62 | xfs_attrmulti_attr_remove( |
63 | struct inode *inode, | 63 | struct inode *inode, |
64 | char *name, | 64 | unsigned char *name, |
65 | __uint32_t flags); | 65 | __uint32_t flags); |
66 | 66 | ||
67 | extern struct dentry * | 67 | extern struct dentry * |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index be1527b1670c..0bf6d61f0528 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -411,7 +411,7 @@ xfs_compat_attrmulti_by_handle( | |||
411 | compat_xfs_fsop_attrmulti_handlereq_t am_hreq; | 411 | compat_xfs_fsop_attrmulti_handlereq_t am_hreq; |
412 | struct dentry *dentry; | 412 | struct dentry *dentry; |
413 | unsigned int i, size; | 413 | unsigned int i, size; |
414 | char *attr_name; | 414 | unsigned char *attr_name; |
415 | 415 | ||
416 | if (!capable(CAP_SYS_ADMIN)) | 416 | if (!capable(CAP_SYS_ADMIN)) |
417 | return -XFS_ERROR(EPERM); | 417 | return -XFS_ERROR(EPERM); |
@@ -440,7 +440,7 @@ xfs_compat_attrmulti_by_handle( | |||
440 | 440 | ||
441 | error = 0; | 441 | error = 0; |
442 | for (i = 0; i < am_hreq.opcount; i++) { | 442 | for (i = 0; i < am_hreq.opcount; i++) { |
443 | ops[i].am_error = strncpy_from_user(attr_name, | 443 | ops[i].am_error = strncpy_from_user((char *)attr_name, |
444 | compat_ptr(ops[i].am_attrname), | 444 | compat_ptr(ops[i].am_attrname), |
445 | MAXNAMELEN); | 445 | MAXNAMELEN); |
446 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) | 446 | if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 225946012d0b..e8566bbf0f00 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -140,10 +140,10 @@ xfs_init_security( | |||
140 | struct xfs_inode *ip = XFS_I(inode); | 140 | struct xfs_inode *ip = XFS_I(inode); |
141 | size_t length; | 141 | size_t length; |
142 | void *value; | 142 | void *value; |
143 | char *name; | 143 | unsigned char *name; |
144 | int error; | 144 | int error; |
145 | 145 | ||
146 | error = security_inode_init_security(inode, dir, &name, | 146 | error = security_inode_init_security(inode, dir, (char **)&name, |
147 | &value, &length); | 147 | &value, &length); |
148 | if (error) { | 148 | if (error) { |
149 | if (error == -EOPNOTSUPP) | 149 | if (error == -EOPNOTSUPP) |
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/linux-2.6/xfs_xattr.c index 0b1878857fc3..fa01b9daba6b 100644 --- a/fs/xfs/linux-2.6/xfs_xattr.c +++ b/fs/xfs/linux-2.6/xfs_xattr.c | |||
@@ -45,7 +45,7 @@ xfs_xattr_get(struct dentry *dentry, const char *name, | |||
45 | value = NULL; | 45 | value = NULL; |
46 | } | 46 | } |
47 | 47 | ||
48 | error = -xfs_attr_get(ip, name, value, &asize, xflags); | 48 | error = -xfs_attr_get(ip, (unsigned char *)name, value, &asize, xflags); |
49 | if (error) | 49 | if (error) |
50 | return error; | 50 | return error; |
51 | return asize; | 51 | return asize; |
@@ -67,8 +67,9 @@ xfs_xattr_set(struct dentry *dentry, const char *name, const void *value, | |||
67 | xflags |= ATTR_REPLACE; | 67 | xflags |= ATTR_REPLACE; |
68 | 68 | ||
69 | if (!value) | 69 | if (!value) |
70 | return -xfs_attr_remove(ip, name, xflags); | 70 | return -xfs_attr_remove(ip, (unsigned char *)name, xflags); |
71 | return -xfs_attr_set(ip, name, (void *)value, size, xflags); | 71 | return -xfs_attr_set(ip, (unsigned char *)name, |
72 | (void *)value, size, xflags); | ||
72 | } | 73 | } |
73 | 74 | ||
74 | static struct xattr_handler xfs_xattr_user_handler = { | 75 | static struct xattr_handler xfs_xattr_user_handler = { |
@@ -124,8 +125,13 @@ static const char *xfs_xattr_prefix(int flags) | |||
124 | } | 125 | } |
125 | 126 | ||
126 | static int | 127 | static int |
127 | xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags, | 128 | xfs_xattr_put_listent( |
128 | char *name, int namelen, int valuelen, char *value) | 129 | struct xfs_attr_list_context *context, |
130 | int flags, | ||
131 | unsigned char *name, | ||
132 | int namelen, | ||
133 | int valuelen, | ||
134 | unsigned char *value) | ||
129 | { | 135 | { |
130 | unsigned int prefix_len = xfs_xattr_prefix_len(flags); | 136 | unsigned int prefix_len = xfs_xattr_prefix_len(flags); |
131 | char *offset; | 137 | char *offset; |
@@ -148,7 +154,7 @@ xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags, | |||
148 | offset = (char *)context->alist + context->count; | 154 | offset = (char *)context->alist + context->count; |
149 | strncpy(offset, xfs_xattr_prefix(flags), prefix_len); | 155 | strncpy(offset, xfs_xattr_prefix(flags), prefix_len); |
150 | offset += prefix_len; | 156 | offset += prefix_len; |
151 | strncpy(offset, name, namelen); /* real name */ | 157 | strncpy(offset, (char *)name, namelen); /* real name */ |
152 | offset += namelen; | 158 | offset += namelen; |
153 | *offset = '\0'; | 159 | *offset = '\0'; |
154 | context->count += prefix_len + namelen + 1; | 160 | context->count += prefix_len + namelen + 1; |
@@ -156,8 +162,13 @@ xfs_xattr_put_listent(struct xfs_attr_list_context *context, int flags, | |||
156 | } | 162 | } |
157 | 163 | ||
158 | static int | 164 | static int |
159 | xfs_xattr_put_listent_sizes(struct xfs_attr_list_context *context, int flags, | 165 | xfs_xattr_put_listent_sizes( |
160 | char *name, int namelen, int valuelen, char *value) | 166 | struct xfs_attr_list_context *context, |
167 | int flags, | ||
168 | unsigned char *name, | ||
169 | int namelen, | ||
170 | int valuelen, | ||
171 | unsigned char *value) | ||
161 | { | 172 | { |
162 | context->count += xfs_xattr_prefix_len(flags) + namelen + 1; | 173 | context->count += xfs_xattr_prefix_len(flags) + namelen + 1; |
163 | return 0; | 174 | return 0; |