Skip to contentSkip to conversation

fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL

PATCH In review Fabian Frederick 2 participants 3 messages Jun 15, 2014 – Jun 16, 2014 Omfs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs/omfs/inode.c: use ULLONG_MAX instead of ~0ULL

Use more explicit kernel.h definition

Cc Bob Copeland <[email protected]>
Cc Andrew Morton <[email protected]>

---
V2:
Fix Cc list

 fs/omfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/omfs/inode.c +2 -2
index ec58c76..40c0707 100644
@@ -317,7 +317,7 @@ static int omfs_get_imap(struct super_block *sb)
 	bitmap_size = DIV_ROUND_UP(sbi->s_num_blocks, 8);
 	array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
 
-	if (sbi->s_bitmap_ino == ~0ULL)
+	if (sbi->s_bitmap_ino == ULLONG_MAX)
 		goto out;
 
 	sbi->s_imap_size = array_size;
@@ -516,7 +516,7 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent)
 		goto out_brelse_bh2;
 	}
 
-	if (sbi->s_bitmap_ino != ~0ULL &&
+	if (sbi->s_bitmap_ino != ULLONG_MAX &&
 	    sbi->s_bitmap_ino > sbi->s_num_blocks) {
 		printk(KERN_ERR "omfs: free space bitmap location is corrupt "
 			"(%llx, total blocks %llx)\n",
Signature · 1 line
1.8.4.5
maintainer
#1 lore raw

fs/omfs/inode.c static int omfs_get_imap(struct super_block *sb) · line 321

Quoted 6 lines · Fabian Frederick

Use more explicit kernel.h definition

fs/omfs/inode.c +1 -1
 	array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
 
-	if (sbi->s_bitmap_ino == ~0ULL)
+	if (sbi->s_bitmap_ino == ULLONG_MAX)
 		goto out;

So I agree they are the same, but is there a good reason for the change?

Semantically, I think of ~0ULL as "all ones" whereas ULLONG_MAX as a maximum of a magnitude comparison, which this is not really.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#2 lore raw
Quoted 11 lines · On Sun, 15 Jun 2014 12:11:42 -0400 Bob Copeland <[email protected]> wrote:

fs/omfs/inode.c static int omfs_get_imap(struct super_block *sb) · line 321

Quoted 6 lines · Fabian Frederick

Use more explicit kernel.h definition

fs/omfs/inode.c +1 -1
 	array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
 
-	if (sbi->s_bitmap_ino == ~0ULL)
+	if (sbi->s_bitmap_ino == ULLONG_MAX)
 		goto out;

So I agree they are the same, but is there a good reason for the change?

Quoted 2 lines

Semantically, I think of ~0ULL as "all ones" whereas ULLONG_MAX as a maximum of a magnitude comparison, which this is not really.

Well it was meant to clarify code but in this case it doesn't indeed :)

Thanks,
Fabian

Quoted 3 lines
Signature · 2 lines
-- 
Bob Copeland %% www.bobcopeland.com