* @mtd_num: MTD device number to attach
* @vid_hdr_offset: VID header offset (use defaults if %0)
* @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
+ * @disable_fm: whether disable fastmap
* @padding: reserved for future, not used, has to be zeroed
*
* This data structure is used to specify MTD device UBI has to attach and the
* eraseblocks for new bad eraseblocks, but attempts to use available
* eraseblocks (if any). The accepted range is 0-768. If 0 is given, the
* default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used.
+ *
+ * If @disable_fm is not zero, ubi doesn't create new fastmap even the module
+ * param 'fm_autoconvert' is set, and existed old fastmap will be destroyed
+ * after doing full scanning.
*/
struct ubi_attach_req {
int32_t ubi_num;
int32_t mtd_num;
int32_t vid_hdr_offset;
int16_t max_beb_per1024;
- int8_t padding[10];
+ int8_t disable_fm;
+ int8_t padding[9];
};
/*
const char *node;
const char *dev;
int max_beb_per1024;
+ bool disable_fm;
};
static struct args args = {
.node = NULL,
.dev = NULL,
.max_beb_per1024 = 0,
+ .disable_fm = false,
};
static const char doc[] = PROGRAM_NAME " version " VERSION
"-b, --max-beb-per1024 maximum expected bad block number per 1024 eraseblock.\n"
" The default value is correct for most NAND devices.\n"
" Allowed range is 0-768, 0 means the default kernel value.\n"
+"-f, --disable-fastmap don't create new fastmap and do full scanning (existed\n"
+" fastmap will be destroyed) for the given ubi device.\n"
"-h, --help print help message\n"
"-V, --version print program version";
"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"
-"\t[--dev-path=<path to device>]\n"
+"\t[--dev-path=<path to device>] [-f] [--disable-fastmap]\n"
"\t[--max-beb-per1024=<maximum bad block number per 1024 blocks>]\n"
"UBI control device defaults to " DEFAULT_CTRL_DEV " if not supplied.\n"
"Example 1: " PROGRAM_NAME " -p /dev/mtd0 - attach /dev/mtd0 to UBI\n"
{ .name = "mtdn", .has_arg = 1, .flag = NULL, .val = 'm' },
{ .name = "vid-hdr-offset", .has_arg = 1, .flag = NULL, .val = 'O' },
{ .name = "max-beb-per1024", .has_arg = 1, .flag = NULL, .val = 'b' },
+ { .name = "disable-fastmap", .has_arg = 0, .flag = NULL, .val = 'f' },
{ .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
{ .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
{ NULL, 0, NULL, 0},
while (1) {
int key, error = 0;
- key = getopt_long(argc, argv, "p:m:d:O:b:hV", long_options, NULL);
+ key = getopt_long(argc, argv, "p:m:d:O:b:fhV", long_options, NULL);
if (key == -1)
break;
break;
+ case 'f':
+ args.disable_fm = true;
+ break;
+
case 'h':
printf("%s\n\n", doc);
printf("%s\n\n", usage);
req.vid_hdr_offset = args.vidoffs;
req.mtd_dev_node = args.dev;
req.max_beb_per1024 = args.max_beb_per1024;
+ req.disable_fm = args.disable_fm;
err = ubi_attach(libubi, args.node, &req);
if (err < 0) {