fs: Make linux kernel parser's match_table_t const
Subsystems (34)
Hi,
This is a second go at this patch. I believe that I've fixed the main problem with the last version which caused sparc to fail to compile. I don't have a sparc to test with though, so I'll have to leave that to others to test, I'm afraid.
Unlike the previous version, I've put the "const" by the individual variable declarations, all aside from the nfsroot one that is which was the cause of the problems. That is marked as __initconst instead.
This patch is against linux-next, but it should apply ok against current upstream as well, modulo a few offsets in the lines.
Is this trivial enough for the trivial tree, or is there a better place for it, VFS tree, or direct into linux-next for example?
arch/powerpc/platforms/cell/spufs/inode.c +1 -1
@@ -660,7 +660,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" },
arch/s390/hypfs/inode.c +1 -1
@@ -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 }
drivers/infiniband/ulp/srp/ib_srp.c +1 -1
@@ -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" },
drivers/usb/core/inode.c +1 -1
@@ -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" },
fs/9p/v9fs.c +1 -1
@@ -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" },
fs/adfs/super.c +1 -1
@@ -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" },
fs/affs/super.c +1 -1
@@ -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" },
fs/afs/super.c +1 -1
@@ -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" },
fs/autofs/inode.c +1 -1
@@ -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" },
fs/autofs4/inode.c +1 -1
@@ -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" },
fs/befs/linuxvfs.c +1 -1
@@ -649,7 +649,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" },
fs/devpts/inode.c +1 -1
@@ -48,7 +48,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" },
fs/ecryptfs/main.c +1 -1
@@ -212,7 +212,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"},
fs/ext2/super.c +1 -1
@@ -402,7 +402,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"},
fs/ext3/super.c +1 -1
@@ -768,7 +768,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" },
fs/ext4/super.c +1 -1
@@ -916,7 +916,7 @@ enum { Opt_mballoc, Opt_nomballoc, Opt_stripe, Opt_delalloc, Opt_nodelalloc, }; -static match_table_t tokens = { +static const match_table_t tokens = { {Opt_bsd_df,"bsddf" }, {Opt_minix_df,"minixdf" }, {Opt_grpid,"grpid" },
fs/fat/inode.c +3 -3
@@ -843,7 +843,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" },
@@ -878,14 +878,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"},
fs/fuse/inode.c +1 -1
@@ -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" },
fs/gfs2/mount.c +1 -1
@@ -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" },
fs/hfs/super.c +1 -1
@@ -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" },
fs/hfsplus/options.c +1 -1
@@ -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" },
fs/hpfs/super.c +1 -1
@@ -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" },
fs/hugetlbfs/inode.c +1 -1
@@ -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" },
fs/isofs/inode.c +1 -1
@@ -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" },
fs/jfs/super.c +1 -1
@@ -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"},
fs/nfs/nfsroot.c +1 -1
@@ -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" },
fs/nfs/super.c +3 -3
@@ -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" },
fs/ocfs2/super.c +1 -1
@@ -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" },
fs/omfs/inode.c +1 -1
@@ -347,7 +347,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"},
fs/ubifs/super.c +1 -1
@@ -842,7 +842,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 },
fs/udf/super.c +1 -1
@@ -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"},
fs/ufs/super.c +2 -2
@@ -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;
fs/xfs/linux-2.6/xfs_super.c +1 -1
@@ -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}
include/linux/parser.h +1 -1
@@ -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);
lib/parser.c +1 -1
@@ -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;
net/9p/client.c +1 -1
@@ -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" },
net/9p/trans_fd.c +1 -1
@@ -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" },
security/selinux/hooks.c +1 -1
@@ -353,7 +353,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" },
Hi Steven,
Quoted 5 lines · On Fri, 15 Aug 2008 15:00:42 +0100 Steven Whitehouse <[email protected]>…
Unlike the previous version, I've put the "const" by the individual variable declarations, all aside from the nfsroot one that is which was the cause of the problems. That is marked as
__initconstinstead.
A much better approach - hiding the "const" in the typedef was always a bit strange.
Quoted 2 lines
Is this trivial enough for the trivial tree, or is there a better place for it, VFS tree, or direct into linux-next for example?
linux-next currently has no easy way to include single patches like this. An alternative approach would be to ask Linus to take just the changes to match_token() into his tree now (as they are clearly correct and don't adversely affect any other code) and then send all the other bits to each of the maintainers. That way we avoid possible conflicts in linux-next over the following months and during the next merge window.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/