Skip to contentSkip to conversation

mkfs.f2fs: show the info of volume label only when specify it

PATCH In review Tiezhu Yang 2 participants 2 messages Oct 8, 2018 – Oct 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs.f2fs: show the info of volume label only when specify it

Currently, when format disk used with mkfs.f2fs, even if the volume label is not specified, it still shows the info of volume label with no content due to the check condition is always true, this patch fixes it.

[root@localhost home]# mkfs.f2fs -f /dev/sdb1

	F2FS-tools: mkfs.f2fs Ver: 1.12.0 (2018-10-08)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled

---
 mkfs/f2fs_format_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/f2fs_format_main.c +1 -1
index 1424cc3..6ea8068 100644
@@ -81,7 +81,7 @@ static void f2fs_show_info()
 	if (c.extension_list[1])
 		MSG(0, "Info: Add new hot file extension list\n");
 
-	if (c.vol_label)
+	if (strlen(c.vol_label))
 		MSG(0, "Info: Label = %s\n", c.vol_label);
 	MSG(0, "Info: Trim is %s\n", c.trim ? "enabled": "disabled");
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 4 lines · Tiezhu Yang

Currently, when format disk used with mkfs.f2fs, even if the volume label is not specified, it still shows the info of volume label with no content due to the check condition is always true, this patch fixes it.

Quoted 8 lines

[root@localhost home]# mkfs.f2fs -f /dev/sdb1

	F2FS-tools: mkfs.f2fs Ver: 1.12.0 (2018-10-08)

Info: Disable heap-based policy
Info: Debug level = 0
Info: Label =
Info: Trim is enabled

Like tune2fs does, we can show volume label as below if user didn't set it.

Info: Label = <none>

Thanks,

Quoted 20 lines
---
 mkfs/f2fs_format_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs/f2fs_format_main.c +1 -1
index 1424cc3..6ea8068 100644
@@ -81,7 +81,7 @@ static void f2fs_show_info()
 	if (c.extension_list[1])
 		MSG(0, "Info: Add new hot file extension list\n");
 
-	if (c.vol_label)
+	if (strlen(c.vol_label))
 		MSG(0, "Info: Label = %s\n", c.vol_label);
 	MSG(0, "Info: Trim is %s\n", c.trim ? "enabled": "disabled");