Date: Wed, 29 Nov 1995 14:05:44 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: msmith@atrad.adelaide.edu.au (Michael Smith) Cc: hackers@freebsd.org Subject: Re: uio question... Message-ID: <199511292105.OAA28617@phaeton.artisoft.com> In-Reply-To: <199511290134.BAA09808@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Nov 29, 95 01:34:51 am
next in thread | previous in thread | raw e-mail | index | archive | help
> Okay, my entry for the lame-device-driver-question of the month 8) > > Given a device read function passed a uio struct, what's the correct way > to determine the total size of the read request? > > I have two possibles here : walk the array of iovec structures, or > contemplate the uio_resid field, which appears to be used by a number of > other drivers... > > Experience? The "resid" is used to determine residual read remaining. Typically, a uio struct will have an iovec count of one, or the alternate iovec's will be non-contiguous. In either case , for a non-one iovec count in the uio, you *must* walk the iovec list to return any information. The question is whether your driver does scatter/gather itself, or whether it will be handling I/O one iovec at a time. You should look at the tty, generic (controller independent) scsi code, one of the SCSI controller dependendt code pieces (the 1540/1740? I recommend against the NCR/AHA2xxx code because of the additional complexity) and the readv/writev system call code in /usr/src/sys/kern. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511292105.OAA28617>