]> www.infradead.org Git - mtd-utils.git/commitdiff
ubi-utils: remove depricated -d option
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 26 Jul 2009 13:17:36 +0000 (16:17 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sun, 26 Jul 2009 13:20:53 +0000 (16:20 +0300)
It's already about 2 years since the "-d" option was declared
deprecated. UBI utils have printed a warning about this. Now
it is time to kill this option completely.

The affected utilities are ubimkvol, ubirmvol and ubiupdatevol.
Their versions are also increased.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/src/ubimkvol.c
ubi-utils/src/ubirmvol.c
ubi-utils/src/ubiupdatevol.c

index b5805a42d80a5e25adf47c17cb829d5c0af3ec92..c1b577d0a193f68fa0a33c0bbd1df38e0460e8ef 100644 (file)
@@ -32,7 +32,7 @@
 #include <libubi.h>
 #include "common.h"
 
-#define PROGRAM_VERSION "1.0"
+#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubimkvol"
 
 /* The variables below are set by command line arguments */
@@ -45,9 +45,6 @@ struct args {
        const char *name;
        const char *node;
        int maxavs;
-       /* For deprecated -d option handling */
-       int devn;
-       char dev_name[256];
 };
 
 static struct args args = {
@@ -56,7 +53,6 @@ static struct args args = {
        .lebs = -1,
        .alignment = 1,
        .vol_id = UBI_VOL_NUM_AUTO,
-       .devn = -1,
 };
 
 static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
@@ -74,11 +70,7 @@ static const char *optionsstr =
 "-m, --maxavsize               set volume size to maximum available size\n"
 "-t, --type=<static|dynamic>   volume type (dynamic, static), default is dynamic\n"
 "-h, -?, --help                print help message\n"
-"-V, --version                 print program version\n\n"
-"The following is a compatibility option which is deprecated, do not use it\n"
-"-d, --devn=<devn>             UBI device number - may be used instead of the UBI\n"
-"                              device node name in which case the utility assumes\n"
-"                              that the device node is \"/dev/ubi<devn>\"";
+"-V, --version                 print program version";
 
 
 static const char *usage =
@@ -100,8 +92,6 @@ static const struct option long_options[] = {
        { .name = "help",      .has_arg = 0, .flag = NULL, .val = 'h' },
        { .name = "version",   .has_arg = 0, .flag = NULL, .val = 'V' },
        { .name = "maxavsize", .has_arg = 0, .flag = NULL, .val = 'm' },
-       /* Deprecated -d option */
-       { .name = "devn",      .has_arg = 1, .flag = NULL, .val = 'd' },
        { NULL, 0, NULL, 0},
 };
 
@@ -133,7 +123,7 @@ static int parse_opt(int argc, char * const argv[])
                int key;
                char *endp;
 
-               key = getopt_long(argc, argv, "a:n:N:s:S:t:h?Vmd:", long_options, NULL);
+               key = getopt_long(argc, argv, "a:n:N:s:S:t:h?Vm", long_options, NULL);
                if (key == -1)
                        break;
 
@@ -171,14 +161,6 @@ static int parse_opt(int argc, char * const argv[])
                                return errmsg("bad volume ID: " "\"%s\"", optarg);
                        break;
 
-               case 'd':
-                       /* Handle deprecated -d option */
-                       warnmsg("-d is depricated and will be removed, do not use it");
-                       args.devn = strtoul(optarg, &endp, 0);
-                       if (*endp != '\0' || endp == optarg || args.devn < 0)
-                               return errmsg("bad UBI device number: " "\"%s\"", optarg);
-                       break;
-
                case 'N':
                        args.name = optarg;
                        break;
@@ -207,18 +189,12 @@ static int parse_opt(int argc, char * const argv[])
                }
        }
 
-       /* Handle deprecated -d option */
-       if (args.devn != -1) {
-               sprintf(args.dev_name, "/dev/ubi%d", args.devn);
-               args.node = args.dev_name;
-       } else {
-               if (optind == argc)
-                       return errmsg("UBI device name was not specified (use -h for help)");
-               else if (optind != argc - 1)
-                       return errmsg("more then one UBI device specified (use -h for help)");
-
-               args.node = argv[optind];
-       }
+       if (optind == argc)
+               return errmsg("UBI device name was not specified (use -h for help)");
+       else if (optind != argc - 1)
+               return errmsg("more then one UBI device specified (use -h for help)");
+
+       args.node = argv[optind];
 
        if (param_sanity_check())
                return -1;
