freebsd-skq/sys
John Baldwin 7077c42623 Add a new file operations hook for mmap operations. File type-specific
logic is now placed in the mmap hook implementation rather than requiring
it to be placed in sys/vm/vm_mmap.c.  This hook allows new file types to
support mmap() as well as potentially allowing mmap() for existing file
types that do not currently support any mapping.

The vm_mmap() function is now split up into two functions.  A new
vm_mmap_object() function handles the "back half" of vm_mmap() and accepts
a referenced VM object to map rather than a (handle, handle_type) tuple.
vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a
a VM object and then calling vm_mmap_object() to handle the actual mapping.
The vm_mmap() function remains for use by other parts of the kernel
(e.g. device drivers and exec) but now only supports mapping vnodes,
character devices, and anonymous memory.

The mmap() system call invokes vm_mmap_object() directly with a NULL object
for anonymous mappings.  For mappings using a file descriptor, the
descriptors fo_mmap() hook is invoked instead.  The fo_mmap() hook is
responsible for performing type-specific checks and adjustments to
arguments as well as possibly modifying mapping parameters such as flags
or the object offset.  The fo_mmap() hook routines then call
vm_mmap_object() to handle the actual mapping.

The fo_mmap() hook is optional.  If it is not set, then fo_mmap() will
fail with ENODEV.  A fo_mmap() hook is implemented for regular files,
character devices, and shared memory objects (created via shm_open()).

While here, consistently use the VM_PROT_* constants for the vm_prot_t
type for the 'prot' variable passed to vm_mmap() and vm_mmap_object()
as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines.
Previously some places were using the mmap()-specific PROT_* constants
instead.  While this happens to work because PROT_xx == VM_PROT_xx,
using VM_PROT_* is more correct.

Differential Revision:	https://reviews.freebsd.org/D2658
Reviewed by:	alc (glanced over), kib
MFC after:	1 month
Sponsored by:	Chelsio
2015-06-04 19:41:15 +00:00
..
amd64 Use tunable 'hw.vmm.svm.features' to disable specific SVM features even 2015-06-04 02:12:23 +00:00
arm Better handling of userland sysarch() requests to flush icache. 2015-06-03 14:07:50 +00:00
arm64 ddb: finish converting boolean values. 2015-05-21 15:16:18 +00:00
boot userboot: enable bzipfs support 2015-06-03 10:10:00 +00:00
bsm
cam Handle EDQUOT backend storage errors same as ENOSPC. 2015-05-06 19:47:31 +00:00
cddl Add missed {}. 2015-05-27 19:28:14 +00:00
compat Provide vnode in memory map info for files on tmpfs 2015-06-02 18:37:04 +00:00
conf Change EM_MULTIQUEUE to a real kernconf entry and enable support for 2015-06-03 18:01:09 +00:00
contrib MFV: r283965 2015-06-03 19:39:59 +00:00
crypto In the version of gcc in the FreeBSD tree, this modification was made to 2015-04-16 17:42:52 +00:00
ddb ddb: de-register 2015-05-23 14:59:27 +00:00
dev Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
fs Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
gdb CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
geom CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
gnu The GNU Amlogic DTS files have some errors (e.g. bad register 2015-04-11 08:17:39 +00:00
i386 When I merged the lemul branch I missied kib@'s r282708 commit. 2015-05-25 20:44:46 +00:00
isa
kern Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
kgssapi
libkern Add more __aeabi_memcpy functions, later versions of clang generate calls 2015-05-31 07:31:20 +00:00
mips Similarly to other architecture, add the include for cpufunc.h which is 2015-05-28 12:33:21 +00:00
modules Change EM_MULTIQUEUE to a real kernconf entry and enable support for 2015-06-03 18:01:09 +00:00
net CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
net80211 Tag outbound raw 802.11 frames with both the node and an mbuf tag 2015-06-04 17:54:41 +00:00
netgraph CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
netinet Export a pointer to the SCTP socket. This is needed to add SCTP support 2015-06-04 12:46:56 +00:00
netinet6 Move RTM announces into generic code to be independent from Layer2 code. 2015-05-29 10:24:16 +00:00
netipsec CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
netnatm
netpfil CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten 2015-05-22 17:05:21 +00:00
netsmb
nfs Avoid closing unallocated socket in case socreate fails. 2015-02-28 20:30:29 +00:00
nfsclient Remove some oldnfs remnants. 2015-04-18 16:08:06 +00:00
nfsserver
nlm
ofed Add SIOCGI2C ioctl support to the driver. Would work only on ConnectX-3 2015-05-27 13:42:28 +00:00
opencrypto Use the correct number of arguments for the 2015-05-25 01:31:39 +00:00
pc98 Build GENERIC with RACCT/RCTL support by default. Note that it still 2015-05-14 14:03:55 +00:00
powerpc The kernel sends signals to the processes via ABI specific sv_sendsig method. 2015-05-24 17:56:02 +00:00
rpc Remove hard limits on number of accepting NFS connections. 2015-04-07 10:25:27 +00:00
security cred: add proc_set_cred helper 2015-03-16 00:10:03 +00:00
sparc64 The kernel sends signals to the processes via ABI specific sv_sendsig method. 2015-05-24 17:56:02 +00:00
sys Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
teken
tools
ufs Syncing a directory vnode might drop the vnode lock in the 2015-06-03 20:48:00 +00:00
vm Add a new file operations hook for mmap operations. File type-specific 2015-06-04 19:41:15 +00:00
x86 Remove several write-only variables, all reported by the gcc 4.9 2015-05-29 13:24:17 +00:00
xdr
xen xen: introduce a newbus function to allocate unused memory 2015-05-08 14:48:40 +00:00
Makefile Kill EoL whitespace. 2015-05-29 14:03:07 +00:00