kqueue/kevent support in scsi device drivers

Valentin Nechayev netch at iv.nn.kiev.ua
Sat May 31 00:52:07 PDT 2003


 Fri, May 30, 2003 at 12:14:50, jaya_bhat100 (Jayasheela Bhat) wrote about "kqueue/kevent support in scsi device drivers": 

JB> At present, kevent is supported for vnode, fifos, pipes and sockets, I believe. 
JB> I would like to use kevent notification in scsi devices. But the drivers scsi_xx.c do not support it. Whether I can implement it in scsi device driver using KNOTE? 
JB> I was going through tty.c where KNOTE is used. struct 'tty' has the support for it. The same is not available in struct 'disk'.  
JB> Could anyone tell me whether it is possible to implement it and how??

What is the aim to do it? tty, sockets, pipes, fifos are sequential devices
with data pushing to it. Disks are random access devices, this is the main
reason why disk/filesystem read() can't be nonblocking by itself: there
are two different operations in them - 1) process says to kernel what it
want read, 2) kernel returns data. (And similarly for write().)
To read from random access devices, AIO API was created (aio_read(),
aio_write(), etc.), and it doesn't require your explicit KNOTE adding:
it already supports EVFILT_AIO and SIGEV_KEVENT.

If you can access something at SCSI subsystem as sequential device,
let you go. But, it's better to implement KNOTE in driver of this device
itself, not common SCSI layer, which is too complicated to allow it.


-netch-


More information about the freebsd-hackers mailing list