Skip to contentSkip to conversation

SG_IO open flags are which

DISCUSSION Pat LaVarre 1 participant 1 message Apr 6, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

Doug G:

Quoted 9 lines
Quoted 9 lines

Re: SG_IO open flags are which
http://marc.theaimsgroup.com/?t=107150658300002
...
So first try and open() with the (O_NONBLOCK
| O_RDWR) flags. If that yields ENOMEDIUM
look for the corresponding sg device name.
If the initial open() yields EROFS or EACESS
then try to open it (O_NONBLOCK | O_RDONLY).
...

Clear workarounds for three possible results, yes, thank you.

Naturally I fear uncertainly and doubt the effects of defaulting to O_RDWR or O_RDONLY.

Quoted 1 line
Quoted 1 line

Confused enough yet :-)

I can confirm ioctl SG_IO op x2A, in Linux-2.6.5, passes:

thru open O_NONBLOCK of mountable /dev/scd$n, and thru open (O_NONBLOCK | O_RDWR) of unmountable /dev/sg$n, but NOT thru open O_NONBLOCK of unmountable /dev/sg$n.

I get these same results no matter disc absent or present.

Next steps may include:

a) Contrast PDT x05 ioctl CDROM_SEND_PACKET with ioctl SG_IO.

b) Trace when open/ close implies op x1E "PREVENT" "ALLOW" around ioctl, even ioctl of op x1B "START" "STOP" Eject.

Pat LaVarre