]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
move struct option to .rodata
authorKarel Zak <kzak@redhat.com>
Thu, 3 Mar 2011 14:00:30 +0000 (15:00 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Mar 2011 14:00:30 +0000 (15:00 +0100)
It does not make sense to have writable large arrays of "struct
option" on the stack.

Signed-off-by: Karel Zak <kzak@redhat.com>
19 files changed:
disk-utils/mkswap.c
disk-utils/swaplabel.c
lib/cpuset.c
misc-utils/findmnt.c
misc-utils/lsblk.c
misc-utils/namei.c
misc-utils/wipefs.c
mount/lomount.c
schedutils/chrt.c
schedutils/taskset.c
shlibs/mount/samples/mount.c
sys-utils/fallocate.c
sys-utils/fsfreeze.c
sys-utils/fstrim.c
sys-utils/lscpu.c
sys-utils/setarch.c
sys-utils/unshare.c
term-utils/script.c
text-utils/column.c

index 0f4ad398fdb7556554752da791bd68ea313adc8c..267e78e43788729dd5f823ce39266bcd5f246c70 100644 (file)
@@ -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' },
index 86b3199e4ac4ddcc9127d477601c9bfbd849ee8f..fbd8ae37d5fa2d4f6b8432c27d3bd07672c5361c 100644 (file)
@@ -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' },
index b8a41085b2ea6af59a0ee84bf6d6403db104f5a5..07e91cac0831b2f757b4c206adc6a673b4849d52 100644 (file)
@@ -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' },
index e87c70aa3cd9873f5bd0aedb5b538f417532961b..97d09e2c4e3b7aa44216da28583fc7688c98a0b1 100644 (file)
@@ -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' },
index 263ad95f37bb15d0f0a87ce6ece2333cf81a01f1..3446938e3590df8fca55eff71548b8695ecf884f 100644 (file)
@@ -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' },
index 2115fe7c9fc937caf554ddc92e910f1c6c7bd6e7..534b451c853ef08ff1ff0514593365f905b7f477 100644 (file)
@@ -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' },
index 9016f2f40713a27225b38aebb00e5a696b319385..3a9bdefc1ab91df35ac05336d9c5b963f7523982 100644 (file)
@@ -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' },
index 0bbcbc19dc93c4ac932d45e6f93aba7cbe4863f3..84dfb127559f9cfb9f08ef34b4f01b2888253d39 100644 (file)
@@ -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' },
index 489f299885f2bac058c42408e061ec1f5bb36356..ce5d2ab71a81bf89c641d71a169291ed18d26df8 100644 (file)
@@ -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' },
index 39b22452ed498dd768c7066f0a5a4f83eb3f4406..a861a9099a7e89a77c7c358b7b41f516e0f95622 100644 (file)
@@ -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' },
index ed3c99a9bbc85d0354e6ab66fa55dd5325b481bd..d7c281fcc6ce4bc91e3154002595c11587333762 100644 (file)
@@ -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' },
index 74e9435fe5a497d130077cda5daa08d5669852fd..952dbcd1de6850a2caeab402c0904f366920658c 100644 (file)
@@ -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' },
index 2dab23f49635fb956c7b769de00b9a1cc69f6e99..6ffd1b6210e51b3fb3c5746522e0c4a6744c3d8e 100644 (file)
@@ -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' },
index c7043a7c4293c1e7c147ba47e556fe3d9372e28e..d4fb0c340dd57a37a15f1e24f79540d9efd6e2e7 100644 (file)
@@ -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' },
index 66c527dff3a0863847ff493421fdeb743b382c6e..79c6857e204a94c594bc91a501d87bc17364e737 100644 (file)
@@ -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' },
index 13b6fcd09428d28180bc8beabc4b0dcd632edaef..76f743fe5098623f519c169c667aaaa033300064 100644 (file)
@@ -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' },
index 343a86ee39c508604841d254a73ecad9884ec6e3..7a68e2cbbb8ff92901d52b6fabde795e049a8b8e 100644 (file)
@@ -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' },
index 788c4c4f4a0f99d5d3aefe2babbd942e9c9fa54b..f7b6d2ece9627540cb32e88b19854d777a13ac34 100644 (file)
@@ -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' },
index 5c6db257ed66620551259e22c629a27a09c22c97..fdd28640daf3fa9f7d4e5fd4f26cb5c600bfb95b 100644 (file)
@@ -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' },