]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-utils: tweak const strings decls
authorMike Frysinger <vapier@gentoo.org>
Sun, 26 Sep 2010 21:41:55 +0000 (17:41 -0400)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 27 Sep 2010 06:33:43 +0000 (09:33 +0300)
Shrink the data size a little by declaring addresses of constant strings
instead of pointers to it.

Also slip in static & const on long_options missing them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
12 files changed:
ubi-utils/src/mtdinfo.c
ubi-utils/src/ubiattach.c
ubi-utils/src/ubicrc32.c
ubi-utils/src/ubidetach.c
ubi-utils/src/ubiformat.c
ubi-utils/src/ubimkvol.c
ubi-utils/src/ubinfo.c
ubi-utils/src/ubinize.c
ubi-utils/src/ubirename.c
ubi-utils/src/ubirmvol.c
ubi-utils/src/ubirsvol.c
ubi-utils/src/ubiupdatevol.c

index a2d7547b8d763564bc3d58309fd0bbad5f7d98a3..54a039a19c2d1a928ad1cb4903d0b9f2ad0db526 100644 (file)
@@ -51,10 +51,10 @@ static struct args args = {
        .node = NULL,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to print MTD information.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-m, --mtdn=<MTD device number>  MTD device number to get information about\n"
 "-u, --ubi-info                  print what would UBI layout be if it was put\n"
 "                                on this MTD device\n"
@@ -62,7 +62,7 @@ static const char *optionsstr =
 "-h, --help                      print help message\n"
 "-V, --version                   print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage 1: " PROGRAM_NAME " [-m <MTD device number>] [-u] [-h] [-V] [--mtdn <MTD device number>]\n"
 "\t\t[--ubi-info] [--help] [--version]\n"
 "Usage 2: " PROGRAM_NAME " <MTD device node file name> [-u] [-h] [-V] [--ubi-info] [--help]\n"
index 51a0cfb0d2ee03e88cc6f7761e1cee4f088db893..d2f191bf151c10f160e7b1f70232991e8ca53337 100644 (file)
@@ -53,10 +53,10 @@ static struct args args = {
        .dev = NULL,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to attach MTD device to UBI.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-d, --devn=<number>   the number to assign to the newly created UBI device\n"
 "                      (assigned automatically if this is not specified)\n"
 "-p, --dev-path=<path> path to MTD device node to attach\n"
@@ -67,7 +67,7 @@ static const char *optionsstr =
 "-h, --help            print help message\n"
 "-V, --version         print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " [<UBI control device node file name>]\n"
 "\t[-m <MTD device number>] [-d <UBI device number>] [-p <path to device>]\n"
 "\t[--mtdn=<MTD device number>] [--devn=<UBI device number>]\n"
index ec108584a40e5f058fddbf6a158b6ca7ff7555e6..a09f053a428ed7e846e19dd4b496dc160c95a525 100644 (file)
 
 #define BUFSIZE 4096
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to calculate CRC32 with UBI start value (0xFFFFFFFF)";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-h, --help                    print help message\n"
 "-V, --version                 print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <file to calculate CRC32 for> [-h] [--help]";
 
 static const struct option long_options[] = {
index 59e478bf3380feb87de640e2ff93c6d3949d86e2..dfd64851c2ec7411e1cdba5452ac4f8c2618a83b 100644 (file)
@@ -50,17 +50,17 @@ static struct args args = {
        .dev = NULL,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
 " - tool to remove UBI devices (detach MTD devices from UBI)";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-d, --devn=<UBI device number>  UBI device number to delete\n"
 "-p, --dev-path=<path to device> or alternatively, MTD device node path to detach\n"
 "-m, --mtdn=<MTD device number>  or alternatively, MTD device number to detach\n"
 "-h, --help                      print help message\n"
 "-V, --version                   print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " [<UBI control device node file name>]\n"
 "\t[-d <UBI device number>] [-m <MTD device number>] [-p <path to device>]\n"
 "\t[--devn=<UBI device number>] [--mtdn=<MTD device number>]\n"
index 7cea8a95b005f07f0b0407c105a250ce2b33bbe8..098da7d251edbde66e13fd0e79bff2c17ca6696e 100644 (file)
@@ -72,10 +72,10 @@ static struct args args =
        .ubi_ver   = 1,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                " - a tool to format MTD devices and flash UBI images";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-s, --sub-page-size=<bytes>  minimum input/output unit used for UBI\n"
 "                             headers, e.g. sub-page size in case of NAND\n"
 "                             flash (equivalent to the minimum input/output\n"
@@ -101,7 +101,7 @@ static const char *optionsstr =
 "-h, -?, --help               print help message\n"
 "-V, --version                print program version\n";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <MTD device node file name> [-s <bytes>] [-O <offs>] [-n]\n"
 "\t\t\t[-f <file>] [-S <bytes>] [-e <value>] [-x <num>] [-y] [-q] [-v] [-h] [-v]\n"
 "\t\t\t[--sub-page-size=<bytes>] [--vid-hdr-offset=<offs>] [--no-volume-table]\n"
index cc8cd558348140763c12fe7ee63267c718f68028..f6e498f7099bc8c58a2f08df916f16a825b24668 100644 (file)
@@ -56,10 +56,10 @@ static struct args args = {
        .vol_id = UBI_VOL_NUM_AUTO,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to create UBI volumes.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-a, --alignment=<alignment>   volume alignment (default is 1)\n"
 "-n, --vol_id=<volume ID>      UBI volume ID, if not specified, the volume ID\n"
 "                              will be assigned automatically\n"
@@ -74,7 +74,7 @@ static const char *optionsstr =
 "-V, --version                 print program version";
 
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <UBI device node file name> [-h] [-a <alignment>] [-n <volume ID>] [-N <name>]\n"
 "\t\t\t[-s <bytes>] [-S <LEBs>] [-t <static|dynamic>] [-V] [-m]\n"
 "\t\t\t[--alignment=<alignment>][--vol_id=<volume ID>] [--name=<name>]\n"
index 44f6fb025b433957c86e8f3e9108418656619340..3171e8a0dd39627956e23ae8694ca552402f9b2e 100644 (file)
@@ -51,10 +51,10 @@ static struct args args = {
        .vol_name = NULL,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to print UBI information.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-d, --devn=<UBI device number>  UBI device number to get information about\n"
 "-n, --vol_id=<volume ID>        ID of UBI volume to print information about\n"
 "-N, --name=<volume name>        name of UBI volume to print information about\n"
@@ -64,7 +64,7 @@ static const char *optionsstr =
 "-h, --help                      print help message\n"
 "-V, --version                   print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage 1: " PROGRAM_NAME " [-d <UBI device number>] [-n <volume ID> | -N <volume name>] [-a] [-h] [-V]\n"
 "\t\t[--vol_id=<volume ID> | --name <volume name>] [--devn <UBI device number>] [--all] [--help] [--version]\n"
 "Usage 2: " PROGRAM_NAME " <UBI device node file name> [-a] [-h] [-V] [--all] [--help] [--version]\n"
index 5cee5aa62f191cf59f04c092685fc338c6319a1d..499169139c65c11d61528581b8a3ca7969f2a5cd 100644 (file)
@@ -39,7 +39,7 @@
 #include "common.h"
 #include "ubiutils-common.h"
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
 " - a tool to generate UBI images. An UBI image may contain one or more UBI "
 "volumes which have to be defined in the input configuration ini-file. The "
 "ini file defines all the UBI volumes - their characteristics and the and the "
@@ -48,7 +48,7 @@ static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
 "the command-line options. Note, if not sure about some of the command-line "
 "parameters, do not specify them and let the utility to use default values.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-o, --output=<file name>     output file name\n"
 "-p, --peb-size=<bytes>       size of the physical eraseblock of the flash\n"
 "                             this UBI image is created for in bytes,\n"
@@ -74,7 +74,7 @@ static const char *optionsstr =
 "-h, --help                   print help message\n"
 "-V, --version                print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " [-o filename] [-p <bytes>] [-m <bytes>] [-s <bytes>] [-O <num>] [-e <num>]\n"
 "\t\t[-x <num>] [-Q <num>] [-v] [-h] [-V] [--output=<filename>] [--peb-size=<bytes>]\n"
 "\t\t[--min-io-size=<bytes>] [--sub-page-size=<bytes>] [--vid-hdr-offset=<num>]\n"
@@ -83,7 +83,7 @@ static const char *usage =
 "Example: " PROGRAM_NAME " -o ubi.img -p 16KiB -m 512 -s 256 cfg.ini - create UBI image\n"
 "         'ubi.img' as described by configuration file 'cfg.ini'";
 
-static const char *ini_doc = "INI-file format.\n"
+static const char ini_doc[] = "INI-file format.\n"
 "The input configuration ini-file describes all the volumes which have to\n"
 "be included to the output UBI image. Each volume is described in its own\n"
 "section which may be named arbitrarily. The section consists on\n"
@@ -116,7 +116,7 @@ static const char *ini_doc = "INI-file format.\n"
 "    put all the volumes which are described by these section to the output\n"
 "    UBI image file.";
 
-struct option long_options[] = {
+static const struct option long_options[] = {
        { .name = "output",         .has_arg = 1, .flag = NULL, .val = 'o' },
        { .name = "peb-size",       .has_arg = 1, .flag = NULL, .val = 'p' },
        { .name = "min-io-size",    .has_arg = 1, .flag = NULL, .val = 'm' },
index 295bfc7ae1236b999113751a2a0c199519ea9db3..070e32ed1aa60d11365ce5da0ff70e650ed9d151 100644 (file)
@@ -33,7 +33,7 @@
 #include <libubi.h>
 #include "common.h"
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <UBI device node file name> [<old name> <new name>|...]\n\n"
 "Example: " PROGRAM_NAME "/dev/ubi0 A B C D - rename volume A to B, and C to D\n\n"
 "This utility allows re-naming several volumes in one go atomically.\n"
index 334bb3830d211524c81ce2ecf90f69e0f9a45675..9e55b02279f8226f4b5693329c004aedc4f4d340 100644 (file)
@@ -46,16 +46,16 @@ static struct args args = {
        .vol_id = -1,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                                 " - a tool to remove UBI volumes.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-n, --vol_id=<volume id>   volume ID to remove\n"
 "-N, --name=<volume name>   volume name to remove\n"
 "-h, -?, --help             print help message\n"
 "-V, --version              print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <UBI device node file name> [-n <volume id>] [--vol_id=<volume id>]\n\n"
 "         [-N <volume name>] [--name=<volume name>] [-h] [--help]\n\n"
 "Example: " PROGRAM_NAME "/dev/ubi0 -n 1 - remove UBI volume 1 from UBI device corresponding\n"
index a622ea6200612a96763665c1016c21dba46864e4..20a1d331493068a6fe15b94fd1c108d477d708db 100644 (file)
@@ -51,10 +51,10 @@ static struct args args = {
        .lebs = -1,
 };
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                                 " - a tool to resize UBI volumes.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-n, --vol_id=<volume id>   volume ID to resize\n"
 "-N, --name=<volume name>   volume name to resize\n"
 "-s, --size=<bytes>         volume size volume size in bytes, kilobytes (KiB)\n"
@@ -65,7 +65,7 @@ static const char *optionsstr =
 "-V, --version              print program version";
 
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <UBI device node file name> [-n <volume id>] [--vol_id=<volume id>]\n\n"
 "         [-N <volume name>] [--name=<volume name>] [-s <bytes>] [-S <LEBs>] [-h] [--help]\n\n"
 "Example: " PROGRAM_NAME " /dev/ubi0 -n 1 -s 1MiB resize UBI volume 1 to 1 MiB on\n"
index 4521138194adfab1104daf81fd44d2347d5f2dcf..4bf41230c07cf569d1e0ce41ac0b16f396ff998f 100644 (file)
@@ -52,22 +52,22 @@ struct args {
 
 static struct args args;
 
-static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
+static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to write data to UBI volumes.";
 
-static const char *optionsstr =
+static const char optionsstr[] =
 "-t, --truncate             truncate volume (wipe it out)\n"
 "-s, --size=<bytes>         bytes in input, if not reading from file\n"
 "-h, --help                 print help message\n"
 "-V, --version              print program version";
 
-static const char *usage =
+static const char usage[] =
 "Usage: " PROGRAM_NAME " <UBI volume node file name> [-t] [-s <size>] [-h] [-V] [--truncate]\n"
 "\t\t\t[--size=<size>] [--help] [--version] <image file>\n\n"
 "Example 1: " PROGRAM_NAME " /dev/ubi0_1 fs.img - write file \"fs.img\" to UBI volume /dev/ubi0_1\n"
 "Example 2: " PROGRAM_NAME " /dev/ubi0_1 -t - wipe out UBI volume /dev/ubi0_1";
 
-struct option long_options[] = {
+static const struct option long_options[] = {
        { .name = "truncate", .has_arg = 0, .flag = NULL, .val = 't' },
        { .name = "help",     .has_arg = 0, .flag = NULL, .val = 'h' },
        { .name = "version",  .has_arg = 0, .flag = NULL, .val = 'V' },