diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2010-05-13 20:53:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-05-21 18:31:18 -0400 |
commit | bb4354538eb7b92f32cfedbad68c7be266c0b467 (patch) | |
tree | 5ecc43dabf5a0ecb511c74411272eba70415cdaf | |
parent | 18e9e5104fcd9a973ffe3eed3816c87f2a1b6cd2 (diff) |
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: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/generic_acl.c | 4 | ||||
-rw-r--r-- | fs/xattr.c | 14 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | include/linux/generic_acl.h | 4 | ||||
-rw-r--r-- | include/linux/xattr.h | 2 | ||||
-rw-r--r-- | mm/shmem.c | 4 |
6 files changed, 15 insertions, 15 deletions
diff --git a/fs/generic_acl.c b/fs/generic_acl.c index fe5df5457656..99800e564157 100644 --- a/fs/generic_acl.c +++ b/fs/generic_acl.c | |||
@@ -201,7 +201,7 @@ generic_check_acl(struct inode *inode, int mask) | |||
201 | return -EAGAIN; | 201 | return -EAGAIN; |
202 | } | 202 | } |
203 | 203 | ||
204 | struct xattr_handler generic_acl_access_handler = { | 204 | const struct xattr_handler generic_acl_access_handler = { |
205 | .prefix = POSIX_ACL_XATTR_ACCESS, | 205 | .prefix = POSIX_ACL_XATTR_ACCESS, |
206 | .flags = ACL_TYPE_ACCESS, | 206 | .flags = ACL_TYPE_ACCESS, |
207 | .list = generic_acl_list, | 207 | .list = generic_acl_list, |
@@ -209,7 +209,7 @@ struct xattr_handler generic_acl_access_handler = { | |||
209 | .set = generic_acl_set, | 209 | .set = generic_acl_set, |
210 | }; | 210 | }; |
211 | 211 | ||
212 | struct xattr_handler generic_acl_default_handler = { | 212 | const struct xattr_handler generic_acl_default_handler = { |
213 | .prefix = POSIX_ACL_XATTR_DEFAULT, | 213 | .prefix = POSIX_ACL_XATTR_DEFAULT, |
214 | .flags = ACL_TYPE_DEFAULT, | 214 | .flags = ACL_TYPE_DEFAULT, |
215 | .list = generic_acl_list, | 215 | .list = generic_acl_list, |
diff --git a/fs/xattr.c b/fs/xattr.c index 46f87e828b48..01bb8135e14a 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -590,10 +590,10 @@ strcmp_prefix(const char *a, const char *a_prefix) | |||
590 | /* | 590 | /* |
591 | * Find the xattr_handler with the matching prefix. | 591 | * Find the xattr_handler with the matching prefix. |
592 | */ | 592 | */ |
593 | static struct xattr_handler * | 593 | static const struct xattr_handler * |
594 | xattr_resolve_name(struct xattr_handler **handlers, const char **name) | 594 | xattr_resolve_name(const struct xattr_handler **handlers, const char **name) |
595 | { | 595 | { |
596 | struct xattr_handler *handler; | 596 | const struct xattr_handler *handler; |
597 | 597 | ||
598 | if (!*name) | 598 | if (!*name) |
599 | return NULL; | 599 | return NULL; |
@@ -614,7 +614,7 @@ xattr_resolve_name(struct xattr_handler **handlers, const char **name) | |||
614 | ssize_t | 614 | ssize_t |
615 | generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size) | 615 | generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size) |
616 | { | 616 | { |
617 | struct xattr_handler *handler; | 617 | const struct xattr_handler *handler; |
618 | 618 | ||
619 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); | 619 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); |
620 | if (!handler) | 620 | if (!handler) |
@@ -629,7 +629,7 @@ generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t s | |||
629 | ssize_t | 629 | ssize_t |
630 | generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | 630 | generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) |
631 | { | 631 | { |
632 | struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; | 632 | const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; |
633 | unsigned int size = 0; | 633 | unsigned int size = 0; |
634 | 634 | ||
635 | if (!buffer) { | 635 | if (!buffer) { |
@@ -659,7 +659,7 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
659 | int | 659 | int |
660 | generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) | 660 | generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) |
661 | { | 661 | { |
662 | struct xattr_handler *handler; | 662 | const struct xattr_handler *handler; |
663 | 663 | ||
664 | if (size == 0) | 664 | if (size == 0) |
665 | value = ""; /* empty EA, do not remove */ | 665 | value = ""; /* empty EA, do not remove */ |
@@ -676,7 +676,7 @@ generic_setxattr(struct dentry *dentry, const char *name, const void *value, siz | |||
676 | int | 676 | int |
677 | generic_removexattr(struct dentry *dentry, const char *name) | 677 | generic_removexattr(struct dentry *dentry, const char *name) |
678 | { | 678 | { |
679 | struct xattr_handler *handler; | 679 | const struct xattr_handler *handler; |
680 | 680 | ||
681 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); | 681 | handler = xattr_resolve_name(dentry->d_sb->s_xattr, &name); |
682 | if (!handler) | 682 | if (!handler) |
diff --git a/include/linux/fs.h b/include/linux/fs.h index d51256bc6328..6660db898c41 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1336,7 +1336,7 @@ struct super_block { | |||
1336 | #ifdef CONFIG_SECURITY | 1336 | #ifdef CONFIG_SECURITY |
1337 | void *s_security; | 1337 | void *s_security; |
1338 | #endif | 1338 | #endif |
1339 | struct xattr_handler **s_xattr; | 1339 | const struct xattr_handler **s_xattr; |
1340 | 1340 | ||
1341 | struct list_head s_inodes; /* all inodes */ | 1341 | struct list_head s_inodes; /* all inodes */ |
1342 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ | 1342 | struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ |
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h index ca666d18ed67..574bea4013b6 100644 --- a/include/linux/generic_acl.h +++ b/include/linux/generic_acl.h | |||
@@ -5,8 +5,8 @@ | |||
5 | 5 | ||
6 | struct inode; | 6 | struct inode; |
7 | 7 | ||
8 | extern struct xattr_handler generic_acl_access_handler; | 8 | extern const struct xattr_handler generic_acl_access_handler; |
9 | extern struct xattr_handler generic_acl_default_handler; | 9 | extern const struct xattr_handler generic_acl_default_handler; |
10 | 10 | ||
11 | int generic_acl_init(struct inode *, struct inode *); | 11 | int generic_acl_init(struct inode *, struct inode *); |
12 | int generic_acl_chmod(struct inode *); | 12 | int generic_acl_chmod(struct inode *); |
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index fb9b7e6e1e2d..0cfa1e9c4cc1 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
@@ -37,7 +37,7 @@ struct inode; | |||
37 | struct dentry; | 37 | struct dentry; |
38 | 38 | ||
39 | struct xattr_handler { | 39 | struct xattr_handler { |
40 | char *prefix; | 40 | const char *prefix; |
41 | int flags; /* fs private flags passed back to the handlers */ | 41 | int flags; /* fs private flags passed back to the handlers */ |
42 | size_t (*list)(struct dentry *dentry, char *list, size_t list_size, | 42 | size_t (*list)(struct dentry *dentry, char *list, size_t list_size, |
43 | const char *name, size_t name_len, int handler_flags); | 43 | const char *name, size_t name_len, int handler_flags); |
diff --git a/mm/shmem.c b/mm/shmem.c index eef4ebea5158..717aa62ff127 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2071,14 +2071,14 @@ static int shmem_xattr_security_set(struct dentry *dentry, const char *name, | |||
2071 | size, flags); | 2071 | size, flags); |
2072 | } | 2072 | } |
2073 | 2073 | ||
2074 | static struct xattr_handler shmem_xattr_security_handler = { | 2074 | static const struct xattr_handler shmem_xattr_security_handler = { |
2075 | .prefix = XATTR_SECURITY_PREFIX, | 2075 | .prefix = XATTR_SECURITY_PREFIX, |
2076 | .list = shmem_xattr_security_list, | 2076 | .list = shmem_xattr_security_list, |
2077 | .get = shmem_xattr_security_get, | 2077 | .get = shmem_xattr_security_get, |
2078 | .set = shmem_xattr_security_set, | 2078 | .set = shmem_xattr_security_set, |
2079 | }; | 2079 | }; |
2080 | 2080 | ||
2081 | static struct xattr_handler *shmem_xattr_handlers[] = { | 2081 | static const struct xattr_handler *shmem_xattr_handlers[] = { |
2082 | &generic_acl_access_handler, | 2082 | &generic_acl_access_handler, |
2083 | &generic_acl_default_handler, | 2083 | &generic_acl_default_handler, |
2084 | &shmem_xattr_security_handler, | 2084 | &shmem_xattr_security_handler, |