Patchwork mkfs.jffs2: fix devtable count as mkfs.ubifs does

login
register
mail settings
Submitter Thomas Chou
Date Dec. 31, 2010, 3:16 a.m.
Message ID <1293765366-27147-1-git-send-email-thomas@wytron.com.tw>
Download mbox | patch
Permalink /patch/77045/
State Accepted
Commit 4d91ded71d78c5c651482f0e4ae082b73edba0c1
Headers show

Comments

Thomas Chou - Dec. 31, 2010, 3:16 a.m.
The counting was incorrect. Follow that of mkfs.ubifs.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 mkfs.jffs2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Mike Frysinger - Dec. 31, 2010, 5:08 a.m.
On Thu, Dec 30, 2010 at 22:16, Thomas Chou wrote:
> The counting was incorrect. Follow that of mkfs.ubifs.

hmm, sounds like we should rip the stuff out of both and put into
lib/devtable.c.  feel up to the challenge ?
-mike
Thomas Chou - Dec. 31, 2010, 5:54 a.m.
On 12/31/2010 01:08 PM, Mike Frysinger wrote:
> On Thu, Dec 30, 2010 at 22:16, Thomas Chou wrote:
>> The counting was incorrect. Follow that of mkfs.ubifs.
>
> hmm, sounds like we should rip the stuff out of both and put into
> lib/devtable.c.  feel up to the challenge ?
> -mike
>
Sound great. But I am lost in the maze of kernel v2.6.37-rc and not 
ready to come up with this right now.

- Thomas
Artem Bityutskiy - Jan. 16, 2011, 6:51 p.m.
On Fri, 2010-12-31 at 11:16 +0800, Thomas Chou wrote:
> The counting was incorrect. Follow that of mkfs.ubifs.
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Pushed to mtd-utils git tree, thanks.

Patch

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 717e1cc..3aab533 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -497,10 +497,10 @@  static int interpret_table_entry(struct filesystem_entry *root, char *line)
 					unsigned long i;
 					char *dname, *hpath;
 
-					for (i = start; i < count; i++) {
+					for (i = start; i < (start + count); i++) {
 						xasprintf(&dname, "%s%lu", name, i);
 						xasprintf(&hpath, "%s/%s%lu", rootdir, name, i);
-						rdev = makedev(major, minor + (i * increment - start));
+						rdev = makedev(major, minor + (i - start) * increment);
 						add_host_filesystem_entry(dname, hpath, uid, gid,
 								mode, rdev, parent);
 						free(dname);