Skip to contentSkip to conversation

f2fs: no need to take the address of the array of sb->s_uuid

PATCH RESEND In review Gao Xiang 3 participants 4 messages Apr 5, 2018 – Apr 8, 2018 F2FS file system

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH RESEND 1/1 f2fs: no need to take the address of the array of sb->s_uuid

Keep in line with the common case since it is some weird to take the address of an array again.

---
fix auto-wrapping of email client

 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
index 9587ca0..4d467c7 100644
@@ -2565,7 +2565,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0);
-	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 	sb->s_iflags |= SB_I_CGROUPWB;
 
 	/* init f2fs-specific super block info */
Signature · 6 lines
2.1.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
maintainer
#2 lore raw
In reply to Gao Xiang
Quoted 2 lines · Gao Xiang

Keep in line with the common case since it is some weird to take the address of an array again.

I encounter compile error after applying this patch:

super.c: In function ‘f2fs_fill_super’:
super.c:2711:2: error: incompatible type for argument 1 of ‘__builtin_memcpy’
memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
^
super.c:2711:2: note: expected ‘void *’ but argument is of type ‘uuid_t’

Anyway, we need '&' due to sb::s_uuid is a structure object instead of an array.

Thanks,

Quoted 14 lines

---
fix auto-wrapping of email client

 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +0 -0
index 9587ca0..4d467c7 100644

fs/f2fs/super.c static int f2fs_fill_super(struct super_block *sb, void *data, int silent) · line 2571

Quoted 8 lines
fs/f2fs/super.c +1 -1
@@ -2565,7 +2565,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0);
-	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 	sb->s_iflags |= SB_I_CGROUPWB;
 
 	/* init f2fs-specific super block info */

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot

author
#3 lore raw

Hi Chao and Jaegeuk,

Quoted 12 lines · Chao Yu
Quoted 2 lines · Gao Xiang

Keep in line with the common case since it is some weird to take the address of an array again.

I encounter compile error after applying this patch:

super.c: In function ‘f2fs_fill_super’:
super.c:2711:2: error: incompatible type for argument 1 of ‘__builtin_memcpy’
memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
^
super.c:2711:2: note: expected ‘void *’ but argument is of type ‘uuid_t’

Quoted 4 lines

Anyway, we need '&' due to sb::s_uuid is a structure object instead of an array.

Thanks,

Sorry, I'm developing another feature related to it. But I checked the source code about sb->uuid from 3.x to 4.9.
https://elixir.bootlin.com/linux/v4.9.93/source/include/linux/fs.h#L1382

It seems that the latest kernel changed from u8 s_uuid[16] to uuid_t s_uuid.

Sorry for annoying, please ignore this patch.

Thanks,

Quoted 20 lines
Quoted 20 lines

---
fix auto-wrapping of email client

 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/super.c +1 -1
index 9587ca0..4d467c7 100644
@@ -2565,7 +2565,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_time_gran = 1;
 	sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
 		(test_opt(sbi, POSIX_ACL) ? SB_POSIXACL : 0);
-	memcpy(&sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
+	memcpy(sb->s_uuid, raw_super->uuid, sizeof(raw_super->uuid));
 	sb->s_iflags |= SB_I_CGROUPWB;
 
Quoted 2 lines

fs/f2fs/super.c static int f2fs_fill_super(struct super_block *sb, void *data, int silent) · line 2571

Quoted 2 lines
fs/f2fs/super.c +0 -0
 	/* init f2fs-specific super block info */

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot