diff options
author | jhb <jhb@FreeBSD.org> | 2009-06-01 21:32:52 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-06-01 21:32:52 +0000 |
commit | fea04a3fd158d65e9ffd20e50e38364d82b85c44 (patch) | |
tree | 3173f83adb95e5298ee26ee3bdedf7f6b4746d49 /sys/sys/conf.h | |
parent | 904747c9f98f0e11c35daca161c7253a12c080f6 (diff) | |
download | FreeBSD-src-fea04a3fd158d65e9ffd20e50e38364d82b85c44.zip FreeBSD-src-fea04a3fd158d65e9ffd20e50e38364d82b85c44.tar.gz |
Add an extension to the character device interface that allows character
device drivers to use arbitrary VM objects to satisfy individual mmap()
requests.
- A new d_mmap_single(cdev, &foff, objsize, &object, prot) callback is
added to cdevsw. This function is called for each mmap() request.
If it returns ENODEV, then the mmap() request will fall back to using
the device's device pager object and d_mmap(). Otherwise, the method
can return a VM object to satisfy this entire mmap() request via
*object. It can also modify the starting offset into this object via
*foff. This allows device drivers to use the file offset as a cookie
to identify specific VM objects.
- vm_mmap_vnode() has been changed to call vm_mmap_cdev() directly when
mapping V_CHR vnodes. This avoids duplicating all the cdev mmap
handling code and simplifies some of vm_mmap_vnode().
- D_VERSION has been bumped to D_VERSION_02. Older device drivers
using D_VERSION_01 are still supported.
MFC after: 1 month
Diffstat (limited to 'sys/sys/conf.h')
-rw-r--r-- | sys/sys/conf.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 05c4bb5..457e127 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -103,6 +103,7 @@ struct thread; struct uio; struct knote; struct clonedevs; +struct vm_object; struct vnode; /* @@ -136,6 +137,8 @@ typedef int d_poll_t(struct cdev *dev, int events, struct thread *td); typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn); typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot); +typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset, + vm_size_t size, struct vm_object **object, int nprot); typedef void d_purge_t(struct cdev *dev); typedef int d_spare2_t(struct cdev *dev); @@ -175,7 +178,8 @@ typedef int dumper_t( */ #define D_VERSION_00 0x20011966 #define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */ -#define D_VERSION D_VERSION_01 +#define D_VERSION_02 0x28042009 /* Add d_mmap_single */ +#define D_VERSION D_VERSION_02 /* * Flags used for internal housekeeping @@ -201,7 +205,7 @@ struct cdevsw { dumper_t *d_dump; d_kqfilter_t *d_kqfilter; d_purge_t *d_purge; - d_spare2_t *d_spare2; + d_mmap_single_t *d_mmap_single; uid_t d_uid; gid_t d_gid; mode_t d_mode; |