]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugin-lnvm: Fixed argument parsing in lnvm_create_tgt.
authorSimon A. F. Lund <safl@safl.dk>
Tue, 5 Jul 2016 15:08:29 +0000 (17:08 +0200)
committerSimon A. F. Lund <safl@safl.dk>
Tue, 5 Jul 2016 15:08:29 +0000 (17:08 +0200)
The options lun-begin and lun-end had "no_argument" causing parsing failure,
changed to "required_argument".

The options lun-begin and lun-end parsed to invalid destination (cfg.tgt_type),
changed to cfg.lun_begin and cfg.lun_end respectfully.

lnvm-nvme.c

index 2f888322711541f010bff7d6fb1724d32fcba683..858304751e81bf78f85f1abcb38852bf6d1cefa7 100644 (file)
@@ -128,8 +128,8 @@ static int lnvm_create_tgt(int argc, char **argv, struct command *cmd, struct pl
                char *devname;
                char *tgtname;
                char *tgttype;
-               int lun_begin;
-               int lun_end;
+               __u32 lun_begin;
+               __u32 lun_end;
        };
 
        struct config cfg = {
@@ -144,8 +144,8 @@ static int lnvm_create_tgt(int argc, char **argv, struct command *cmd, struct pl
                {"device-name",   'd', "DEVICE", CFG_STRING,    &cfg.devname,   required_argument, devname},
                {"target-name",   'n', "TARGET", CFG_STRING,    &cfg.tgtname,   required_argument, tgtname},
                {"target-type",   't', "TARGETTYPE",  CFG_STRING,    &cfg.tgttype,   required_argument, tgttype},
-               {"lun-begin",     'b', "NUM",    CFG_POSITIVE,  &cfg.tgttype,   no_argument,       lun_begin},
-               {"lun-end",       'e', "NUM",    CFG_POSITIVE,  &cfg.tgttype,   no_argument,       lun_end},
+               {"lun-begin",     'b', "NUM",    CFG_POSITIVE,  &cfg.lun_begin,      required_argument,       lun_begin},
+               {"lun-end",       'e', "NUM",    CFG_POSITIVE,  &cfg.lun_end,   required_argument,       lun_end},
                {0}
        };