Commit bb435453 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Al Viro

fs: xattr_handler table should be const

The entries in xattr handler table should be immutable (ie const)
like other operation tables.

Later patches convert common filesystems. Uncoverted filesystems
will still work, but will generate a compiler warning.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 18e9e510
...@@ -201,7 +201,7 @@ generic_check_acl(struct inode *inode, int mask) ...@@ -201,7 +201,7 @@ generic_check_acl(struct inode *inode, int mask)
return -EAGAIN; return -EAGAIN;
} }
struct xattr_handler generic_acl_access_handler = { const struct xattr_handler generic_acl_access_handler = {
.prefix = POSIX_ACL_XATTR_ACCESS, .prefix = POSIX_ACL_XATTR_ACCESS,
.flags = ACL_TYPE_ACCESS, .flags = ACL_TYPE_ACCESS,
.list = generic_acl_list, .list = generic_acl_list,
...@@ -209,7 +209,7 @@ struct xattr_handler generic_acl_access_handler = { ...@@ -209,7 +209,7 @@ struct xattr_handler generic_acl_access_handler = {
.set = generic_acl_set, .set = generic_acl_set,
}; };
struct xattr_handler generic_acl_default_handler = { const struct xattr_handler generic_acl_default_handler = {
.prefix = POSIX_ACL_XATTR_DEFAULT, .prefix = POSIX_ACL_XATTR_DEFAULT,
.flags = ACL_TYPE_DEFAULT, .flags = ACL_TYPE_DEFAULT,
.list = generic_acl_list, .list = generic_acl_list,
......
...@@ -590,10 +590,10 @@ strcmp_prefix(const char *a, const char *a_prefix) ...@@ -590,10 +590,10 @@ strcmp_prefix(const char *a, const char *a_prefix)
/* /*
* Find the xattr_handler with the matching prefix. * Find the xattr_handler with the matching prefix.
*/ */
static struct xattr_handler * static const struct xattr_handler *
xattr_resolve_name(struct xattr_handler **handlers, const char **name) xattr_resolve_name(const struct xattr_handler **handlers, const char **name)
{ {
struct xattr_handler *handler; const struct xattr_handler *handler;
if (!*name) if (!*name)
return NULL; return NULL;
...@@ -614,7 +614,7 @@ xattr_resolve_name(struct xattr_handler **handlers, const char **name) ...@@ -614,7 +614,7 @@ xattr_resolve_name(struct xattr_handler **handlers, const char **name)
ssize_t ssize_t
generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size) generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size)
{ {
struct xattr_handler *handler; const struct xattr_handler *handler;
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler) if (!handler)
...@@ -629,7 +629,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s ...@@ -629,7 +629,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s
ssize_t ssize_t
generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
{ {
struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr;
unsigned int size = 0; unsigned int size = 0;
if (!buffer) { if (!buffer) {
...@@ -659,7 +659,7 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) ...@@ -659,7 +659,7 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
int int
generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
{ {
struct xattr_handler *handler; const struct xattr_handler *handler;
if (size == 0) if (size == 0)
value = ""; /* empty EA, do not remove */ value = ""; /* empty EA, do not remove */
...@@ -676,7 +676,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz ...@@ -676,7 +676,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz
int int
generic_removexattr(struct dentry *dentry, const char *name) generic_removexattr(struct dentry *dentry, const char *name)
{ {
struct xattr_handler *handler; const struct xattr_handler *handler;
handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name);
if (!handler) if (!handler)
......
...@@ -1336,7 +1336,7 @@ struct super_block { ...@@ -1336,7 +1336,7 @@ struct super_block {
#ifdef CONFIG_SECURITY #ifdef CONFIG_SECURITY
void *s_security; void *s_security;
#endif #endif
struct xattr_handler **s_xattr; const struct xattr_handler **s_xattr;
struct list_head s_inodes; /* all inodes */ struct list_head s_inodes; /* all inodes */
struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
struct inode; struct inode;
extern struct xattr_handler generic_acl_access_handler; extern const struct xattr_handler generic_acl_access_handler;
extern struct xattr_handler generic_acl_default_handler; extern const struct xattr_handler generic_acl_default_handler;
int generic_acl_init(struct inode *, struct inode *); int generic_acl_init(struct inode *, struct inode *);
int generic_acl_chmod(struct inode *); int generic_acl_chmod(struct inode *);
......
...@@ -37,7 +37,7 @@ struct inode; ...@@ -37,7 +37,7 @@ struct inode;
struct dentry; struct dentry;
struct xattr_handler { struct xattr_handler {
char *prefix; const char *prefix;
int flags; /* fs private flags passed back to the handlers */ int flags; /* fs private flags passed back to the handlers */
size_t (*list)(struct dentry *dentry, char *list, size_t list_size, size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
const char *name, size_t name_len, int handler_flags); const char *name, size_t name_len, int handler_flags);
......
...@@ -2071,14 +2071,14 @@ static int shmem_xattr_security_set(struct dentry *dentry, const char *name, ...@@ -2071,14 +2071,14 @@ static int shmem_xattr_security_set(struct dentry *dentry, const char *name,
size, flags); size, flags);
} }
static struct xattr_handler shmem_xattr_security_handler = { static const struct xattr_handler shmem_xattr_security_handler = {
.prefix = XATTR_SECURITY_PREFIX, .prefix = XATTR_SECURITY_PREFIX,
.list = shmem_xattr_security_list, .list = shmem_xattr_security_list,
.get = shmem_xattr_security_get, .get = shmem_xattr_security_get,
.set = shmem_xattr_security_set, .set = shmem_xattr_security_set,
}; };
static struct xattr_handler *shmem_xattr_handlers[] = { static const struct xattr_handler *shmem_xattr_handlers[] = {
&generic_acl_access_handler, &generic_acl_access_handler,
&generic_acl_default_handler, &generic_acl_default_handler,
&shmem_xattr_security_handler, &shmem_xattr_security_handler,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment