Subject: VOP_WRITE and struct uio
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 09/12/2002 11:56:09
I've got some questions about VOP_WRITE and the struct uio passed to
it.  What documentation I've found is unclear about just what the
interface contract is.

I'm writing a VOP_WRITE routine, and I find that I need to uiomove()
data before being sure it will actually get written.  But the way
VOP_WRITE indicates how much got written is to leave uio_resid holding
the unwritten amount.  I can certainly just bash uio_resid to make this
correct - but is it going to break anything to return from a VOP_WRITE
routine with uio_resid describing more space than the uio_iov and
uio_iovcnt fields describe?  (I'll also have to bash uio_offset; at
least one caller of VOP_WRITE uses that too.  But that's easy.)

About all I can see that doesn't depend on the rest of the kernel to
not break when faced with such an inconsistent struct uio is to clone
the uio and iovecs and call uiomove on the copy.  (But then I need to
write uiodontmove, or uioskip, or some such, to advance the fields
without actually moving data, once I know how much actually got
written.)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B