diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-12-08 04:25:51 -0500 |
---|---|---|
committer | Jon Masters <jcm@jonmasters.org> | 2011-04-13 03:00:43 -0400 |
commit | 86a075a68131fc275217c40f8a06df112d3238d1 (patch) | |
tree | fe5c27ed7a13daaf0b99ab6f1c9ac1023ce8cd9d | |
parent | 8605feb954190e0d1d19c6a65713c4e23671cbea (diff) | |
download | module-init-tools-86a075a68131fc275217c40f8a06df112d3238d1.tar.gz |
m-i-t: constify
Constify a bunch of data structures that need not be writable.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | depmod.c | 10 | ||||
-rw-r--r-- | elfops.h | 4 | ||||
-rw-r--r-- | elfops_core.c | 2 | ||||
-rw-r--r-- | modindex.c | 2 | ||||
-rw-r--r-- | modinfo.c | 2 | ||||
-rw-r--r-- | modprobe.c | 2 | ||||
-rw-r--r-- | rmmod.c | 2 |
7 files changed, 12 insertions, 12 deletions
@@ -222,7 +222,7 @@ static void load_module_symvers(const char *filename) add_fake_syms(); } -static struct option options[] = { { "all", 0, NULL, 'a' }, +static const struct option options[] = { { "all", 0, NULL, 'a' }, { "quick", 0, NULL, 'A' }, { "basedir", 1, NULL, 'b' }, { "config", 1, NULL, 'C' }, @@ -1030,12 +1030,12 @@ static int output_devname(struct module *modules, FILE *out, char *dirname) } struct depfile { - char *name; + const char *name; int (*func)(struct module *, FILE *, char *dirname); int map_file; }; -static struct depfile depfiles[] = { +static const struct depfile depfiles[] = { { "modules.dep", output_deps, 0 }, /* This is what we check for '-A'. */ { "modules.dep.bin", output_deps_bin, 0 }, { "modules.pcimap", output_pci_table, 1 }, @@ -1499,10 +1499,10 @@ int main(int argc, char *argv[]) list = sort_modules(dirname,list); list = parse_modules(list); - for (i = 0; i < sizeof(depfiles)/sizeof(depfiles[0]); i++) { + for (i = 0; i < ARRAY_SIZE(depfiles); i++) { FILE *out; int res; - struct depfile *d = &depfiles[i]; + const struct depfile *d = &depfiles[i]; char depname[strlen(dirname) + 1 + strlen(d->name) + 1]; char tmpname[strlen(dirname) + 1 + strlen(d->name) + strlen(".temp") + 1]; @@ -23,7 +23,7 @@ struct elf_file char *pathname; /* File operations */ - struct module_ops *ops; + const struct module_ops *ops; /* Convert endian? */ int conv; @@ -76,7 +76,7 @@ struct module_ops int (*dump_modvers)(struct elf_file *module); }; -extern struct module_ops mod_ops32, mod_ops64; +extern const struct module_ops mod_ops32, mod_ops64; struct elf_file *grab_elf_file(const char *pathname); void release_elf_file(struct elf_file *file); diff --git a/elfops_core.c b/elfops_core.c index 58a7943..7150d39 100644 --- a/elfops_core.c +++ b/elfops_core.c @@ -439,7 +439,7 @@ static int PERBIT(dump_modversions)(struct elf_file *module) return n; } -struct module_ops PERBIT(mod_ops) = { +const struct module_ops PERBIT(mod_ops) = { .load_section = PERBIT(load_section), .load_strings = PERBIT(load_strings), .load_symbols = PERBIT(load_symbols), @@ -104,7 +104,7 @@ static void print_usage(const char *progname) exit(1); } -static struct option options[] = { +static const struct option options[] = { { "output", 0, NULL, 'o' }, { "dump", 0, NULL, 'd' }, { "search", 1, NULL, 's' }, @@ -122,7 +122,7 @@ static void print_all(struct string_table *tags, } } -static struct option options[] = +static const struct option options[] = { {"author", 0, 0, 'a'}, {"description", 0, 0, 'd'}, @@ -1670,7 +1670,7 @@ out: return failed; } -static struct option options[] = { { "version", 0, NULL, 'V' }, +static const struct option options[] = { { "version", 0, NULL, 'V' }, { "verbose", 0, NULL, 'v' }, { "quiet", 0, NULL, 'q' }, { "syslog", 0, NULL, 's' }, @@ -130,7 +130,7 @@ static int rmmod(const char *path, int flags) return ret; } -static struct option options[] = { { "all", 0, NULL, 'a' }, +static const struct option options[] = { { "all", 0, NULL, 'a' }, { "force", 0, NULL, 'f' }, { "help", 0, NULL, 'h' }, { "syslog", 0, NULL, 's' }, |