[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: drivers customizing mmap(2)
On Tue, Mar 05, 2013 at 05:08:40PM +0000, Taylor R Campbell wrote:
> I thought that
> perhaps the device's cdevsw could provide an alternate to d_mmap,
> int (*d_get_pagerops)(dev_t, struct uvm_pagerops **) or something,
> for uvm_mmap to call.
> This is more or less what FreeBSD did -- they added a d_mmap_single
> operation to struct cdevsw,
> int (*d_mmap_single)(struct cdev *, vm_ooffset_t *, vm_size_t,
> struct vm_object **, int);
> which returns a vm object rather than a set of pager ops for a vm
> object. This would obviously serve too, since it worked for FreeBSD's
> drm purposes, and might be easier to implement.
It also seems somewhat tidier to fix/extend d_mmap than to fiddle with
struct file, I think.
although in a less immediate/practical vein, as I was muttering about
in chat last night your suggestion has me wondering if there's any
real reason devices need to be vnodes at all. Right now files can be
vnodes or sockets; there's no obvious reason they couldn't instead be
vnodes or sockets or devices, so device I/O doesn't go through vnodes
any more. There would still need to be device vnodes for the on-disk
manifestation, but they'd be stubs and wouldn't need to do anything
This would kill off a lot of annoying current problems/code and I
don't see any immediately obvious reason it wouldn't be viable. Other
than of course that it's a major undertaking.
David A. Holland
Main Index |
Thread Index |