fhandle
typedef struct fhandle fhandle_t;
fhp = (struct fhandle *)ap->a_data;
fhp = (struct fhandle *)ap->a_data;
close(disc->fhandle);
disc->fhandle = -1;
if (ioctl(disc->fhandle, SCIOCCOMMAND, &req) == -1)
error = ioctl(disc->fhandle, SCIOCIDENTIFY, &raddr);
disc->fhandle = open(disc->dev_name, O_RDWR | O_NONBLOCK, 0);
if (disc->fhandle<0) {
flags = fcntl(disc->fhandle, F_GETFL);
fcntl(disc->fhandle, F_SETFL, flags);
if (fstat(disc->fhandle, &stat) < 0) {
close(disc->fhandle);
disc->fhandle = -1;
error = ioctl(disc->fhandle, SG_IO, &req);
ioctl(disc->fhandle, SG_EMULATED_HOST, &emulated);
error = ioctl(disc->fhandle, SG_GET_SCSI_ID, &sg_scsi_id);
error = ioctl(disc->fhandle, SCSI_IOCTL_GET_IDLUN, &sg_id);
disc->fhandle = open(disc->dev_name, O_RDWR | O_NONBLOCK, 0);
if (disc->fhandle < 0) {
close(disc->fhandle);
disc->fhandle = -1;
disc->fhandle = open(disc->dev_name, O_RDWR, 0); /* no create */
if (disc->fhandle<0) {
if (fstat(disc->fhandle, &dstat) < 0) {
int fhandle;