vfs: Use const for kernel parser table
authorSteven Whitehouse <swhiteho@redhat.com>
Mon, 13 Oct 2008 09:46:57 +0000 (10:46 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 13 Oct 2008 17:10:37 +0000 (10:10 -0700)
This is a much better version of a previous patch to make the parser
tables constant. Rather than changing the typedef, we put the "const" in
all the various places where its required, allowing the __initconst
exception for nfsroot which was the cause of the previous trouble.

This was posted for review some time ago and I believe its been in -mm
since then.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Cc: Alexander Viro <aviro@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
38 files changed:
arch/powerpc/platforms/cell/spufs/inode.c
arch/s390/hypfs/inode.c
drivers/infiniband/ulp/srp/ib_srp.c
drivers/usb/core/inode.c
fs/9p/v9fs.c
fs/adfs/super.c
fs/affs/super.c
fs/afs/super.c
fs/autofs/inode.c
fs/autofs4/inode.c
fs/befs/linuxvfs.c
fs/devpts/inode.c
fs/ecryptfs/main.c
fs/ext2/super.c
fs/ext3/super.c
fs/ext4/super.c
fs/fat/inode.c
fs/fuse/inode.c
fs/gfs2/mount.c
fs/hfs/super.c
fs/hfsplus/options.c
fs/hpfs/super.c
fs/hugetlbfs/inode.c
fs/isofs/inode.c
fs/jfs/super.c
fs/nfs/nfsroot.c
fs/nfs/super.c
fs/ocfs2/super.c
fs/omfs/inode.c
fs/ubifs/super.c
fs/udf/super.c
fs/ufs/super.c
fs/xfs/linux-2.6/xfs_super.c
include/linux/parser.h
lib/parser.c
net/9p/client.c
net/9p/trans_fd.c
security/selinux/hooks.c

index 690ca7b..2c8b809 100644 (file)
@@ -659,7 +659,7 @@ enum {
        Opt_uid, Opt_gid, Opt_mode, Opt_debug, Opt_err,
 };
 
-static match_table_t spufs_tokens = {
+static const match_table_t spufs_tokens = {
        { Opt_uid,   "uid=%d" },
        { Opt_gid,   "gid=%d" },
        { Opt_mode,  "mode=%o" },
index 7383781..3631380 100644 (file)
@@ -219,7 +219,7 @@ static int hypfs_release(struct inode *inode, struct file *filp)
 
 enum { opt_uid, opt_gid, opt_err };
 
-static match_table_t hypfs_tokens = {
+static const match_table_t hypfs_tokens = {
        {opt_uid, "uid=%u"},
        {opt_gid, "gid=%u"},
        {opt_err, NULL}
index ed7c5f7..5b8b533 100644 (file)
@@ -1683,7 +1683,7 @@ enum {
                                   SRP_OPT_SERVICE_ID),
 };
 
-static match_table_t srp_opt_tokens = {
+static const match_table_t srp_opt_tokens = {
        { SRP_OPT_ID_EXT,               "id_ext=%s"             },
        { SRP_OPT_IOC_GUID,             "ioc_guid=%s"           },
        { SRP_OPT_DGID,                 "dgid=%s"               },
index db410e9..77fa7a0 100644 (file)
@@ -97,7 +97,7 @@ enum {
        Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_devuid, "devuid=%u"},
        {Opt_devgid, "devgid=%u"},
        {Opt_devmode, "devmode=%o"},
index 047c791..c061c3f 100644 (file)
@@ -55,7 +55,7 @@ enum {
        Opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_debug, "debug=%x"},
        {Opt_dfltuid, "dfltuid=%u"},
        {Opt_dfltgid, "dfltgid=%u"},
index 26f3b43..7f83a46 100644 (file)
@@ -157,7 +157,7 @@ static int adfs_show_options(struct seq_file *seq, struct vfsmount *mnt)
 
 enum {Opt_uid, Opt_gid, Opt_ownmask, Opt_othmask, Opt_err};
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
        {Opt_ownmask, "ownmask=%o"},
index 3a89094..8989c93 100644 (file)
@@ -135,7 +135,7 @@ enum {
        Opt_verbose, Opt_volume, Opt_ignore, Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_bs, "bs=%u"},
        {Opt_mode, "mode=%o"},
        {Opt_mufs, "mufs"},
index 250d8c4..aee239a 100644 (file)
@@ -64,7 +64,7 @@ enum {
        afs_opt_vol,
 };
 
-static match_table_t afs_options_list = {
+static const match_table_t afs_options_list = {
        { afs_opt_cell,         "cell=%s"       },
        { afs_opt_rwpath,       "rwpath"        },
        { afs_opt_vol,          "vol=%s"        },
index dda510d..b70eea1 100644 (file)
@@ -59,7 +59,7 @@ static const struct super_operations autofs_sops = {
 
 enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto};
 
-static match_table_t autofs_tokens = {
+static const match_table_t autofs_tokens = {
        {Opt_fd, "fd=%u"},
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
index 7bb3e5b..45d5581 100644 (file)
@@ -213,7 +213,7 @@ static const struct super_operations autofs4_sops = {
 enum {Opt_err, Opt_fd, Opt_uid, Opt_gid, Opt_pgrp, Opt_minproto, Opt_maxproto,
        Opt_indirect, Opt_direct, Opt_offset};
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_fd, "fd=%u"},
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
index 740f536..9286b2a 100644 (file)
@@ -650,7 +650,7 @@ enum {
        Opt_uid, Opt_gid, Opt_charset, Opt_debug, Opt_err,
 };
 
-static match_table_t befs_tokens = {
+static const match_table_t befs_tokens = {
        {Opt_uid, "uid=%d"},
        {Opt_gid, "gid=%d"},
        {Opt_charset, "iocharset=%s"},
index a70d5d0..4a714f6 100644 (file)
@@ -49,7 +49,7 @@ enum {
        Opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
        {Opt_mode, "mode=%o"},
index 448dfd5..8ebe9a5 100644 (file)
@@ -211,7 +211,7 @@ enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig,
        ecryptfs_opt_passthrough, ecryptfs_opt_xattr_metadata,
        ecryptfs_opt_encrypted_view, ecryptfs_opt_err };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {ecryptfs_opt_sig, "sig=%s"},
        {ecryptfs_opt_ecryptfs_sig, "ecryptfs_sig=%s"},
        {ecryptfs_opt_cipher, "cipher=%s"},
index fd88c7b..647cd88 100644 (file)
@@ -393,7 +393,7 @@ enum {
        Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_bsd_df, "bsddf"},
        {Opt_minix_df, "minixdf"},
        {Opt_grpid, "grpid"},
index f38a5af..399a96a 100644 (file)
@@ -760,7 +760,7 @@ enum {
        Opt_grpquota
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_bsd_df, "bsddf"},
        {Opt_minix_df, "minixdf"},
        {Opt_grpid, "grpid"},
index fb940c2..dea8f13 100644 (file)
@@ -919,7 +919,7 @@ enum {
        Opt_inode_readahead_blks
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_bsd_df, "bsddf"},
        {Opt_minix_df, "minixdf"},
        {Opt_grpid, "grpid"},
index 80ff338..d12cdf2 100644 (file)
@@ -855,7 +855,7 @@ enum {
        Opt_obsolate, Opt_flush, Opt_tz_utc, Opt_err,
 };
 
-static match_table_t fat_tokens = {
+static const match_table_t fat_tokens = {
        {Opt_check_r, "check=relaxed"},
        {Opt_check_s, "check=strict"},
        {Opt_check_n, "check=normal"},
@@ -890,14 +890,14 @@ static match_table_t fat_tokens = {
        {Opt_tz_utc, "tz=UTC"},
        {Opt_err, NULL},
 };
-static match_table_t msdos_tokens = {
+static const match_table_t msdos_tokens = {
        {Opt_nodots, "nodots"},
        {Opt_nodots, "dotsOK=no"},
        {Opt_dots, "dots"},
        {Opt_dots, "dotsOK=yes"},
        {Opt_err, NULL}
 };
-static match_table_t vfat_tokens = {
+static const match_table_t vfat_tokens = {
        {Opt_charset, "iocharset=%s"},
        {Opt_shortname_lower, "shortname=lower"},
        {Opt_shortname_win95, "shortname=win95"},
index d2249f1..6a84388 100644 (file)
@@ -354,7 +354,7 @@ enum {
        OPT_ERR
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {OPT_FD,                        "fd=%u"},
        {OPT_ROOTMODE,                  "rootmode=%o"},
        {OPT_USER_ID,                   "user_id=%u"},
index df48333..f96eb90 100644 (file)
@@ -46,7 +46,7 @@ enum {
        Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_lockproto, "lockproto=%s"},
        {Opt_locktable, "locktable=%s"},
        {Opt_hostdata, "hostdata=%s"},
index 4abb104..3c7c763 100644 (file)
@@ -173,7 +173,7 @@ enum {
        opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        { opt_uid, "uid=%u" },
        { opt_gid, "gid=%u" },
        { opt_umask, "umask=%o" },
index 9997cbf..9699c56 100644 (file)
@@ -25,7 +25,7 @@ enum {
        opt_force, opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        { opt_creator, "creator=%s" },
        { opt_type, "type=%s" },
        { opt_umask, "umask=%o" },
index b8ae9c9..29ad461 100644 (file)
@@ -215,7 +215,7 @@ enum {
        Opt_timeshift, Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_help, "help"},
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
index 3f58923..61edc70 100644 (file)
@@ -57,7 +57,7 @@ enum {
        Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_size,      "size=%s"},
        {Opt_nr_inodes, "nr_inodes=%s"},
        {Opt_mode,      "mode=%o"},
index 26948a6..3f8af0f 100644 (file)
@@ -310,7 +310,7 @@ enum {
        Opt_nocompress, Opt_hide, Opt_showassoc, Opt_dmode,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_norock, "norock"},
        {Opt_nojoliet, "nojoliet"},
        {Opt_unhide, "unhide"},
index 3630718..0dae345 100644 (file)
@@ -199,7 +199,7 @@ enum {
        Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_integrity, "integrity"},
        {Opt_nointegrity, "nointegrity"},
        {Opt_iocharset, "iocharset=%s"},
index 46763d1..8478fc2 100644 (file)
@@ -127,7 +127,7 @@ enum {
        Opt_err
 };
 
-static match_table_t __initdata tokens = {
+static match_table_t __initconst tokens = {
        {Opt_port, "port=%u"},
        {Opt_rsize, "rsize=%u"},
        {Opt_wsize, "wsize=%u"},
index e9b2017..ffb6974 100644 (file)
@@ -98,7 +98,7 @@ enum {
        Opt_err
 };
 
-static match_table_t nfs_mount_option_tokens = {
+static const match_table_t nfs_mount_option_tokens = {
        { Opt_userspace, "bg" },
        { Opt_userspace, "fg" },
        { Opt_userspace, "retry=%s" },
@@ -163,7 +163,7 @@ enum {
        Opt_xprt_err
 };
 
-static match_table_t nfs_xprt_protocol_tokens = {
+static const match_table_t nfs_xprt_protocol_tokens = {
        { Opt_xprt_udp, "udp" },
        { Opt_xprt_tcp, "tcp" },
        { Opt_xprt_rdma, "rdma" },
@@ -180,7 +180,7 @@ enum {
        Opt_sec_err
 };
 
-static match_table_t nfs_secflavor_tokens = {
+static const match_table_t nfs_secflavor_tokens = {
        { Opt_sec_none, "none" },
        { Opt_sec_none, "null" },
        { Opt_sec_sys, "sys" },
index 88255d3..70334d8 100644 (file)
@@ -157,7 +157,7 @@ enum {
        Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_barrier, "barrier=%u"},
        {Opt_err_panic, "errors=panic"},
        {Opt_err_ro, "errors=remount-ro"},
index d29047b..cbf047a 100644 (file)
@@ -346,7 +346,7 @@ enum {
        Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_uid, "uid=%u"},
        {Opt_gid, "gid=%u"},
        {Opt_umask, "umask=%o"},
index 3f49020..9a92203 100644 (file)
@@ -848,7 +848,7 @@ enum {
        Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_fast_unmount, "fast_unmount"},
        {Opt_norm_unmount, "norm_unmount"},
        {Opt_err, NULL},
index 5698bbf..e25e701 100644 (file)
@@ -369,7 +369,7 @@ enum {
        Opt_err, Opt_uforget, Opt_uignore, Opt_gforget, Opt_gignore
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_novrs,     "novrs"},
        {Opt_nostrict,  "nostrict"},
        {Opt_bs,        "bs=%u"},
index 3141969..e65212d 100644 (file)
@@ -309,7 +309,7 @@ enum {
        Opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_type_old, "ufstype=old"},
        {Opt_type_sunx86, "ufstype=sunx86"},
        {Opt_type_sun, "ufstype=sun"},
@@ -1233,7 +1233,7 @@ static int ufs_show_options(struct seq_file *seq, struct vfsmount *vfs)
 {
        struct ufs_sb_info *sbi = UFS_SB(vfs->mnt_sb);
        unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE;
-       struct match_token *tp = tokens;
+       const struct match_token *tp = tokens;
 
        while (tp->token != Opt_onerror_panic && tp->token != mval)
                ++tp;
index 18d3c84..7227b2e 100644 (file)
@@ -158,7 +158,7 @@ enum {
        Opt_barrier, Opt_nobarrier, Opt_err
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_barrier, "barrier"},
        {Opt_nobarrier, "nobarrier"},
        {Opt_err, NULL}
index 7dcd050..ea2281e 100644 (file)
@@ -25,7 +25,7 @@ typedef struct {
        char *to;
 } substring_t;
 
-int match_token(char *, match_table_t table, substring_t args[]);
+int match_token(char *, const match_table_t table, substring_t args[]);
 int match_int(substring_t *, int *result);
 int match_octal(substring_t *, int *result);
 int match_hex(substring_t *, int *result);
index 4f0cbc0..b00d020 100644 (file)
@@ -100,7 +100,7 @@ static int match_one(char *s, const char *p, substring_t args[])
  * format identifiers which will be taken into account when matching the
  * tokens, and whose locations will be returned in the @args array.
  */
-int match_token(char *s, match_table_t table, substring_t args[])
+int match_token(char *s, const match_table_t table, substring_t args[])
 {
        const struct match_token *p;
 
index 10e3203..e053e06 100644 (file)
@@ -52,7 +52,7 @@ enum {
        Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_msize, "msize=%u"},
        {Opt_legacy, "noextend"},
        {Opt_trans, "trans=%s"},
index d652baf..6dabbdb 100644 (file)
@@ -86,7 +86,7 @@ enum {
        Opt_port, Opt_rfdno, Opt_wfdno, Opt_err,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_port, "port=%u"},
        {Opt_rfdno, "rfdno=%u"},
        {Opt_wfdno, "wfdno=%u"},
index 88f1953..576e511 100644 (file)
@@ -325,7 +325,7 @@ enum {
        Opt_rootcontext = 4,
 };
 
-static match_table_t tokens = {
+static const match_table_t tokens = {
        {Opt_context, CONTEXT_STR "%s"},
        {Opt_fscontext, FSCONTEXT_STR "%s"},
        {Opt_defcontext, DEFCONTEXT_STR "%s"},