Skip to contentSkip to conversation

fix type mismatch in jffs.

PATCH In review Stephen Hemminger 6 participants 8 messages Sep 9, 2003 – Sep 11, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix type mismatch in jffs.

On 2.6.0-test5 jffs generates a warning about type mismatch because it casting a short to a pointer. Look like an obvious typo.

Builds clean, not tested on real hardware.

fs/jffs/inode-v23.c +1 -1
diff -Nru a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
@@ -1734,7 +1734,7 @@
 		   the device should be read from the flash memory and then
 		   added to the inode's i_rdev member.  */
 		u16 val;
-		jffs_read_data(f, (char *)val, 0, 2);
+		jffs_read_data(f, (char *)&val, 0, 2);
 		init_special_inode(inode, inode->i_mode,
 			old_decode_dev(val));
 	}
#1 lore raw
Quoted 2 lines · Stephen Hemminger

On 2.6.0-test5 jffs generates a warning about type mismatch because it casting a short to a pointer. Look like an obvious typo.

Which it is. Thanks for spotting. Linux, please apply.

Quoted 14 lines

Builds clean, not tested on real hardware.

diff -Nru a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c

fs/jffs/inode-v23.c +1 -1
@@ -1734,7 +1734,7 @@
 		   the device should be read from the flash memory and then
 		   added to the inode's i_rdev member.  */
 		u16 val;
-		jffs_read_data(f, (char *)val, 0, 2);
+		jffs_read_data(f, (char *)&val, 0, 2);
 		init_special_inode(inode, inode->i_mode,
 			old_decode_dev(val));
 	}
#2 lore raw
Quoted 8 lines · On Wed, 10 Sep 2003 [email protected] wrote:
Quoted 2 lines · Stephen Hemminger

On 2.6.0-test5 jffs generates a warning about type mismatch because it casting a short to a pointer. Look like an obvious typo.

Which it is. Thanks for spotting. Linux, please apply.

Quoted 2 lines

Builds clean, not tested on real hardware.

Quoted 12 lines

fs/jffs/inode-v23.c line 1740

Quoted 12 lines

diff -Nru a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c

fs/jffs/inode-v23.c +1 -1
@@ -1734,7 +1734,7 @@
 		   the device should be read from the flash memory and then
 		   added to the inode's i_rdev member.  */
 		u16 val;
-		jffs_read_data(f, (char *)val, 0, 2);
+		jffs_read_data(f, (char *)&val, 0, 2);
 		init_special_inode(inode, inode->i_mode,
 			old_decode_dev(val));
 	}

Is this endian-safe?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
Quoted 1 line · Geert Uytterhoeven

Is this endian-safe?

JFFS is host-endian. If you want to make it swing both ways - feel free, but AFAICS it's not worth the trouble.

#4 lore raw
Quoted 2 lines · On Wed, 10 Sep 2003 [email protected] wrote:

JFFS is host-endian. If you want to make it swing both ways - feel free,

Please don't.

Dual-endianness is _evil_.

Admittedly host-endian is stupid too, but it's less stupid than being dual.

The only sane thing to do is fixed-endianness. I'm sure the m68k people remember being forced to fix their ext2 partitions back in the bad old days. It's painful once, but after that, fixed-endian is a lot more efficient and much simpler to handle.

Linus

#5 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · On Wed, 10 Sep 2003 [email protected] wrote:

JFFS is host-endian. If you want to make it swing both ways - feel free,

Please don't.

Dual-endianness is _evil_.

Quoted 7 lines

Admittedly host-endian is stupid too, but it's less stupid than being dual.

The only sane thing to do is fixed-endianness. I'm sure the m68k people remember being forced to fix their ext2 partitions back in the bad old days. It's painful once, but after that, fixed-endian is a lot more efficient and much simpler to handle.

a) you've snipped the critical part ;-)
b) nobody sane uses that beast these days
c) if somebody wants to grow a private patch - it's their time,
after all...

Seriously, though, by now fs/jffs/* has only one real use - extracting data from old filesystem. IIRC, there was even a talk about having it go the way of ext and xiafs. He's dead, Jim...

#6 lore raw
Quoted 9 lines · On Wed, Sep 10, 2003 at 08:03:04PM +0100…

a) you've snipped the critical part ;-)
b) nobody sane uses that beast these days
c) if somebody wants to grow a private patch - it's their time,
after all...

Seriously, though, by now fs/jffs/* has only one real use - extracting data from old filesystem. IIRC, there was even a talk about having it go the way of ext and xiafs. He's dead, Jim...

It isn't that dead - I get the occasional patch from people wanting to keep it working, although I really wish people would send them to dwmw2 rather than myself.

Signature · 5 lines
Russell King ([email protected])	http://www.arm.linux.org.uk/personal/
Linux kernel maintainer of:
  2.6 ARM Linux   - http://www.arm.linux.org.uk/
  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
  2.6 Serial core
#7 lore raw
Quoted 9 lines · Russell King
Quoted 4 lines · On Wed, Sep 10, 2003 at 08:03:04PM +0100…

Seriously, though, by now fs/jffs/* has only one real use - extracting data from old filesystem. IIRC, there was even a talk about having it go the way of ext and xiafs. He's dead, Jim...

It isn't that dead - I get the occasional patch from people wanting to keep it working, although I really wish people would send them to dwmw2 rather than myself.

Yes, it still beats jffs2 in cases where people have <=5 flash blocks and want a r/w filesystem on them. Until David, myself or someone else finds the time to improve jffs2 for corner cases like this, jffs has a use - sadly.

Jörn

Signature · 3 lines
When you close your hand, you own nothing. When you open it up, you
own the whole world.
-- Li Mu Bai in Tiger & Dragon