Skip to content

Commit

Permalink
xattr: add missing consts to function arguments
Browse files Browse the repository at this point in the history
Add missing consts to xattr function arguments.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Howells authored and Linus Torvalds committed Apr 29, 2008
1 parent 7ec02ef commit 8f0cfa5
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 87 deletions.
41 changes: 21 additions & 20 deletions fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ xattr_permission(struct inode *inode, const char *name, int mask)
}

int
vfs_setxattr(struct dentry *dentry, char *name, void *value,
vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
size_t size, int flags)
{
struct inode *inode = dentry->d_inode;
Expand Down Expand Up @@ -131,7 +131,7 @@ xattr_getsecurity(struct inode *inode, const char *name, void *value,
EXPORT_SYMBOL_GPL(xattr_getsecurity);

ssize_t
vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size)
vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
{
struct inode *inode = dentry->d_inode;
int error;
Expand Down Expand Up @@ -187,7 +187,7 @@ vfs_listxattr(struct dentry *d, char *list, size_t size)
EXPORT_SYMBOL_GPL(vfs_listxattr);

int
vfs_removexattr(struct dentry *dentry, char *name)
vfs_removexattr(struct dentry *dentry, const char *name)
{
struct inode *inode = dentry->d_inode;
int error;
Expand Down Expand Up @@ -218,7 +218,7 @@ EXPORT_SYMBOL_GPL(vfs_removexattr);
* Extended attribute SET operations
*/
static long
setxattr(struct dentry *d, char __user *name, void __user *value,
setxattr(struct dentry *d, const char __user *name, const void __user *value,
size_t size, int flags)
{
int error;
Expand Down Expand Up @@ -252,8 +252,8 @@ setxattr(struct dentry *d, char __user *name, void __user *value,
}

asmlinkage long
sys_setxattr(char __user *path, char __user *name, void __user *value,
size_t size, int flags)
sys_setxattr(const char __user *path, const char __user *name,
const void __user *value, size_t size, int flags)
{
struct nameidata nd;
int error;
Expand All @@ -271,8 +271,8 @@ sys_setxattr(char __user *path, char __user *name, void __user *value,
}

asmlinkage long
sys_lsetxattr(char __user *path, char __user *name, void __user *value,
size_t size, int flags)
sys_lsetxattr(const char __user *path, const char __user *name,
const void __user *value, size_t size, int flags)
{
struct nameidata nd;
int error;
Expand All @@ -290,7 +290,7 @@ sys_lsetxattr(char __user *path, char __user *name, void __user *value,
}

asmlinkage long
sys_fsetxattr(int fd, char __user *name, void __user *value,
sys_fsetxattr(int fd, const char __user *name, const void __user *value,
size_t size, int flags)
{
struct file *f;
Expand All @@ -315,7 +315,8 @@ sys_fsetxattr(int fd, char __user *name, void __user *value,
* Extended attribute GET operations
*/
static ssize_t
getxattr(struct dentry *d, char __user *name, void __user *value, size_t size)
getxattr(struct dentry *d, const char __user *name, void __user *value,
size_t size)
{
ssize_t error;
void *kvalue = NULL;
Expand Down Expand Up @@ -349,8 +350,8 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size)
}

asmlinkage ssize_t
sys_getxattr(char __user *path, char __user *name, void __user *value,
size_t size)
sys_getxattr(const char __user *path, const char __user *name,
void __user *value, size_t size)
{
struct nameidata nd;
ssize_t error;
Expand All @@ -364,7 +365,7 @@ sys_getxattr(char __user *path, char __user *name, void __user *value,
}

asmlinkage ssize_t
sys_lgetxattr(char __user *path, char __user *name, void __user *value,
sys_lgetxattr(const char __user *path, const char __user *name, void __user *value,
size_t size)
{
struct nameidata nd;
Expand All @@ -379,7 +380,7 @@ sys_lgetxattr(char __user *path, char __user *name, void __user *value,
}

asmlinkage ssize_t
sys_fgetxattr(int fd, char __user *name, void __user *value, size_t size)
sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size)
{
struct file *f;
ssize_t error = -EBADF;
Expand Down Expand Up @@ -424,7 +425,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
}

asmlinkage ssize_t
sys_listxattr(char __user *path, char __user *list, size_t size)
sys_listxattr(const char __user *path, char __user *list, size_t size)
{
struct nameidata nd;
ssize_t error;
Expand All @@ -438,7 +439,7 @@ sys_listxattr(char __user *path, char __user *list, size_t size)
}

asmlinkage ssize_t
sys_llistxattr(char __user *path, char __user *list, size_t size)
sys_llistxattr(const char __user *path, char __user *list, size_t size)
{
struct nameidata nd;
ssize_t error;
Expand Down Expand Up @@ -470,7 +471,7 @@ sys_flistxattr(int fd, char __user *list, size_t size)
* Extended attribute REMOVE operations
*/
static long
removexattr(struct dentry *d, char __user *name)
removexattr(struct dentry *d, const char __user *name)
{
int error;
char kname[XATTR_NAME_MAX + 1];
Expand All @@ -485,7 +486,7 @@ removexattr(struct dentry *d, char __user *name)
}

asmlinkage long
sys_removexattr(char __user *path, char __user *name)
sys_removexattr(const char __user *path, const char __user *name)
{
struct nameidata nd;
int error;
Expand All @@ -503,7 +504,7 @@ sys_removexattr(char __user *path, char __user *name)
}

asmlinkage long
sys_lremovexattr(char __user *path, char __user *name)
sys_lremovexattr(const char __user *path, const char __user *name)
{
struct nameidata nd;
int error;
Expand All @@ -521,7 +522,7 @@ sys_lremovexattr(char __user *path, char __user *name)
}

asmlinkage long
sys_fremovexattr(int fd, char __user *name)
sys_fremovexattr(int fd, const char __user *name)
{
struct file *f;
struct dentry *dentry;
Expand Down
43 changes: 23 additions & 20 deletions include/linux/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective,
extern int cap_bprm_set_security(struct linux_binprm *bprm);
extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
extern int cap_bprm_secureexec(struct linux_binprm *bprm);
extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);
extern int cap_inode_removexattr(struct dentry *dentry, char *name);
extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
extern int cap_inode_need_killpriv(struct dentry *dentry);
extern int cap_inode_killpriv(struct dentry *dentry);
extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
Expand Down Expand Up @@ -1362,13 +1363,13 @@ struct security_operations {
int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
void (*inode_delete) (struct inode *inode);
int (*inode_setxattr) (struct dentry *dentry, char *name, void *value,
size_t size, int flags);
void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value,
size_t size, int flags);
int (*inode_getxattr) (struct dentry *dentry, char *name);
int (*inode_setxattr) (struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
int (*inode_getxattr) (struct dentry *dentry, const char *name);
int (*inode_listxattr) (struct dentry *dentry);
int (*inode_removexattr) (struct dentry *dentry, char *name);
int (*inode_removexattr) (struct dentry *dentry, const char *name);
int (*inode_need_killpriv) (struct dentry *dentry);
int (*inode_killpriv) (struct dentry *dentry);
int (*inode_getsecurity) (const struct inode *inode, const char *name, void **buffer, bool alloc);
Expand Down Expand Up @@ -1633,13 +1634,13 @@ int security_inode_permission(struct inode *inode, int mask, struct nameidata *n
int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
void security_inode_delete(struct inode *inode);
int security_inode_setxattr(struct dentry *dentry, char *name,
void *value, size_t size, int flags);
void security_inode_post_setxattr(struct dentry *dentry, char *name,
void *value, size_t size, int flags);
int security_inode_getxattr(struct dentry *dentry, char *name);
int security_inode_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
void security_inode_post_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags);
int security_inode_getxattr(struct dentry *dentry, const char *name);
int security_inode_listxattr(struct dentry *dentry);
int security_inode_removexattr(struct dentry *dentry, char *name);
int security_inode_removexattr(struct dentry *dentry, const char *name);
int security_inode_need_killpriv(struct dentry *dentry);
int security_inode_killpriv(struct dentry *dentry);
int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc);
Expand Down Expand Up @@ -2041,17 +2042,18 @@ static inline int security_inode_getattr(struct vfsmount *mnt,
static inline void security_inode_delete(struct inode *inode)
{ }

static inline int security_inode_setxattr(struct dentry *dentry, char *name,
void *value, size_t size, int flags)
static inline int security_inode_setxattr(struct dentry *dentry,
const char *name, const void *value, size_t size, int flags)
{
return cap_inode_setxattr(dentry, name, value, size, flags);
}

static inline void security_inode_post_setxattr(struct dentry *dentry, char *name,
void *value, size_t size, int flags)
static inline void security_inode_post_setxattr(struct dentry *dentry,
const char *name, const void *value, size_t size, int flags)
{ }

static inline int security_inode_getxattr(struct dentry *dentry, char *name)
static inline int security_inode_getxattr(struct dentry *dentry,
const char *name)
{
return 0;
}
Expand All @@ -2061,7 +2063,8 @@ static inline int security_inode_listxattr(struct dentry *dentry)
return 0;
}

static inline int security_inode_removexattr(struct dentry *dentry, char *name)
static inline int security_inode_removexattr(struct dentry *dentry,
const char *name)
{
return cap_inode_removexattr(dentry, name);
}
Expand Down
30 changes: 16 additions & 14 deletions include/linux/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,26 +240,28 @@ asmlinkage long sys_truncate64(const char __user *path, loff_t length);
asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length);
#endif

asmlinkage long sys_setxattr(char __user *path, char __user *name,
void __user *value, size_t size, int flags);
asmlinkage long sys_lsetxattr(char __user *path, char __user *name,
void __user *value, size_t size, int flags);
asmlinkage long sys_fsetxattr(int fd, char __user *name, void __user *value,
size_t size, int flags);
asmlinkage ssize_t sys_getxattr(char __user *path, char __user *name,
asmlinkage long sys_setxattr(const char __user *path, const char __user *name,
const void __user *value, size_t size, int flags);
asmlinkage long sys_lsetxattr(const char __user *path, const char __user *name,
const void __user *value, size_t size, int flags);
asmlinkage long sys_fsetxattr(int fd, const char __user *name,
const void __user *value, size_t size, int flags);
asmlinkage ssize_t sys_getxattr(const char __user *path, const char __user *name,
void __user *value, size_t size);
asmlinkage ssize_t sys_lgetxattr(char __user *path, char __user *name,
asmlinkage ssize_t sys_lgetxattr(const char __user *path, const char __user *name,
void __user *value, size_t size);
asmlinkage ssize_t sys_fgetxattr(int fd, char __user *name,
asmlinkage ssize_t sys_fgetxattr(int fd, const char __user *name,
void __user *value, size_t size);
asmlinkage ssize_t sys_listxattr(char __user *path, char __user *list,
asmlinkage ssize_t sys_listxattr(const char __user *path, char __user *list,
size_t size);
asmlinkage ssize_t sys_llistxattr(char __user *path, char __user *list,
asmlinkage ssize_t sys_llistxattr(const char __user *path, char __user *list,
size_t size);
asmlinkage ssize_t sys_flistxattr(int fd, char __user *list, size_t size);
asmlinkage long sys_removexattr(char __user *path, char __user *name);
asmlinkage long sys_lremovexattr(char __user *path, char __user *name);
asmlinkage long sys_fremovexattr(int fd, char __user *name);
asmlinkage long sys_removexattr(const char __user *path,
const char __user *name);
asmlinkage long sys_lremovexattr(const char __user *path,
const char __user *name);
asmlinkage long sys_fremovexattr(int fd, const char __user *name);

asmlinkage unsigned long sys_brk(unsigned long brk);
asmlinkage long sys_mprotect(unsigned long start, size_t len,
Expand Down
6 changes: 3 additions & 3 deletions include/linux/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ struct xattr_handler {
};

ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
int vfs_removexattr(struct dentry *, char *);
int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
int vfs_removexattr(struct dentry *, const char *);

ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
Expand Down
6 changes: 3 additions & 3 deletions security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ int cap_bprm_secureexec (struct linux_binprm *bprm)
current->egid != current->gid);
}

int cap_inode_setxattr(struct dentry *dentry, char *name, void *value,
size_t size, int flags)
int cap_inode_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
if (!strcmp(name, XATTR_NAME_CAPS)) {
if (!capable(CAP_SETFCAP))
Expand All @@ -397,7 +397,7 @@ int cap_inode_setxattr(struct dentry *dentry, char *name, void *value,
return 0;
}

int cap_inode_removexattr(struct dentry *dentry, char *name)
int cap_inode_removexattr(struct dentry *dentry, const char *name)
{
if (!strcmp(name, XATTR_NAME_CAPS)) {
if (!capable(CAP_SETFCAP))
Expand Down
13 changes: 7 additions & 6 deletions security/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ static void dummy_inode_delete (struct inode *ino)
return;
}

static int dummy_inode_setxattr (struct dentry *dentry, char *name, void *value,
size_t size, int flags)
static int dummy_inode_setxattr (struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
if (!strncmp(name, XATTR_SECURITY_PREFIX,
sizeof(XATTR_SECURITY_PREFIX) - 1) &&
Expand All @@ -375,12 +375,13 @@ static int dummy_inode_setxattr (struct dentry *dentry, char *name, void *value,
return 0;
}

static void dummy_inode_post_setxattr (struct dentry *dentry, char *name, void *value,
size_t size, int flags)
static void dummy_inode_post_setxattr (struct dentry *dentry, const char *name,
const void *value, size_t size,
int flags)
{
}

static int dummy_inode_getxattr (struct dentry *dentry, char *name)
static int dummy_inode_getxattr (struct dentry *dentry, const char *name)
{
return 0;
}
Expand All @@ -390,7 +391,7 @@ static int dummy_inode_listxattr (struct dentry *dentry)
return 0;
}

static int dummy_inode_removexattr (struct dentry *dentry, char *name)
static int dummy_inode_removexattr (struct dentry *dentry, const char *name)
{
if (!strncmp(name, XATTR_SECURITY_PREFIX,
sizeof(XATTR_SECURITY_PREFIX) - 1) &&
Expand Down
12 changes: 6 additions & 6 deletions security/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,23 +491,23 @@ void security_inode_delete(struct inode *inode)
security_ops->inode_delete(inode);
}

int security_inode_setxattr(struct dentry *dentry, char *name,
void *value, size_t size, int flags)
int security_inode_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
if (unlikely(IS_PRIVATE(dentry->d_inode)))
return 0;
return security_ops->inode_setxattr(dentry, name, value, size, flags);
}

void security_inode_post_setxattr(struct dentry *dentry, char *name,
void *value, size_t size, int flags)
void security_inode_post_setxattr(struct dentry *dentry, const char *name,
const void *value, size_t size, int flags)
{
if (unlikely(IS_PRIVATE(dentry->d_inode)))
return;
security_ops->inode_post_setxattr(dentry, name, value, size, flags);
}

int security_inode_getxattr(struct dentry *dentry, char *name)
int security_inode_getxattr(struct dentry *dentry, const char *name)
{
if (unlikely(IS_PRIVATE(dentry->d_inode)))
return 0;
Expand All @@ -521,7 +521,7 @@ int security_inode_listxattr(struct dentry *dentry)
return security_ops->inode_listxattr(dentry);
}

int security_inode_removexattr(struct dentry *dentry, char *name)
int security_inode_removexattr(struct dentry *dentry, const char *name)
{
if (unlikely(IS_PRIVATE(dentry->d_inode)))
return 0;
Expand Down
Loading

0 comments on commit 8f0cfa5

Please sign in to comment.