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. MFC after: 1 week Sponsored by: iXsystems, Inc.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user