[klibc] [BUG][PATCH] fstype: wrong size returned for jfs

Stephane Chazelas Stephane_Chazelas at yahoo.fr
Mon Mar 3 09:15:05 PST 2008


[please note that I'm not subscribed to the list]

Hi guys,

I've noticed that the size returned by the fstype utility was
not correct for JFS filesystems (it returns the size in number
of HW blocks instead of bytes).

Here is a simple patch that addresses it (based on 1.5.7 from
the debian package).

diff -Nur klibc-1.5.7.orig/usr/kinit/fstype/fstype.c klibc-1.5.7/usr/kinit/fstype/fstype.c
--- klibc-1.5.7.orig/usr/kinit/fstype/fstype.c	2007-09-04 09:17:12.000000000 +0100
+++ klibc-1.5.7/usr/kinit/fstype/fstype.c	2008-03-03 16:57:34.522813138 +0000
@@ -205,7 +205,7 @@
 	const struct jfs_superblock *sb = (const struct jfs_superblock *)buf;
 
 	if (!memcmp(sb->s_magic, JFS_MAGIC, 4)) {
-		*bytes = __le32_to_cpu(sb->s_size);
+		*bytes = __le64_to_cpu(sb->s_size) << __le16_to_cpu(sb->s_l2pbsize);
 		return 1;
 	}
 	return 0;

HTH,
Stephane



More information about the klibc mailing list