Skip to content

Commit 749c72e

Browse files
Stephen HemmingerAl Viro
authored andcommitted
ext2: constify xattr_handler
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent f01cbd3 commit 749c72e

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎fs/ext2/acl.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,15 @@ ext2_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
420420
return error;
421421
}
422422

423-
struct xattr_handler ext2_xattr_acl_access_handler = {
423+
const struct xattr_handler ext2_xattr_acl_access_handler = {
424424
.prefix = POSIX_ACL_XATTR_ACCESS,
425425
.flags = ACL_TYPE_ACCESS,
426426
.list = ext2_xattr_list_acl_access,
427427
.get = ext2_xattr_get_acl,
428428
.set = ext2_xattr_set_acl,
429429
};
430430

431-
struct xattr_handler ext2_xattr_acl_default_handler = {
431+
const struct xattr_handler ext2_xattr_acl_default_handler = {
432432
.prefix = POSIX_ACL_XATTR_DEFAULT,
433433
.flags = ACL_TYPE_DEFAULT,
434434
.list = ext2_xattr_list_acl_default,

‎fs/ext2/xattr.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void ext2_xattr_rehash(struct ext2_xattr_header *,
101101

102102
static struct mb_cache *ext2_xattr_cache;
103103

104-
static struct xattr_handler *ext2_xattr_handler_map[] = {
104+
static const struct xattr_handler *ext2_xattr_handler_map[] = {
105105
[EXT2_XATTR_INDEX_USER] = &ext2_xattr_user_handler,
106106
#ifdef CONFIG_EXT2_FS_POSIX_ACL
107107
[EXT2_XATTR_INDEX_POSIX_ACL_ACCESS] = &ext2_xattr_acl_access_handler,
@@ -113,7 +113,7 @@ static struct xattr_handler *ext2_xattr_handler_map[] = {
113113
#endif
114114
};
115115

116-
struct xattr_handler *ext2_xattr_handlers[] = {
116+
const struct xattr_handler *ext2_xattr_handlers[] = {
117117
&ext2_xattr_user_handler,
118118
&ext2_xattr_trusted_handler,
119119
#ifdef CONFIG_EXT2_FS_POSIX_ACL
@@ -126,10 +126,10 @@ struct xattr_handler *ext2_xattr_handlers[] = {
126126
NULL
127127
};
128128

129-
static inline struct xattr_handler *
129+
static inline const struct xattr_handler *
130130
ext2_xattr_handler(int name_index)
131131
{
132-
struct xattr_handler *handler = NULL;
132+
const struct xattr_handler *handler = NULL;
133133

134134
if (name_index > 0 && name_index < ARRAY_SIZE(ext2_xattr_handler_map))
135135
handler = ext2_xattr_handler_map[name_index];
@@ -298,7 +298,7 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
298298
/* list the attribute names */
299299
for (entry = FIRST_ENTRY(bh); !IS_LAST_ENTRY(entry);
300300
entry = EXT2_XATTR_NEXT(entry)) {
301-
struct xattr_handler *handler =
301+
const struct xattr_handler *handler =
302302
ext2_xattr_handler(entry->e_name_index);
303303

304304
if (handler) {

‎fs/ext2/xattr.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ struct ext2_xattr_entry {
5555

5656
# ifdef CONFIG_EXT2_FS_XATTR
5757

58-
extern struct xattr_handler ext2_xattr_user_handler;
59-
extern struct xattr_handler ext2_xattr_trusted_handler;
60-
extern struct xattr_handler ext2_xattr_acl_access_handler;
61-
extern struct xattr_handler ext2_xattr_acl_default_handler;
62-
extern struct xattr_handler ext2_xattr_security_handler;
58+
extern const struct xattr_handler ext2_xattr_user_handler;
59+
extern const struct xattr_handler ext2_xattr_trusted_handler;
60+
extern const struct xattr_handler ext2_xattr_acl_access_handler;
61+
extern const struct xattr_handler ext2_xattr_acl_default_handler;
62+
extern const struct xattr_handler ext2_xattr_security_handler;
6363

6464
extern ssize_t ext2_listxattr(struct dentry *, char *, size_t);
6565

@@ -72,7 +72,7 @@ extern void ext2_xattr_put_super(struct super_block *);
7272
extern int init_ext2_xattr(void);
7373
extern void exit_ext2_xattr(void);
7474

75-
extern struct xattr_handler *ext2_xattr_handlers[];
75+
extern const struct xattr_handler *ext2_xattr_handlers[];
7676

7777
# else /* CONFIG_EXT2_FS_XATTR */
7878

‎fs/ext2/xattr_security.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ext2_init_security(struct inode *inode, struct inode *dir)
6767
return err;
6868
}
6969

70-
struct xattr_handler ext2_xattr_security_handler = {
70+
const struct xattr_handler ext2_xattr_security_handler = {
7171
.prefix = XATTR_SECURITY_PREFIX,
7272
.list = ext2_xattr_security_list,
7373
.get = ext2_xattr_security_get,

‎fs/ext2/xattr_trusted.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ext2_xattr_trusted_set(struct dentry *dentry, const char *name,
5050
value, size, flags);
5151
}
5252

53-
struct xattr_handler ext2_xattr_trusted_handler = {
53+
const struct xattr_handler ext2_xattr_trusted_handler = {
5454
.prefix = XATTR_TRUSTED_PREFIX,
5555
.list = ext2_xattr_trusted_list,
5656
.get = ext2_xattr_trusted_get,

‎fs/ext2/xattr_user.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ext2_xattr_user_set(struct dentry *dentry, const char *name,
5454
name, value, size, flags);
5555
}
5656

57-
struct xattr_handler ext2_xattr_user_handler = {
57+
const struct xattr_handler ext2_xattr_user_handler = {
5858
.prefix = XATTR_USER_PREFIX,
5959
.list = ext2_xattr_user_list,
6060
.get = ext2_xattr_user_get,

0 commit comments

Comments
 (0)