From 6c7d5ae9a2338be35cfab0fd8379a9f58c4f8c36 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Mar 2011 15:00:30 +0100 Subject: move struct option to .rodata It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak --- disk-utils/mkswap.c | 2 +- disk-utils/swaplabel.c | 2 +- lib/cpuset.c | 2 +- misc-utils/findmnt.c | 2 +- misc-utils/lsblk.c | 2 +- misc-utils/namei.c | 2 +- misc-utils/wipefs.c | 2 +- mount/lomount.c | 3 ++- schedutils/chrt.c | 2 +- schedutils/taskset.c | 2 +- shlibs/mount/samples/mount.c | 2 +- sys-utils/fallocate.c | 2 +- sys-utils/fsfreeze.c | 2 +- sys-utils/fstrim.c | 2 +- sys-utils/lscpu.c | 2 +- sys-utils/setarch.c | 2 +- sys-utils/unshare.c | 2 +- term-utils/script.c | 2 +- text-utils/column.c | 2 +- 19 files changed, 20 insertions(+), 19 deletions(-) diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 0f4ad398f..267e78e43 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -457,7 +457,7 @@ main(int argc, char **argv) { const char *opt_uuid = NULL; uuid_t uuid_dat; #endif - struct option longopts[] = { + static const struct option longopts[] = { { "check", no_argument, 0, 'c' }, { "force", no_argument, 0, 'f' }, { "pagesize", required_argument, 0, 'p' }, diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c index 86b3199e4..fbd8ae37d 100644 --- a/disk-utils/swaplabel.c +++ b/disk-utils/swaplabel.c @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) char *uuid = NULL, *label = NULL, *devname; int c, rc = -1; - struct option longopts[] = { + static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "label", 1, 0, 'L' }, { "uuid", 1, 0, 'U' }, diff --git a/lib/cpuset.c b/lib/cpuset.c index b8a41085b..07e91cac0 100644 --- a/lib/cpuset.c +++ b/lib/cpuset.c @@ -313,7 +313,7 @@ int main(int argc, char *argv[]) char *buf, *mask = NULL, *range = NULL; int ncpus = 2048, rc, c; - struct option longopts[] = { + static const struct option longopts[] = { { "ncpus", 1, 0, 'n' }, { "mask", 1, 0, 'm' }, { "range", 1, 0, 'r' }, diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index e87c70aa3..97d09e2c4 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -568,7 +568,7 @@ int main(int argc, char *argv[]) /* table.h */ struct tt *tt = NULL; - struct option longopts[] = { + static const struct option longopts[] = { { "ascii", 0, 0, 'a' }, { "canonicalize", 0, 0, 'c' }, { "direction", 1, 0, 'd' }, diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index 263ad95f3..3446938e3 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -890,7 +890,7 @@ int main(int argc, char *argv[]) int tt_flags = TT_FL_TREE; int i, c, status = EXIT_FAILURE; - struct option longopts[] = { + static const struct option longopts[] = { { "all", 0, 0, 'a' }, { "bytes", 0, 0, 'b' }, { "nodeps", 0, 0, 'd' }, diff --git a/misc-utils/namei.c b/misc-utils/namei.c index 2115fe7c9..534b451c8 100644 --- a/misc-utils/namei.c +++ b/misc-utils/namei.c @@ -439,7 +439,7 @@ usage(int rc) exit(rc); } -struct option longopts[] = +static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "mountpoints",0, 0, 'x' }, diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c index 9016f2f40..3a9bdefc1 100644 --- a/misc-utils/wipefs.c +++ b/misc-utils/wipefs.c @@ -323,7 +323,7 @@ main(int argc, char **argv) int c, all = 0, has_offset = 0, noact = 0, mode = 0; const char *fname; - struct option longopts[] = { + static const struct option longopts[] = { { "all", 0, 0, 'a' }, { "help", 0, 0, 'h' }, { "no-act", 0, 0, 'n' }, diff --git a/mount/lomount.c b/mount/lomount.c index 0bbcbc19d..84dfb1275 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -1042,7 +1042,8 @@ main(int argc, char **argv) { int ro = 0; int pfd = -1; uintmax_t off = 0, slimit = 0; - struct option longopts[] = { + + static const struct option longopts[] = { { "all", 0, 0, 'a' }, { "set-capacity", 0, 0, 'c' }, { "detach", 0, 0, 'd' }, diff --git a/schedutils/chrt.c b/schedutils/chrt.c index 489f29988..ce5d2ab71 100644 --- a/schedutils/chrt.c +++ b/schedutils/chrt.c @@ -189,7 +189,7 @@ int main(int argc, char *argv[]) struct sched_param sp; pid_t pid = -1; - struct option longopts[] = { + static const struct option longopts[] = { { "batch", 0, NULL, 'b' }, { "fifo", 0, NULL, 'f' }, { "idle", 0, NULL, 'i' }, diff --git a/schedutils/taskset.c b/schedutils/taskset.c index 39b22452e..a861a9099 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) unsigned int ncpus; size_t new_setsize, cur_setsize, cur_nbits, buflen; - struct option longopts[] = { + static const struct option longopts[] = { { "pid", 0, NULL, 'p' }, { "cpu-list", 0, NULL, 'c' }, { "help", 0, NULL, 'h' }, diff --git a/shlibs/mount/samples/mount.c b/shlibs/mount/samples/mount.c index ed3c99a9b..d7c281fcc 100644 --- a/shlibs/mount/samples/mount.c +++ b/shlibs/mount/samples/mount.c @@ -207,7 +207,7 @@ int main(int argc, char **argv) char *types = NULL; unsigned long oper = 0; - struct option longopts[] = { + static const struct option longopts[] = { { "all", 0, 0, 'a' }, { "fake", 0, 0, 'f' }, { "fork", 0, 0, 'F' }, diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c index 74e9435fe..952dbcd1d 100644 --- a/sys-utils/fallocate.c +++ b/sys-utils/fallocate.c @@ -83,7 +83,7 @@ int main(int argc, char **argv) loff_t length = -2LL; loff_t offset = 0; - struct option longopts[] = { + static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "keep-size", 0, 0, 'n' }, { "offset", 1, 0, 'o' }, diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c index 2dab23f49..6ffd1b621 100644 --- a/sys-utils/fsfreeze.c +++ b/sys-utils/fsfreeze.c @@ -57,7 +57,7 @@ int main(int argc, char **argv) char *path; struct stat sb; - struct option longopts[] = { + static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "freeze", 0, 0, 'f' }, { "unfreeze", 0, 0, 'u' }, diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index c7043a7c4..d4fb0c340 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -76,7 +76,7 @@ int main(int argc, char **argv) struct fstrim_range range; struct stat sb; - struct option longopts[] = { + static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "offset", 1, 0, 'o' }, { "length", 1, 0, 'l' }, diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 66c527dff..79c6857e2 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -925,7 +925,7 @@ int main(int argc, char *argv[]) struct lscpu_desc _desc, *desc = &_desc; int parsable = 0, c, i, hex = 0; - struct option longopts[] = { + static const struct option longopts[] = { { "help", no_argument, 0, 'h' }, { "parse", no_argument, 0, 'p' }, { "sysroot", required_argument, 0, 's' }, diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 13b6fcd09..76f743fe5 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -84,7 +84,7 @@ /* Options --3gb and --4gb are for compatibitity with an old Debian setarch implementation. */ -struct option longopts[] = +static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "verbose", 0, 0, 'v' }, diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c index 343a86ee3..7a68e2cbb 100644 --- a/sys-utils/unshare.c +++ b/sys-utils/unshare.c @@ -70,7 +70,7 @@ static void usage(int status) int main(int argc, char *argv[]) { - struct option longopts[] = { + static const struct option longopts[] = { { "help", no_argument, 0, 'h' }, { "mount", no_argument, 0, 'm' }, { "uts", no_argument, 0, 'u' }, diff --git a/term-utils/script.c b/term-utils/script.c index 788c4c4f4..f7b6d2ece 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -156,7 +156,7 @@ main(int argc, char **argv) { extern int optind; int ch; - struct option longopts[] = { + static const struct option longopts[] = { { "append", no_argument, 0, 'a' }, { "command", required_argument, 0, 'c' }, { "return", no_argument, 0, 'e' }, diff --git a/text-utils/column.c b/text-utils/column.c index 5c6db257e..fdd28640d 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -90,7 +90,7 @@ wchar_t **list; /* array of pointers to records */ wchar_t default_separator[] = { '\t', ' ', 0 }; wchar_t *separator = default_separator; /* field separator for table option */ -struct option longopts[] = +static const struct option longopts[] = { { "help", 0, 0, 'h' }, { "columns", 0, 0, 'c' }, -- cgit v1.2.3-55-g7522