target: fix match_token option in target_core_configfs.c
authortangwenji <tang.wenji@zte.com.cn>
Tue, 22 Aug 2017 12:29:50 +0000 (20:29 +0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sat, 4 Nov 2017 21:45:23 +0000 (14:45 -0700)
The match_token function does not recognize the option 'l',
so that both the mapped_lun and target_lun parameters
can not be resolved correctly.

And parsed u64-type parameters should use match_u64().

(Use %u instead of %s for Opt_mapped_lun + Opt_target_lun - nab)

Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_configfs.c

index 7e87d95..3790df4 100644 (file)
@@ -1611,12 +1611,12 @@ static match_table_t tokens = {
        {Opt_res_type, "res_type=%d"},
        {Opt_res_scope, "res_scope=%d"},
        {Opt_res_all_tg_pt, "res_all_tg_pt=%d"},
-       {Opt_mapped_lun, "mapped_lun=%lld"},
+       {Opt_mapped_lun, "mapped_lun=%u"},
        {Opt_target_fabric, "target_fabric=%s"},
        {Opt_target_node, "target_node=%s"},
        {Opt_tpgt, "tpgt=%d"},
        {Opt_port_rtpi, "port_rtpi=%d"},
-       {Opt_target_lun, "target_lun=%lld"},
+       {Opt_target_lun, "target_lun=%u"},
        {Opt_err, NULL}
 };
 
@@ -1693,7 +1693,7 @@ static ssize_t target_pr_res_aptpl_metadata_store(struct config_item *item,
                        }
                        break;
                case Opt_sa_res_key:
-                       ret = kstrtoull(args->from, 0, &tmp_ll);
+                       ret = match_u64(args,  &tmp_ll);
                        if (ret < 0) {
                                pr_err("kstrtoull() failed for sa_res_key=\n");
                                goto out;
@@ -1727,10 +1727,10 @@ static ssize_t target_pr_res_aptpl_metadata_store(struct config_item *item,
                        all_tg_pt = (int)arg;
                        break;
                case Opt_mapped_lun:
-                       ret = match_int(args, &arg);
+                       ret = match_u64(args, &tmp_ll);
                        if (ret)
                                goto out;
-                       mapped_lun = (u64)arg;
+                       mapped_lun = (u64)tmp_ll;
                        break;
                /*
                 * PR APTPL Metadata for Target Port
@@ -1768,10 +1768,10 @@ static ssize_t target_pr_res_aptpl_metadata_store(struct config_item *item,
                                goto out;
                        break;
                case Opt_target_lun:
-                       ret = match_int(args, &arg);
+                       ret = match_u64(args, &tmp_ll);
                        if (ret)
                                goto out;
-                       target_lun = (u64)arg;
+                       target_lun = (u64)tmp_ll;
                        break;
                default:
                        break;