From: Sheng Yong <shengyong1@huawei.com>
To: chao2.yu@samsung.com, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [PATCH V3 1/2] mkfs.f2fs: avoid dumplicate extensions
Date: Mon, 30 Nov 2015 10:41:06 +0000 [thread overview]
Message-ID: <1448880067-9629-1-git-send-email-shengyong1@huawei.com> (raw)
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
next reply other threads:[~2015-11-30 2:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 10:41 Sheng Yong [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448880067-9629-1-git-send-email-shengyong1@huawei.com \
--to=shengyong1@huawei.com \
--cc=chao2.yu@samsung.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).