#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 */
const char *name;
const char *node;
int maxavs;
- /* For deprecated -d option handling */
- int devn;
- char dev_name[256];
};
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
"-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 =
{ .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},
};
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;
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;
}
}
- /* 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;
#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 */
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
"-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"
{ .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},
};
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;
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);
}
}
- /* 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;
#include <libubi.h>
#include "common.h"
-#define PROGRAM_VERSION "1.1"
+#define PROGRAM_VERSION "1.2"
#define PROGRAM_NAME "ubiupdatevol"
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";
{ .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}
};
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;
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);
}
}
- /* 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];
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);