diff options
author | mav <mav@FreeBSD.org> | 2015-11-28 17:26:46 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-11-28 17:26:46 +0000 |
commit | 7c2f90e37a292a6cb6d4d0efa2dacd5db7cc3fd8 (patch) | |
tree | b9f2226710399ba324b64ac18336db36cfd9bd60 /share | |
parent | d5f5ec6e1a6f9610da0df3ea5898e7111d06e79d (diff) | |
download | FreeBSD-src-7c2f90e37a292a6cb6d4d0efa2dacd5db7cc3fd8.zip FreeBSD-src-7c2f90e37a292a6cb6d4d0efa2dacd5db7cc3fd8.tar.gz |
MFC r291126:
Add API to obtain primary enclosure name and ID for /dev/sesX devices.
sesX device number may change between reboots, so to properly identify
the instance we need more data. Name and ID reported here may mach ones
reported by SCSI device, but that is not really required by specs.
Sponsored by: iXsystems, Inc.
Diffstat (limited to 'share')
-rw-r--r-- | share/examples/ses/srcs/getencstat.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/share/examples/ses/srcs/getencstat.c b/share/examples/ses/srcs/getencstat.c index 9048f73..7cdde90 100644 --- a/share/examples/ses/srcs/getencstat.c +++ b/share/examples/ses/srcs/getencstat.c @@ -48,12 +48,14 @@ int main(int a, char **v) { + encioc_string_t stri; encioc_element_t *objp; encioc_elm_status_t ob; encioc_elm_desc_t objd; encioc_elm_devnames_t objdn; int fd, nobj, f, i, verbose, quiet, errors; u_char estat; + char str[32]; if (a < 2) { fprintf(stderr, "usage: %s [ -v ] device [ device ... ]\n", *v); @@ -78,6 +80,16 @@ main(int a, char **v) perror(*v); continue; } + if (verbose > 1) { + stri.bufsiz = sizeof(str); + stri.buf = &str[0]; + if (ioctl(fd, ENCIOC_GETENCNAME, (caddr_t) &stri) == 0) + printf("%s: Enclosure Name: %s\n", *v, stri.buf); + stri.bufsiz = sizeof(str); + stri.buf = &str[0]; + if (ioctl(fd, ENCIOC_GETENCID, (caddr_t) &stri) == 0) + printf("%s: Enclosure ID: %s\n", *v, stri.buf); + } if (ioctl(fd, ENCIOC_GETNELM, (caddr_t) &nobj) < 0) { perror("ENCIOC_GETNELM"); (void) close(fd); |