summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkfs.jffs2.c1
-rw-r--r--mtd_debug.c2
-rw-r--r--nandtest.c2
-rw-r--r--ubi-utils/src/ubinfo.c34
4 files changed, 34 insertions, 5 deletions
diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 23a8cf8..64cafb6 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -1468,6 +1468,7 @@ static struct option long_options[] = {
{"devtable", 1, NULL, 'D'},
{"compression-mode", 1, NULL, 'm'},
{"disable-compressor", 1, NULL, 'x'},
+ {"enable-compressor", 1, NULL, 'X'},
{"test-compression", 0, NULL, 't'},
{"compressor-priority", 1, NULL, 'y'},
{"incremental", 1, NULL, 'i'},
diff --git a/mtd_debug.c b/mtd_debug.c
index 85d48e9..49a4567 100644
--- a/mtd_debug.c
+++ b/mtd_debug.c
@@ -110,7 +110,7 @@ int flash_to_file (int fd,u_int32_t offset,size_t len,const char *filename)
perror ("lseek()");
goto err0;
}
- outfd = creat (filename,O_WRONLY);
+ outfd = creat (filename,0666);
if (outfd < 0)
{
perror ("creat()");
diff --git a/nandtest.c b/nandtest.c
index 7613a52..e31e28a 100644
--- a/nandtest.c
+++ b/nandtest.c
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
printf("\r%08x: reading... ", (unsigned)test_ofs);
fflush(stdout);
- len = pread(fd, rbuf, meminfo.erasesize, test_ofs);
+ len = pread(fd, kbuf, meminfo.erasesize, test_ofs);
if (len < meminfo.erasesize) {
printf("\n");
if (len)
diff --git a/ubi-utils/src/ubinfo.c b/ubi-utils/src/ubinfo.c
index 8c5a1a9..8f84382 100644
--- a/ubi-utils/src/ubinfo.c
+++ b/ubi-utils/src/ubinfo.c
@@ -39,6 +39,7 @@ struct args {
int vol_id;
int all;
const char *node;
+ const char *vol_name;
};
static struct args args = {
@@ -46,6 +47,7 @@ static struct args args = {
.devn = -1,
.all = 0,
.node = NULL,
+ .vol_name = NULL,
};
static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
@@ -54,6 +56,7 @@ static const char *doc = PROGRAM_NAME " version " PROGRAM_VERSION
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"
"-a, --all print information about all devices and volumes,\n"
" or about all volumes if the UBI device was\n"
" specified\n"
@@ -61,8 +64,8 @@ static const char *optionsstr =
"-V, --version print program version";
static const char *usage =
-"Usage 1: " PROGRAM_NAME " [-d <UBI device number>] [-n <volume ID>] [-a] [-h] [-V] [--vol_id=<volume ID>]\n"
-"\t\t[--devn <UBI device number>] [--all] [--help] [--version]\n"
+"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"
"Usage 3: " PROGRAM_NAME " <UBI volume node file name> [-h] [-V] [--help] [--version]\n\n"
"Example 1: " PROGRAM_NAME " - (no arguments) print general UBI information\n"
@@ -75,6 +78,7 @@ static const char *usage =
static const struct option long_options[] = {
{ .name = "devn", .has_arg = 1, .flag = NULL, .val = 'd' },
{ .name = "vol_id", .has_arg = 1, .flag = NULL, .val = 'n' },
+ { .name = "name", .has_arg = 1, .flag = NULL, .val = 'N' },
{ .name = "all", .has_arg = 0, .flag = NULL, .val = 'a' },
{ .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
{ .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
@@ -87,7 +91,7 @@ static int parse_opt(int argc, char * const argv[])
int key;
char *endp;
- key = getopt_long(argc, argv, "an:d:hV", long_options, NULL);
+ key = getopt_long(argc, argv, "an:N:d:hV", long_options, NULL);
if (key == -1)
break;
@@ -102,6 +106,10 @@ static int parse_opt(int argc, char * const argv[])
return errmsg("bad volume ID: " "\"%s\"", optarg);
break;
+ case 'N':
+ args.vol_name = optarg;
+ break;
+
case 'd':
args.devn = strtoul(optarg, &endp, 0);
if (*endp != '\0' || endp == optarg || args.devn < 0)
@@ -174,6 +182,20 @@ static int translate_dev(libubi_t libubi, const char *node)
return 0;
}
+static int get_vol_id_by_name(libubi_t libubi, int dev_num, const char *name)
+{
+ int err;
+ struct ubi_vol_info vol_info;
+
+ err = ubi_get_vol_info1_nm(libubi, dev_num, name, &vol_info);
+ if (err)
+ return sys_errmsg("cannot get information about volume \"%s\" on ubi%d\n", name, dev_num);
+
+ args.vol_id = vol_info.vol_id;
+
+ return 0;
+}
+
static int print_vol_info(libubi_t libubi, int dev_num, int vol_id)
{
int err;
@@ -377,6 +399,12 @@ int main(int argc, char * const argv[])
goto out_libubi;
}
+ if (args.vol_name) {
+ err = get_vol_id_by_name(libubi, args.devn, args.vol_name);
+ if (err)
+ goto out_libubi;
+ }
+
if (args.vol_id != -1 && args.devn == -1) {
errmsg("volume ID is specified, but UBI device number is not "
"(use -h for help)\n");