aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/src
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-26 16:17:36 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-26 16:20:53 +0300
commite34c0810a80744bcece8b6a4947f70786cdcb005 (patch)
tree98a424f9a662facab12ede1b7cfc746745a7e7f0 /ubi-utils/src
parent8463b874cd3ddc4932cc3674730202c097ebe837 (diff)
ubi-utils: remove depricated -d option
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>
Diffstat (limited to 'ubi-utils/src')
-rw-r--r--ubi-utils/src/ubimkvol.c42
-rw-r--r--ubi-utils/src/ubirmvol.c46
-rw-r--r--ubi-utils/src/ubiupdatevol.c60
3 files changed, 32 insertions, 116 deletions
diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c
index b5805a4..c1b577d 100644
--- a/ubi-utils/src/ubimkvol.c
+++ b/ubi-utils/src/ubimkvol.c
@@ -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;
diff --git a/ubi-utils/src/ubirmvol.c b/ubi-utils/src/ubirmvol.c
index f7a3820..4fbe73a 100644
--- a/ubi-utils/src/ubirmvol.c
+++ b/ubi-utils/src/ubirmvol.c
@@ -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;
diff --git a/ubi-utils/src/ubiupdatevol.c b/ubi-utils/src/ubiupdatevol.c
index df424d2..b314b58 100644
--- a/ubi-utils/src/ubiupdatevol.c
+++ b/ubi-utils/src/ubiupdatevol.c
@@ -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);