Skip to contentSkip to conversation

mkfs.jffs2 failed to create repeated dev nodes from device_table.txt

PATCH In review Thomas Chou 3 participants 7 messages Dec 30, 2010 – Jan 16, 2011 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

PATCH 1/1 mkfs.jffs2: fix repeated dev nodes

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

---
 mkfs.jffs2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mkfs.jffs2.c +1 -1
index 256eec4..717e1cc 100644
@@ -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;
Signature · 1 line
1.7.3.4
#2 lore raw

Re: [PATCH] mkfs.jffs2: fix repeated dev nodes

Quoted 12 lines · 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
Quoted 6 lines

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

Pushed, thanks.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
#3 lore raw

PATCH 1/1 mkfs.jffs2: fix devtable count as mkfs.ubifs does

In reply to Thomas Chou

The counting was incorrect. Follow that of mkfs.ubifs.

---
 mkfs.jffs2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mkfs.jffs2.c +2 -2
index 717e1cc..3aab533 100644
@@ -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);
Signature · 1 line
1.7.3.4
#4 lore raw

Re: [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does

Quoted 1 line · Thomas Chou

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

#5 lore raw

Re: [PATCH] mkfs.jffs2: fix devtable count as mkfs.ubifs does

Quoted 7 lines · Mike Frysinger
Quoted 1 line · Thomas Chou

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