linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libblki: fix s_feature_compat usage
@ 2008-09-15 12:03 Karel Zak
  2008-09-15 23:11 ` Andreas Dilger
  0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2008-09-15 12:03 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-ext4, Karel Zak

Note that this patch also fix minor coding still errors.

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 lib/blkid/probe.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 10ac803..7bb7470 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -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
-- 
1.5.5.1


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

* Re: [PATCH] libblki: fix s_feature_compat usage
  2008-09-15 12:03 [PATCH] libblki: fix s_feature_compat usage Karel Zak
@ 2008-09-15 23:11 ` Andreas Dilger
  2008-09-15 23:36   ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2008-09-15 23:11 UTC (permalink / raw)
  To: Karel Zak; +Cc: Theodore Tso, linux-ext4

On Sep 15, 2008  14:03 +0200, Karel Zak wrote:
> Note that this patch also fix minor coding still errors.
> 
> @@ -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.


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

* Re: [PATCH] libblki: fix s_feature_compat usage
  2008-09-15 23:11 ` Andreas Dilger
@ 2008-09-15 23:36   ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2008-09-15 23:36 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Theodore Tso, linux-ext4

On Mon, Sep 15, 2008 at 04:11:02PM -0700, Andreas Dilger wrote:
> On Sep 15, 2008  14:03 +0200, Karel Zak wrote:
> > Note that this patch also fix minor coding still errors.

 oops, s/still/style/ :-(

> > @@ -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

-- 
 Karel Zak  <kzak@redhat.com>

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

end of thread, other threads:[~2008-09-15 23:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-15 12:03 [PATCH] libblki: fix s_feature_compat usage Karel Zak
2008-09-15 23:11 ` Andreas Dilger
2008-09-15 23:36   ` Karel Zak

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