linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* mkfs.jffs2 failed to create repeated dev nodes from device_table.txt
@ 2010-12-30  7:31 Thomas Chou
  2010-12-31  1:45 ` [PATCH] mkfs.jffs2: fix repeated dev nodes Thomas Chou
  2010-12-31  3:16 ` [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does Thomas Chou
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Chou @ 2010-12-30  7:31 UTC (permalink / raw)
  To: linux-mtd

Hi experts,

I found an issue with the latest git head. The mkfs.jffs2 failed to 
create repeated dev nodes from the device_table.txt in the git tree, 
such as hda1-15, tty0-5.

It happened with this pattern,

/dev/tty	c	666	0	0	5	0	0	0	-
/dev/tty	c	666	0	0	4	0	0	1	6

# IDE Devices
/dev/hda	b	640	0	0	3	0	0	0	-
/dev/hda	b	640	0	0	3	1	1	1	15
/dev/hdb	b	640	0	0	3	64	0	0	-
/dev/hdb	b	640	0	0	3	65	1	1	15


Using jffs2dump -c, I could see only hda,

          Dirent     node at 0x004d3970, totlen 0x0000002b, #pino    14, 
version   274, #ino       276, nsize        3, name hda
          Inode      node at 0x004d399c, totlen 0x00000046, #ino    276, 
version     1, isize        0, csize        2, dsize        2, offset 
      0

Best regards,
Thomas

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] mkfs.jffs2: fix repeated dev nodes
  2010-12-30  7:31 mkfs.jffs2 failed to create repeated dev nodes from device_table.txt Thomas Chou
@ 2010-12-31  1:45 ` Thomas Chou
  2011-01-16 18:51   ` Artem Bityutskiy
  2010-12-31  3:16 ` [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does Thomas Chou
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Chou @ 2010-12-31  1:45 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, Mike Frysinger, Thomas Chou

Fix the repeated nodes with the same primary name in device_table.txt.
They were not generated correctly.

/dev/tty    c    666    0    0    5    0    0    0    -
/dev/tty    c    666    0    0    4    0    0    1    6

# IDE Devices
/dev/hda    b    640    0    0    3    0    0    0    -
/dev/hda    b    640    0    0    3    1    1    1    15
/dev/hdb    b    640    0    0    3    64    0    0    -
/dev/hdb    b    640    0    0    3    65    1    1    15

Only created,
/dev/tty
/dev/hda
/dev/hdb

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 mkfs.jffs2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c
index 256eec4..717e1cc 100644
--- a/mkfs.jffs2.c
+++ b/mkfs.jffs2.c
@@ -457,7 +457,7 @@ static int interpret_table_entry(struct filesystem_entry *root, char *line)
 			errmsg_die("Unsupported file type '%c'", type);
 	}
 	entry = find_filesystem_entry(root, name, mode);
-	if (entry) {
+	if (entry && !(count > 0 && (type == 'c' || type == 'b'))) {
 		/* Ok, we just need to fixup the existing entry
 		 * and we will be all done... */
 		entry->sb.st_uid = uid;
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does
  2010-12-30  7:31 mkfs.jffs2 failed to create repeated dev nodes from device_table.txt Thomas Chou
  2010-12-31  1:45 ` [PATCH] mkfs.jffs2: fix repeated dev nodes Thomas Chou
@ 2010-12-31  3:16 ` Thomas Chou
  2010-12-31  5:08   ` Mike Frysinger
  2011-01-16 18:51   ` Artem Bityutskiy
  1 sibling, 2 replies; 7+ messages in thread
From: Thomas Chou @ 2010-12-31  3:16 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd, Mike Frysinger, Thomas Chou

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(-)

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);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does
  2010-12-31  3:16 ` [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does Thomas Chou
@ 2010-12-31  5:08   ` Mike Frysinger
  2010-12-31  5:54     ` Thomas Chou
  2011-01-16 18:51   ` Artem Bityutskiy
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2010-12-31  5:08 UTC (permalink / raw)
  To: Thomas Chou; +Cc: linux-mtd, Artem Bityutskiy

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does
  2010-12-31  5:08   ` Mike Frysinger
@ 2010-12-31  5:54     ` Thomas Chou
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Chou @ 2010-12-31  5:54 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-mtd, Artem Bityutskiy

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does
  2010-12-31  3:16 ` [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does Thomas Chou
  2010-12-31  5:08   ` Mike Frysinger
@ 2011-01-16 18:51   ` Artem Bityutskiy
  1 sibling, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2011-01-16 18:51 UTC (permalink / raw)
  To: Thomas Chou; +Cc: linux-mtd, Mike Frysinger

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.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] mkfs.jffs2: fix repeated dev nodes
  2010-12-31  1:45 ` [PATCH] mkfs.jffs2: fix repeated dev nodes Thomas Chou
@ 2011-01-16 18:51   ` Artem Bityutskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2011-01-16 18:51 UTC (permalink / raw)
  To: Thomas Chou; +Cc: linux-mtd, Mike Frysinger

On Fri, 2010-12-31 at 09:45 +0800, Thomas Chou wrote:
> Fix the repeated nodes with the same primary name in device_table.txt.
> They were not generated correctly.
> 
> /dev/tty    c    666    0    0    5    0    0    0    -
> /dev/tty    c    666    0    0    4    0    0    1    6
> 
> # IDE Devices
> /dev/hda    b    640    0    0    3    0    0    0    -
> /dev/hda    b    640    0    0    3    1    1    1    15
> /dev/hdb    b    640    0    0    3    64    0    0    -
> /dev/hdb    b    640    0    0    3    65    1    1    15
> 
> Only created,
> /dev/tty
> /dev/hda
> /dev/hdb
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Pushed, thanks.

-- 
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-16 18:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-30  7:31 mkfs.jffs2 failed to create repeated dev nodes from device_table.txt Thomas Chou
2010-12-31  1:45 ` [PATCH] mkfs.jffs2: fix repeated dev nodes Thomas Chou
2011-01-16 18:51   ` Artem Bityutskiy
2010-12-31  3:16 ` [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does Thomas Chou
2010-12-31  5:08   ` Mike Frysinger
2010-12-31  5:54     ` Thomas Chou
2011-01-16 18:51   ` Artem Bityutskiy

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).