Skip to content

Commit 6e75730

Browse files
committed
nvme: nvme_format_nvm use nvme_passthru_cmd directly
Drop nvme_format_nvm_args entirely. Signed-off-by: Dennis Maisenbacher <[email protected]>
1 parent ed3ec5d commit 6e75730

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

nvme.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6395,7 +6395,7 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin
63956395
const char *ses = "[0-2]: secure erase";
63966396
const char *pil = "[0-1]: protection info location last/first bytes of metadata";
63976397
const char *pi = "[0-3]: protection info off/Type 1/Type 2/Type 3";
6398-
const char *ms = "[0-1]: extended format off/on";
6398+
const char *mset = "[0-1]: extended format off/on";
63996399
const char *reset = "Automatically reset the controller after successful format";
64006400
const char *bs = "target block size";
64016401
const char *force = "The \"I know what I'm doing\" flag, skip confirmation before sending command";
@@ -6415,7 +6415,7 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin
64156415
__u8 ses;
64166416
__u8 pi;
64176417
__u8 pil;
6418-
__u8 ms;
6418+
__u8 mset;
64196419
bool reset;
64206420
bool force;
64216421
__u64 bs;
@@ -6427,7 +6427,7 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin
64276427
.ses = 0,
64286428
.pi = 0,
64296429
.pil = 0,
6430-
.ms = 0,
6430+
.mset = 0,
64316431
.reset = false,
64326432
.force = false,
64336433
.bs = 0,
@@ -6441,7 +6441,7 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin
64416441
OPT_BYTE("ses", 's', &cfg.ses, ses),
64426442
OPT_BYTE("pi", 'i', &cfg.pi, pi),
64436443
OPT_BYTE("pil", 'p', &cfg.pil, pil),
6444-
OPT_BYTE("ms", 'm', &cfg.ms, ms),
6444+
OPT_BYTE("mset", 'm', &cfg.mset, mset),
64456445
OPT_FLAG("reset", 'r', &cfg.reset, reset),
64466446
OPT_FLAG("force", 0, &cfg.force, force),
64476447
OPT_SUFFIX("block-size", 'b', &cfg.bs, bs));
@@ -6572,8 +6572,8 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin
65726572
nvme_show_error("invalid pil:%d", cfg.pil);
65736573
return -EINVAL;
65746574
}
6575-
if (cfg.ms > 1) {
6576-
nvme_show_error("invalid ms:%d", cfg.ms);
6575+
if (cfg.mset > 1) {
6576+
nvme_show_error("invalid mset:%d", cfg.mset);
65776577
return -EINVAL;
65786578
}
65796579

@@ -6590,19 +6590,8 @@ static int format_cmd(int argc, char **argv, struct command *cmd, struct plugin
65906590
fprintf(stderr, "Sending format operation ...\n");
65916591
}
65926592

6593-
struct nvme_format_nvm_args args = {
6594-
.args_size = sizeof(args),
6595-
.nsid = cfg.namespace_id,
6596-
.lbafu = (cfg.lbaf >> 4) & 0x3,
6597-
.lbaf = cfg.lbaf & 0xf,
6598-
.mset = cfg.ms,
6599-
.pi = cfg.pi,
6600-
.pil = cfg.pil,
6601-
.ses = cfg.ses,
6602-
.timeout = nvme_cfg.timeout,
6603-
.result = NULL,
6604-
};
6605-
err = nvme_format_nvm(l, &args);
6593+
err = nvme_format_nvm(l, cfg.namespace_id, cfg.lbaf & 0xf, cfg.mset,
6594+
cfg.pi, cfg.pil, cfg.ses, (cfg.lbaf >> 4) & 0x3, NULL);
66066595
if (err < 0) {
66076596
nvme_show_error("format: %s", nvme_strerror(-err));
66086597
} else if (err != 0) {

0 commit comments

Comments
 (0)