linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH V3 2/2] mkfs.f2fs: skip extension name that is too long
  2015-11-30 10:41 ` [PATCH V3 2/2] mkfs.f2fs: skip extension name that is too long Sheng Yong
@ 2015-11-30  2:58   ` Sheng Yong
  2015-12-01 14:20     ` Chao Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Sheng Yong @ 2015-11-30  2:58 UTC (permalink / raw)
  To: chao2.yu, jaegeuk; +Cc: linux-f2fs-devel

Hi, Chao Yu, Jaegeuk

I'm not sure if it is ok to send this patch out by me. If I did it the
wrong way, please ignore this patch.

thanks,
Sheng

On 11/30/2015 6:41 PM, Sheng Yong wrote:
> From: Chao Yu <chao2.yu@samsung.com>
> 
> The length of extension name has a limit of 8 bytes. If an extension
> exceeds the limitation, it will not be added to the extension_list.
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>
> ---
>  mkfs/f2fs_format.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
> index a29d7ef..212df60 100644
> --- a/mkfs/f2fs_format.c
> +++ b/mkfs/f2fs_format.c
> @@ -157,8 +157,13 @@ static void configure_extension_list(void)
>  	ue = strtok(ext_str, ", ");
>  	while (ue != NULL) {
>  		name_len = strlen(ue);
> +		if (name_len >= 8) {
> +			MSG(0, "\tWarn: Extension name (%s) is too long\n", ue);
> +			goto next;
> +		}
>  		if (!is_extension_exist(ue))
>  			memcpy(sb.extension_list[i++], ue, name_len);
> +next:
>  		ue = strtok(NULL, ", ");
>  		if (i >= F2FS_MAX_EXTENSION)
>  			break;
> 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140

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

* [PATCH V3 1/2] mkfs.f2fs: avoid dumplicate extensions
@ 2015-11-30 10:41 Sheng Yong
  2015-11-30 10:41 ` [PATCH V3 2/2] mkfs.f2fs: skip extension name that is too long Sheng Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Sheng Yong @ 2015-11-30 10:41 UTC (permalink / raw)
  To: chao2.yu, jaegeuk; +Cc: linux-f2fs-devel

Before copying an user specified extension to extension_list, check if it
is already in the list. User specified extensions are delimitted by token
either ',' or ' '.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 mkfs/f2fs_format.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 176bdea..a29d7ef 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -118,6 +118,19 @@ const char *media_ext_lists[] = {
 	NULL
 };
 
+static bool is_extension_exist(const char *name)
+{
+	int i;
+
+	for (i = 0; i < F2FS_MAX_EXTENSION; i++) {
+		char *ext = (char *)sb.extension_list[i];
+		if (!strcmp(ext, name))
+			return 1;
+	}
+
+	return 0;
+}
+
 static void configure_extension_list(void)
 {
 	const char **extlist = media_ext_lists;
@@ -141,11 +154,12 @@ static void configure_extension_list(void)
 		return;
 
 	/* add user ext list */
-	ue = strtok(ext_str, ",");
+	ue = strtok(ext_str, ", ");
 	while (ue != NULL) {
 		name_len = strlen(ue);
-		memcpy(sb.extension_list[i++], ue, name_len);
-		ue = strtok(NULL, ",");
+		if (!is_extension_exist(ue))
+			memcpy(sb.extension_list[i++], ue, name_len);
+		ue = strtok(NULL, ", ");
 		if (i >= F2FS_MAX_EXTENSION)
 			break;
 	}
-- 
1.9.1


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140

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

* [PATCH V3 2/2] mkfs.f2fs: skip extension name that is too long
  2015-11-30 10:41 [PATCH V3 1/2] mkfs.f2fs: avoid dumplicate extensions Sheng Yong
@ 2015-11-30 10:41 ` Sheng Yong
  2015-11-30  2:58   ` Sheng Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Sheng Yong @ 2015-11-30 10:41 UTC (permalink / raw)
  To: chao2.yu, jaegeuk; +Cc: linux-f2fs-devel

From: Chao Yu <chao2.yu@samsung.com>

The length of extension name has a limit of 8 bytes. If an extension
exceeds the limitation, it will not be added to the extension_list.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Sheng Yong <shengyong1@huawei.com>
---
 mkfs/f2fs_format.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index a29d7ef..212df60 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -157,8 +157,13 @@ static void configure_extension_list(void)
 	ue = strtok(ext_str, ", ");
 	while (ue != NULL) {
 		name_len = strlen(ue);
+		if (name_len >= 8) {
+			MSG(0, "\tWarn: Extension name (%s) is too long\n", ue);
+			goto next;
+		}
 		if (!is_extension_exist(ue))
 			memcpy(sb.extension_list[i++], ue, name_len);
+next:
 		ue = strtok(NULL, ", ");
 		if (i >= F2FS_MAX_EXTENSION)
 			break;
-- 
1.9.1


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140

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

* Re: [PATCH V3 2/2] mkfs.f2fs: skip extension name that is too long
  2015-11-30  2:58   ` Sheng Yong
@ 2015-12-01 14:20     ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2015-12-01 14:20 UTC (permalink / raw)
  To: Sheng Yong, jaegeuk; +Cc: linux-f2fs-devel

Hi Sheng,

On 11/30/15 10:58 AM, Sheng Yong wrote:
> Hi, Chao Yu, Jaegeuk
> 
> I'm not sure if it is ok to send this patch out by me. If I did it the
> wrong way, please ignore this patch.

It's OK to me, thanks for your reediting. :)

Regards,

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140

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

end of thread, other threads:[~2015-12-01 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-30 10:41 [PATCH V3 1/2] mkfs.f2fs: avoid dumplicate extensions Sheng Yong
2015-11-30 10:41 ` [PATCH V3 2/2] mkfs.f2fs: skip extension name that is too long Sheng Yong
2015-11-30  2:58   ` Sheng Yong
2015-12-01 14:20     ` Chao Yu

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