Whamcloud - gitweb
LU-9325 osd-ldisk: replace simple_strto* with kstr* functions 19/40119/8
authorJames Simmons <jsimmons@infradead.org>
Tue, 3 Nov 2020 14:27:43 +0000 (09:27 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 21:05:51 +0000 (21:05 +0000)
The parsing of mount parameters from the config llog is done in
some cases with simple_strto* which is considered obsolete.
Replace simple_strto* with the kstrto* equivalent functions.

Change-Id: I7c26d14d02828c9f9a96f31a086a65bb39f3ea87
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/40119
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c

index 98b36a6..86054ff 100644 (file)
@@ -7701,11 +7701,11 @@ static int osd_mount(const struct lu_env *env,
        const char *name = lustre_cfg_string(cfg, 0);
        const char *dev = lustre_cfg_string(cfg, 1);
        const char *opts;
-       unsigned long page, s_flags, lmd_flags = 0;
+       unsigned long page, s_flags = 0, lmd_flags = 0;
        struct page *__page;
        struct file_system_type *type;
        char *options = NULL;
-       char *str;
+       const char *str;
        struct osd_thread_info *info = osd_oti_get(env);
        struct lu_fid *fid = &info->oti_fid;
        struct inode *inode;
@@ -7720,11 +7720,9 @@ static int osd_mount(const struct lu_env *env,
                RETURN(-E2BIG);
        strcpy(o->od_mntdev, dev);
 
-       str = lustre_cfg_string(cfg, 2);
-       s_flags = simple_strtoul(str, NULL, 0);
-       str = strstr(str, ":");
-       if (str)
-               lmd_flags = simple_strtoul(str + 1, NULL, 0);
+       str = lustre_cfg_buf(cfg, 2);
+       sscanf(str, "%lu:%lu", &s_flags, &lmd_flags);
+
        opts = lustre_cfg_string(cfg, 3);
 #ifdef __BIG_ENDIAN
        if (opts == NULL || strstr(opts, "bigendian_extents") == NULL) {