tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Porting Linux SCSI ioctl stuff (was: Re: LTFS)

Emmanuel Dreyfus <> wrote:

> I am currently working on building IBM ltfs as packaged by Tandberg. 
> The thing as Linux specific code to handle SCSI passthrough. If someone
> already ported it, I am interested.

For now the build chokes on a few SCSI related ioctl. I am looking for
the NetBSD counterparts

1) SG_IO is used by Linux to send aribtrary SCSI commands to a device
(here a st(4) device). It uses a sg_io_hdr_t structure, defined here:

NetBSD counterpart seems to be SCIOCCOMMAND, which uses a scsireq_t
defined in <sys/scsiio.h>. I did not try yet to map fields, but I have a
first problem: LTFS for Linux sets the flag field to
SG_FLAG_LUN_INHIBIT, which is defined in Linux header with the following
comment "default is to put device's lun into the 2nd byte of SCSI
command". How is that expressed using NetBSD SCIOCCOMMAND?

2) SCSI_IOCTL_GET_IDLUN, "Used to obtain PUN and LUN info.". It is
documented here:

I have not found yet NetBSD's flavor for this one. Hint welcome

3) SG_GET_RESERVED_SIZE / SG_SET_RESERVED_SIZE, which are defined here:
It seems this one is about ensuring kernel buffers are big enough for
I/O. I have not found NetBSD's way of dealing with this feature.
Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index