index f7a38205257bac0b1f7a873beb6b7a8c2513819a..4fbe73a27aac9311c70f7e66e2c32544b01c0557 100644 (file)
@@ -32,7 +32,7 @@
 #include <libubi.h>
 #include "common.h"
 
-#define PROGRAM_VERSION "1.0"
+#define PROGRAM_VERSION "1.1"
 #define PROGRAM_NAME    "ubirmvol"
 
 /* The variables below are set by command line arguments */
@@ -40,14 +40,10 @@ struct args {
        int vol_id;
        const char *node;
        const char *name;
-       /* For deprecated -d option handling */
-       int devn;
-       char dev_name[256];
 };
 
 static struct args args = {
        .vol_id = -1,
-       .devn = -1,
 };
 
 static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
@@ -57,11 +53,7 @@ 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\n\n"
-"The following is a compatibility option which is deprecated, do not use it\n"
-"-d, --devn=<devn>          UBI device number - may be used instead of the UBI\n"
-"                           device node name in which case the utility assumes\n"
-"                           that the device node is \"/dev/ubi<devn>\"";
+"-V, --version              print program version";
 
 static const char *usage =
 "Usage: " PROGRAM_NAME " <UBI device node file name> [-n <volume id>] [--vol_id=<volume id>]\n\n"
@@ -76,8 +68,6 @@ static const struct option long_options[] = {
        { .name = "name",    .has_arg = 1, .flag = NULL, .val = 'N' },
        { .name = "help",    .has_arg = 0, .flag = NULL, .val = 'h' },
        { .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
-       /* Deprecated -d option */
-       { .name = "devn",    .has_arg = 1, .flag = NULL, .val = 'd' },
        { NULL, 0, NULL, 0},
 };
 
@@ -102,7 +92,7 @@ static int parse_opt(int argc, char * const argv[])
                int key;
                char *endp;
 
-               key = getopt_long(argc, argv, "n:N:h?Vd:", long_options, NULL);
+               key = getopt_long(argc, argv, "n:N:h?V", long_options, NULL);
                if (key == -1)
                        break;
 
@@ -127,14 +117,6 @@ static int parse_opt(int argc, char * const argv[])
                        fprintf(stderr, "%s\n", optionsstr);
                        exit(EXIT_SUCCESS);
 
-               case 'd':
-                       /* Handle deprecated -d option */
-                       warnmsg("-d is depricated and will be removed, do not use it");
-                       args.devn = strtoul(optarg, &endp, 0);
-                       if (*endp != '\0' || endp == optarg || args.devn < 0)
-                               return errmsg("bad UBI device number: " "\"%s\"", optarg);
-                       break;
-
                case 'V':
                        fprintf(stderr, "%s\n", PROGRAM_VERSION);
                        exit(EXIT_SUCCESS);
@@ -149,22 +131,16 @@ static int parse_opt(int argc, char * const argv[])
                }
        }
 
