From owner-freebsd-hackers Wed Nov 29 17:37:09 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id RAA11633 for hackers-outgoing; Wed, 29 Nov 1995 17:37:09 -0800 Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id RAA11623 for ; Wed, 29 Nov 1995 17:37:03 -0800 Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id MAA13515; Thu, 30 Nov 1995 12:05:29 GMT From: Michael Smith Message-Id: <199511301205.MAA13515@genesis.atrad.adelaide.edu.au> Subject: Re: uio question... To: terry@lambert.org (Terry Lambert) Date: Thu, 30 Nov 1995 12:05:28 +0000 () Cc: msmith@atrad.adelaide.edu.au, hackers@freebsd.org In-Reply-To: <199511292105.OAA28617@phaeton.artisoft.com> from "Terry Lambert" at Nov 29, 95 02:05:44 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1507 Sender: owner-hackers@freebsd.org Precedence: bulk Terry Lambert stands accused of saying: > > Given a device read function passed a uio struct, what's the correct way > > to determine the total size of the read request? > > 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. I presume resid is computed elsewhere? In this case, the 'asc' driver is broken, as it uses resid to determine the read size, at the very least. > The question is whether your driver does scatter/gather itself, or whether > it will be handling I/O one iovec at a time. I'm quite happy to do scatter/gather myself, but my impressions from uiomove() are that I'd still need a local buffer and then copyout(), so it would appear to be more efficient overall to collect the entire read in a single local buffer, and the uiomove it out. > You should look at the tty, generic (controller independent) scsi code, Thanks for the pointers. > Terry Lambert -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 041-122-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] "Who does BSD?" "We do Chucky, we do." [[