From: Karel Zak Date: Thu, 3 Mar 2011 14:00:30 +0000 (+0100) Subject: move struct option to .rodata X-Git-Tag: v2.20-rc1~491 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c7d5ae9a2338be35cfab0fd8379a9f58c4f8c36;p=thirdparty%2Futil-linux.git 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 --- diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 0f4ad398fd..267e78e437 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 86b3199e4a..fbd8ae37d5 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 b8a41085b2..07e91cac08 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 e87c70aa3c..97d09e2c4e 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 263ad95f37..3446938e35 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 2115fe7c9f..534b451c85 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 9016f2f407..3a9bdefc1a 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 0bbcbc19dc..84dfb12755 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 489f299885..ce5d2ab71a 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 39b22452ed..a861a9099a 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 ed3c99a9bb..d7c281fcc6 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 74e9435fe5..952dbcd1de 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 2dab23f496..6ffd1b6210 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 c7043a7c42..d4fb0c340d 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 66c527dff3..79c6857e20 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 13b6fcd094..76f743fe50 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 343a86ee39..7a68e2cbbb 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 788c4c4f4a..f7b6d2ece9 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 5c6db257ed..fdd28640da 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' },