devlist.c (253474) | devlist.c (253476) |
---|---|
1/*- 2 * Copyright (C) 2012-2013 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (C) 2012-2013 Intel Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 253474 2013-07-19 21:33:24Z jimharris $"); | 28__FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 253476 2013-07-19 21:40:57Z jimharris $"); |
29 30#include <sys/param.h> 31 32#include <err.h> 33#include <errno.h> 34#include <fcntl.h> 35#include <paths.h> 36#include <stddef.h> --- 20 unchanged lines hidden (view full) --- 57} 58 59void 60devlist(int argc, char *argv[]) 61{ 62 struct nvme_controller_data cdata; 63 struct nvme_namespace_data nsdata; 64 char name[64]; | 29 30#include <sys/param.h> 31 32#include <err.h> 33#include <errno.h> 34#include <fcntl.h> 35#include <paths.h> 36#include <stddef.h> --- 20 unchanged lines hidden (view full) --- 57} 58 59void 60devlist(int argc, char *argv[]) 61{ 62 struct nvme_controller_data cdata; 63 struct nvme_namespace_data nsdata; 64 char name[64]; |
65 uint8_t mn[64]; |
|
65 uint32_t i; 66 int ch, ctrlr, fd, found, ret; 67 68 while ((ch = getopt(argc, argv, "")) != -1) { 69 switch ((char)ch) { 70 default: 71 devlist_usage(); 72 } --- 13 unchanged lines hidden (view full) --- 86 warnx("could not open "_PATH_DEV"%s\n", name); 87 continue; 88 } else 89 break; 90 } 91 92 found++; 93 read_controller_data(fd, &cdata); | 66 uint32_t i; 67 int ch, ctrlr, fd, found, ret; 68 69 while ((ch = getopt(argc, argv, "")) != -1) { 70 switch ((char)ch) { 71 default: 72 devlist_usage(); 73 } --- 13 unchanged lines hidden (view full) --- 87 warnx("could not open "_PATH_DEV"%s\n", name); 88 continue; 89 } else 90 break; 91 } 92 93 found++; 94 read_controller_data(fd, &cdata); |
94 printf("%6s: %.*s\n", name, NVME_MODEL_NUMBER_LENGTH, cdata.mn); | 95 nvme_strvis(mn, cdata.mn, sizeof(mn), NVME_MODEL_NUMBER_LENGTH); 96 printf("%6s: %s\n", name, mn); |
95 96 for (i = 0; i < cdata.nn; i++) { 97 sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr, 98 NVME_NS_PREFIX, i+1); 99 read_namespace_data(fd, i+1, &nsdata); 100 printf(" %10s (%lldGB)\n", 101 name, 102 nsdata.nsze * --- 12 unchanged lines hidden --- | 97 98 for (i = 0; i < cdata.nn; i++) { 99 sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr, 100 NVME_NS_PREFIX, i+1); 101 read_namespace_data(fd, i+1, &nsdata); 102 printf(" %10s (%lldGB)\n", 103 name, 104 nsdata.nsze * --- 12 unchanged lines hidden --- |