summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-23 18:13:04 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-04-23 18:13:04 +0300
commitc31c4862453dc0193bf2083d1a4435283ae455a0 (patch)
treea6e3947a39ebd7370cc3f57287109cd47dc360d3
parentd88fa71b8372cbbea0bc6d241a50b1e193fe112d (diff)
ubi-utils: make sure only one volume is auto-resize
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--ubi-utils/new-utils/src/ubinize.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ubi-utils/new-utils/src/ubinize.c b/ubi-utils/new-utils/src/ubinize.c
index 8ba8869..1350d41 100644
--- a/ubi-utils/new-utils/src/ubinize.c
+++ b/ubi-utils/new-utils/src/ubinize.c
@@ -418,7 +418,7 @@ static void init_vol_info(const struct ubigen_info *ui,
int main(int argc, char * const argv[])
{
- int err = -1, sects, i, volumes;
+ int err = -1, sects, i, volumes, autoresize_was_already = 0;
struct ubigen_info ui;
struct ubi_vtbl_record *vtbl;
off_t seek;
@@ -502,6 +502,14 @@ int main(int argc, char * const argv[])
verbose(args.verbose, "adding volume %d", vi.id);
+ /* Make sure only one volume has auto-resize flag */
+ if (vi.flags & UBI_VTBL_AUTORESIZE_FLG) {
+ if (autoresize_was_already)
+ return errmsg("only one volume is allowed "
+ "to have auto-resize flag");
+ autoresize_was_already = 1;
+ }
+
err = ubigen_add_volume(&ui, &vi, vtbl);
if (err) {
errmsg("cannot add volume for section \"%s\"", sname);