-       /* Handle deprecated -d option */
-       if (args.devn != -1) {
-               sprintf(args.dev_name, "/dev/ubi%d", args.devn);
-               args.node = args.dev_name;
-       } else {
-               if (optind == argc) {
-                       errmsg("UBI device name was not specified (use -h for help)");
-                       return -1;
-               } else if (optind != argc - 1) {
-                       errmsg("more then one UBI device specified (use -h for help)");
-                       return -1;
-               }
-
-               args.node = argv[optind];
+       if (optind == argc) {
+               errmsg("UBI device name was not specified (use -h for help)");
+               return -1;
+       } else if (optind != argc - 1) {
+               errmsg("more then one UBI device specified (use -h for help)");
+               return -1;
        }
 
+       args.node = argv[optind];
+
        if (param_sanity_check())
                return -1;
 
index df424d202bab18cc916e371bb8156f6923e48ead..b314b58adbcc183fc6d8b2f63f6b77cdd09cb784 100644 (file)
@@ -37,7 +37,7 @@
 #include <libubi.h>
 #include "common.h"
 
-#define PROGRAM_VERSION "1.1"
+#define PROGRAM_VERSION "1.2"
 #define PROGRAM_NAME    "ubiupdatevol"
 
 struct args {
@@ -45,34 +45,25 @@ struct args {
        const char *node;
        const char *img;
        /* For deprecated -d and -B options handling */
-       int devn;
        char dev_name[256];
-       int broken_update;
        int size;
        int use_stdin;
 };
 
-static struct args args = {
-       .devn = -1,
-};
+static struct args args;
 
 static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
                         " - a tool to write data to UBI volumes.";
 
 static const char *optionsstr =
 "-t, --truncate             truncate volume (wipe it out)\n"
-"-h, --help                 print help message\n"
-"-V, --version              print program version\n\n"
 "-s, --size=<bytes>         bytes in input, if not reading from file\n"
-"The following are compatibility options which are deprecated, do not use them\n"
-"-d, --devn=<devn>          UBI device number - may be used instead of the UBI\n"
-"                           device node name in which case the utility assumes\n"
-"                           that the device node is \"/dev/ubi<devn>\"\n"
-"-B, --broken-update        broken update, this is for testing";
+"-h, --help                 print help message\n"
+"-V, --version              print program version";
 
 static const char *usage =
-"Usage: " PROGRAM_NAME " <UBI volume node file name> [-t] [-h] [-V] [--truncate] [--size=x] [--help]\n"
-"\t\t\t[--version] <image file>\n\n"
+"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";
 
@@ -81,9 +72,6 @@ struct option long_options[] = {
        { .name = "help",     .has_arg = 0, .flag = NULL, .val = 'h' },
        { .name = "version",  .has_arg = 0, .flag = NULL, .val = 'V' },
        { .name = "size",     .has_arg = 1, .flag = NULL, .val = 's' },
-       /* Deprecated -d and -B options */
-       { .name = "devn",     .has_arg = 1, .flag = NULL, .val = 'd' },
-       { .name = "broken-update", .has_arg = 1, .flag = NULL, .val = 'B' },
        { NULL, 0, NULL, 0}
 };
 
@@ -93,7 +81,7 @@ static int parse_opt(int argc, char * const argv[])
                int key;
                char *endp;
 
-               key = getopt_long(argc, argv, "n:th?Vd:s:", long_options, NULL);
+               key = getopt_long(argc, argv, "ts:h?V", long_options, NULL);
                if (key == -1)
                        break;
 
@@ -115,20 +103,6 @@ static int parse_opt(int argc, char * const argv[])
                        fprintf(stderr, "%s\n", optionsstr);
                        exit(EXIT_SUCCESS);
 
-               case 'd':
-                       /* Handle deprecated -d option */
-                       warnmsg("-d is depricated and will be removed, do not use it");
-                       args.devn = strtoul(optarg, &endp, 0);
-                       if (*endp != '\0' || endp == optarg || args.devn < 0)
-                               return errmsg("bad UBI device number: " "\"%s\"", optarg);
-                       break;
-
-               case 'B':
-                       /* Handle deprecated -B option */
-                       warnmsg("-B is depricated and will be removed, do not use it");
-                       args.broken_update = 1;
-                       break;
-
                case 'V':
                        fprintf(stderr, "%s\n", PROGRAM_VERSION);
                        exit(EXIT_SUCCESS);
@@ -142,17 +116,11 @@ static int parse_opt(int argc, char * const argv[])
                }
        }
 
-       /* Handle deprecated -d option */
-       if (args.devn != -1) {
-               sprintf(args.dev_name, "/dev/ubi%d", args.devn);
-               args.node = args.dev_name;
-       } else {
-               if (optind == argc)
-                       return errmsg("UBI device name was not specified (use -h for help)");
-               else if (optind != argc - 2 && !args.truncate)
-                       return errmsg("specify UBI device name and image file name as first 2 "
-                                     "parameters (use -h for help)");
-       }
+       if (optind == argc)
+               return errmsg("UBI device name was not specified (use -h for help)");
+       else if (optind != argc - 2 && !args.truncate)
+               return errmsg("specify UBI device name and image file name as first 2 "
+                             "parameters (use -h for help)");
 
        args.node = argv[optind];
        args.img  = argv[optind + 1];
@@ -242,10 +210,6 @@ static int update_volume(libubi_t libubi, struct ubi_vol_info *vol_info)
                goto out_free;
        }
 
-       /* A hack to handle deprecated -B option */
-       if (args.broken_update)
-               bytes = 1;
-
        fd = open(args.node, O_RDWR);
        if (fd == -1) {
                sys_errmsg("cannot open UBI volume \"%s\"", args.node);