522 if (npa->npa_isns)
523 minor_nodetype = DDI_NT_NVME_ATTACHMENT_POINT;
524
525 (void) di_walk_minor(node, minor_nodetype, 0, npa, nvme_process);
526 }
527
528 static void
529 usage_list(const char *c_name)
530 {
531 (void) fprintf(stderr, "%s [<ctl>[/<ns>][,...]\n\n"
532 " List NVMe controllers and their namespaces. If no "
533 "controllers and/or name-\n spaces are specified, all "
534 "controllers and namespaces in the system will be\n "
535 "listed.\n", c_name);
536 }
537
538 static int
539 do_list_nsid(int fd, const nvme_process_arg_t *npa)
540 {
541 _NOTE(ARGUNUSED(fd));
542
543 (void) printf(" %s/%s (%s): ", npa->npa_name,
544 di_minor_name(npa->npa_minor),
545 npa->npa_dsk != NULL ? npa->npa_dsk : "unattached");
546 nvme_print_nsid_summary(npa->npa_idns);
547
548 return (0);
549 }
550
551 static int
552 do_list(int fd, const nvme_process_arg_t *npa)
553 {
554 _NOTE(ARGUNUSED(fd));
555
556 nvme_process_arg_t ns_npa = { 0 };
557 nvmeadm_cmd_t cmd = { 0 };
558 char *name;
559
560 if (asprintf(&name, "%s%d", di_driver_name(npa->npa_node),
561 di_instance(npa->npa_node)) < 0)
562 err(-1, "do_list()");
|
522 if (npa->npa_isns)
523 minor_nodetype = DDI_NT_NVME_ATTACHMENT_POINT;
524
525 (void) di_walk_minor(node, minor_nodetype, 0, npa, nvme_process);
526 }
527
528 static void
529 usage_list(const char *c_name)
530 {
531 (void) fprintf(stderr, "%s [<ctl>[/<ns>][,...]\n\n"
532 " List NVMe controllers and their namespaces. If no "
533 "controllers and/or name-\n spaces are specified, all "
534 "controllers and namespaces in the system will be\n "
535 "listed.\n", c_name);
536 }
537
538 static int
539 do_list_nsid(int fd, const nvme_process_arg_t *npa)
540 {
541 _NOTE(ARGUNUSED(fd));
542 const uint_t format = npa->npa_idns->id_flbas.lba_format;
543 const uint_t bshift = npa->npa_idns->id_lbaf[format].lbaf_lbads;
544
545 /*
546 * Some devices have extra namespaces with illegal block sizes and
547 * zero blocks. Don't list them when verbose operation isn't requested.
548 */
549 if ((bshift < 9 || npa->npa_idns->id_nsize == 0) && verbose == 0)
550 return (0);
551
552 (void) printf(" %s/%s (%s): ", npa->npa_name,
553 di_minor_name(npa->npa_minor),
554 npa->npa_dsk != NULL ? npa->npa_dsk : "unattached");
555 nvme_print_nsid_summary(npa->npa_idns);
556
557 return (0);
558 }
559
560 static int
561 do_list(int fd, const nvme_process_arg_t *npa)
562 {
563 _NOTE(ARGUNUSED(fd));
564
565 nvme_process_arg_t ns_npa = { 0 };
566 nvmeadm_cmd_t cmd = { 0 };
567 char *name;
568
569 if (asprintf(&name, "%s%d", di_driver_name(npa->npa_node),
570 di_instance(npa->npa_node)) < 0)
571 err(-1, "do_list()");
|