Skip to contentSkip to conversation

libblki: fix s_feature_compat usage

PATCH In review Karel Zak 2 participants 3 messages Sep 15, 2008

lore
Share & tools
lore

Karel Zak

author
#0 lore raw

PATCH 1/1 libblki: fix s_feature_compat usage

Note that this patch also fix minor coding still errors.

---
 lib/blkid/probe.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
lib/blkid/probe.c +10 -10
index 10ac803..7bb7470 100644
@@ -150,7 +150,7 @@ static void get_ext2_info(blkid_dev dev, struct blkid_magic *id,
 
 	set_uuid(dev, es->s_uuid, 0);
 
-	if ((es->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
+	if ((blkid_le32(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
 	    !uuid_is_null(es->s_journal_uuid))
 		set_uuid(dev, es->s_journal_uuid, "EXT_JOURNAL");
 
@@ -171,7 +171,7 @@ static int fs_proc_check(const char *fs_name)
 
 	f = fopen("/proc/filesystems", "r");
 	if (!f)
-		return (0);
+		return 0;
 	while (!feof(f)) {
 		if (!fgets(buf, sizeof(buf), f))
 			break;
@@ -190,11 +190,11 @@ static int fs_proc_check(const char *fs_name)
 			*t = 0;
 		if (!strcmp(fs_name, cp)) {
 			fclose(f);
-			return (1);
+			return 1;
 		}
 	}
 	fclose(f);
-	return (0);
+	return 0;
 }
 
 /*
@@ -209,12 +209,12 @@ static int check_for_modules(const char *fs_name)
 	int		i;
 
 	if (uname(&uts))
-		return (0);
+		return 0;
 	snprintf(buf, sizeof(buf), "/lib/modules/%s/modules.dep", uts.release);
 
 	f = fopen(buf, "r");
 	if (!f)
-		return (0);
+		return 0;
 	while (!feof(f)) {
 		if (!fgets(buf, sizeof(buf), f))
 			break;
@@ -231,10 +231,10 @@ static int check_for_modules(const char *fs_name)
 				*t = 0;
 		}
 		if (!strcmp(cp, fs_name))
-			return (1);
+			return 1;
 	}
 	fclose(f);
-	return (0);
+	return 0;
 }
 
 static int system_supports_ext4(void)
@@ -1567,7 +1567,7 @@ int main(int argc, char **argv)
 	dev = blkid_get_dev(cache, argv[1], BLKID_DEV_NORMAL);
 	if (!dev) {
 		printf("%s: %s has an unsupported type\n", argv[0], argv[1]);
-		return (1);
+		return 1;
 	}
 	printf("TYPE='%s'\n", dev->bid_type ? dev->bid_type : "(null)");
 	if (dev->bid_label)
@@ -1576,6 +1576,6 @@ int main(int argc, char **argv)
 		printf("UUID='%s'\n", dev->bid_uuid);
 
 	blkid_free_dev(dev);
-	return (0);
+	return 0;
 }
 #endif
Signature · 1 line
1.5.5.1
#1 lore raw

lib/blkid/probe.c static void get_ext2_info(blkid_dev dev, struct blkid_magic *id, · line 153

Quoted 8 lines · Karel Zak

Note that this patch also fix minor coding still errors.

lib/blkid/probe.c +1 -1
@@ -150,7 +150,7 @@ static void get_ext2_info(blkid_dev dev, struct blkid_magic *id,
 
 	set_uuid(dev, es->s_uuid, 0);
 
-	if ((es->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
+	if ((blkid_le32(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&

Minor note - it is generally preferable to swab the constant value, since this can be done at compile time instead of runtime.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

author
#2 lore raw
Quoted 2 lines · Andreas Dilger
Quoted 1 line · Karel Zak

Note that this patch also fix minor coding still errors.

oops, s/still/style/ :-(

Quoted 8 lines

lib/blkid/probe.c static void get_ext2_info(blkid_dev dev, struct blkid_magic *id, · line 153

Quoted 6 lines
lib/blkid/probe.c +1 -1
@@ -150,7 +150,7 @@ static void get_ext2_info(blkid_dev dev, struct blkid_magic *id,
 
 	set_uuid(dev, es->s_uuid, 0);
 
-	if ((es->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
+	if ((blkid_le32(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&

Minor note - it is generally preferable to swab the constant value,

probably yes, but see the rest of the library code... :-)

Karel

Signature · 1 line
 Karel Zak  <[email protected]>