nvme_manage: check NS management support earlier
Don't keep prompting the user for input if the controller doesn't support the NS management command. Change-Id: I5bf001657ca1cbbdbf33cafff2509ade2d47bd9d Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
6e2a6ff132
commit
ce13ccf8b0
@ -291,6 +291,11 @@ attach_and_detach_ns(int attachment_op)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctrlr->cdata->oacs.ns_manage) {
|
||||
printf("Controller does not support ns management\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Please Input Namespace ID: \n");
|
||||
if (!scanf("%d", &ns_id)) {
|
||||
printf("Invalid Namespace ID\n");
|
||||
@ -298,11 +303,7 @@ attach_and_detach_ns(int attachment_op)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctrlr->cdata->oacs.ns_manage) {
|
||||
ns_attach(ctrlr, attachment_op, ctrlr->cdata->cntlid, ns_id);
|
||||
} else {
|
||||
printf("Controller does not support ns management\n");
|
||||
}
|
||||
ns_attach(ctrlr, attachment_op, ctrlr->cdata->cntlid, ns_id);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -319,6 +320,11 @@ add_ns(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctrlr->cdata->oacs.ns_manage) {
|
||||
printf("Controller does not support ns management\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Please Input Namespace Size (in LBAs): \n");
|
||||
if (!scanf("%ld", &ns_size)) {
|
||||
printf("Invalid Namespace Size\n");
|
||||
@ -340,11 +346,7 @@ add_ns(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctrlr->cdata->oacs.ns_manage) {
|
||||
ns_manage_add(ctrlr, ns_size, ns_capacity, ns_lbasize);
|
||||
} else {
|
||||
printf("Controller does not support ns management\n");
|
||||
}
|
||||
ns_manage_add(ctrlr, ns_size, ns_capacity, ns_lbasize);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -359,6 +361,11 @@ delete_ns(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctrlr->cdata->oacs.ns_manage) {
|
||||
printf("Controller does not support ns management\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Please Input Namespace ID: \n");
|
||||
if (!scanf("%d", &ns_id)) {
|
||||
printf("Invalid Namespace ID\n");
|
||||
@ -366,11 +373,7 @@ delete_ns(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctrlr->cdata->oacs.ns_manage) {
|
||||
ns_manage_delete(ctrlr, ns_id);
|
||||
} else {
|
||||
printf("Controller does not support ns management\n");
|
||||
}
|
||||
ns_manage_delete(ctrlr, ns_id);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
Loading…
x
Reference in New Issue
Block a user