mgmt_probe.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <errno.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <dirent.h>
#include <ctype.h>
#include <fcntl.h>
#include <libnvpair.h>
#include "mms_mgmt.h"
#include "mgmt_sym.h"
int
{
int st = 0;
int i;
/* cdb to read serial number */
/* cdb to read inquiry data */
int fd = -1;
char senbuf[64];
char *name;
char path[MAXPATHLEN];
struct mtdrivetype dt;
char vid[9];
char pid[17];
char *bufp;
char *unavail = "device unavailable";
if (!drv_list) {
return (MMS_MGMT_NOARG);
}
return (st);
}
if (st != 0) {
return (st);
}
if (fd != -1) {
fd = -1;
}
}
/*
* Use the device with only norewind
*/
continue;
}
/* list all drives, accessible or not */
if (st != 0) {
break;
}
if (fd < 0) {
"device busy");
} else {
}
continue;
}
/*
* Read the serial number
*/
continue;
}
}
/* No data transfered */
continue;
}
i++, bufp++) {
break;
}
}
/*
* Read vid and pid using inquiry. The MTIOCGETDRIVETYPE
* ioctl does not give you the full 16 bytes of product id.
*/
continue;
}
/* No data transfered */
continue;
}
break;
}
}
break;
}
}
/*
* Get the drive type
*/
}
fd = -1;
}
/* make sure the last drive made it to the list */
}
return (st);
}