Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Nov 1995 21:01:30 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        msmith@atrad.adelaide.edu.au (Michael Smith)
Cc:        terry@lambert.org, msmith@atrad.adelaide.edu.au, hackers@freebsd.org
Subject:   Re: uio question...
Message-ID:  <199511300401.VAA29629@phaeton.artisoft.com>
In-Reply-To: <199511301205.MAA13515@genesis.atrad.adelaide.edu.au> from "Michael Smith" at Nov 30, 95 12:05:28 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 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.

It's set to the count.  It's the bytes remaining to be read, and it
starts out set to "all of 'em".  It's decremented as the user buffer(s)
are filled out by uiomove.

So it may seem odd that it doesn't count up, but it's not broken.

> > 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.

uiomove will bcopy in SYSSPACE or copyout if the target is in USERSPACE;
so as long as it's a user buffer and you specify it's in USERSPACE, there
isn't a problem: you don't need another buffer.

Typically, the FS code will copy to a buffer off the vnode.  This is
the cache.  Then it copies out (look in /sys/ufs/ufs/ufs_readwrite.c).

For a device you won't be caching.  Depending on the need for ISA bounce,
you can avoid the other buffer.  If you need an ISA bounce, then you
have to check the physical address and if it's over (or spans) the 16M
boundry, you will need to bounce it.

The 1542 driver is a good example for how to bounce a scatter/gather
operation for an ISA device.


					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?199511300401.VAA29629>