linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Neukomm <Neukomm@vtxmail.ch>
To: linux-mtd@lists.infradead.org
Subject: patch for mkfs.ubifs devtable.c increment in dev_table is wrongly interpreted
Date: Sun, 02 Aug 2009 16:04:35 +0200	[thread overview]
Message-ID: <4A759CF3.2010908@vtxmail.ch> (raw)

patch for mkfs.ubifs devtable.c increment in dev_table is wrongly 
interpreted

with the device table one can add /dev entries to the root file system 
image.
The device table file contains among others the fields minor, start, 
increment and count.
If there is an entry with minor=0 start=0 increment =32 and count=4 the 
mkfs.ubifs makes
128 device entries, with minor numbers from 0 to 127
The correct version makes 4 entries with minor number 0,32,64,96.

/dev/mtd c 640 0 0 90 0 0  2 7
This gives 14 devices /dev/mtdXX instead of  7 devices.
Due to this error mtd_debug info /dev/mtd3 delivers the information of 
/dev/mtd1 instead of. 

diff --git a/mkfs.ubifs/devtable.c b/mkfs.ubifs/devtable.c
index 236a6e7..e2d96dc 100644
--- a/mkfs.ubifs/devtable.c
+++ b/mkfs.ubifs/devtable.c
@@ -248,7 +248,7 @@ static int interpret_table_entry(const char *line)
                        goto out_free;
                }
        } else {
-               int i, num = start + increment * count, len = 
strlen(name) + 20;
+               int i, num = start + count, len = strlen(name) + 20;
                char *nm;

                for (i = start; i < num; i++) {
@@ -262,7 +262,7 @@ static int interpret_table_entry(const char *line)
                        nh_elt->mode = mode;
                        nh_elt->uid = uid;
                        nh_elt->gid = gid;
-                       nh_elt->dev = makedev(major, minor + i - start);
+                       nh_elt->dev = makedev(major, minor + (i - 
start)*increment);

                        nm = malloc(len);
                        if (!nm) {

             reply	other threads:[~2009-08-02 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02 14:04 Daniel Neukomm [this message]
2009-08-03  3:48 ` patch for mkfs.ubifs devtable.c increment in dev_table is wrongly interpreted Mike Frysinger
2009-08-10  7:36 ` Artem Bityutskiy
2009-08-11  6:45 ` Artem Bityutskiy
2009-08-11 11:21   ` Artem Bityutskiy
2009-08-12 18:27     ` Daniel Neukomm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A759CF3.2010908@vtxmail.ch \
    --to=neukomm@vtxmail.ch \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).