Index: stable/9/share/man/man9/DEV_MODULE.9 =================================================================== --- stable/9/share/man/man9/DEV_MODULE.9 (revision 231293) +++ stable/9/share/man/man9/DEV_MODULE.9 (revision 231294) @@ -1,105 +1,105 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 2001 Alexander Langer .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd March 11, 2001 +.Dd January 19, 2012 .Dt DEV_MODULE 9 .Os .Sh NAME .Nm DEV_MODULE .Nd device driver module declaration macro .Sh SYNOPSIS .In sys/param.h .In sys/kernel.h .In sys/module.h .In sys/conf.h .Fn DEV_MODULE "name" "modeventhand_t evh" "void *arg" .Sh DESCRIPTION The .Fn DEV_MODULE macro declares a device driver kernel module. It fills in a .Vt moduledata_t structure and then calls .Fn DECLARE_MODULE with the correct args, where .Fa name is the name of the module and .Fa evh (with its argument .Fa arg ) is the event handler for the module (refer to .Xr DECLARE_MODULE 9 for more information). The event handler is supposed to create the device with .Fn make_dev on load and to destroy it when it is unloaded using .Fn destroy_dev . .Sh EXAMPLES .Bd -literal #include #include static struct cdevsw foo_devsw = { ... }; -static dev_t sdev; +static struct cdev *sdev; static int foo_load(module_t mod, int cmd, void *arg) { int err = 0; switch (cmd) { case MOD_LOAD: sdev = make_dev(&foo_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "foo"); break; /* Success*/ case MOD_UNLOAD: case MOD_SHUTDOWN: destroy_dev(sdev); break; /* Success*/ default: err = EINVAL; break; } return(err); } DEV_MODULE(foo, foo_load, NULL); .Ed .Sh SEE ALSO .Xr DECLARE_MODULE 9 , .Xr destroy_dev 9 , .Xr make_dev 9 , .Xr module 9 .Sh AUTHORS This manual page was written by .An Alexander Langer Aq alex@FreeBSD.org . Index: stable/9/share/man/man9/devtoname.9 =================================================================== --- stable/9/share/man/man9/devtoname.9 (revision 231293) +++ stable/9/share/man/man9/devtoname.9 (revision 231294) @@ -1,57 +1,57 @@ .\" Copyright (c) 1999 Chris Costello .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd September 25, 1999 +.Dd January 19, 2012 .Dt DEVTONAME 9 .Os .Sh NAME .Nm devtoname -.Nd "converts dev_t data into a string indicating the device name" +.Nd "converts character device into a string indicating the device name" .Sh SYNOPSIS .In sys/param.h .In sys/conf.h .Ft const char * -.Fn devtoname "dev_t dev" +.Fn devtoname "struct cdev *dev" .Sh DESCRIPTION The .Fn devtoname function returns a pointer to the name of the device passed to it. The name is whatever was set to it in .Fn make_dev . If no name is associated with .Va dev , a pointer to a string consisting of a .Dq # followed by .Dq Va major Ns / Ns Va minor as it applies to .Va dev is returned. .Sh HISTORY The .Fn devtoname interface first appeared in .Fx 4.0 Index: stable/9/share/man/man9/physio.9 =================================================================== --- stable/9/share/man/man9/physio.9 (revision 231293) +++ stable/9/share/man/man9/physio.9 (revision 231294) @@ -1,131 +1,131 @@ .\" $NetBSD: physio.9,v 1.2 1996/11/11 00:05:12 lukem Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation .\" by Paul Kranenburg. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd July 8, 2004 +.Dd January 19, 2012 .Dt PHYSIO 9 .Os .Sh NAME .Nm physio .Nd initiate I/O on raw devices .Sh SYNOPSIS .In sys/param.h .In sys/systm.h .In sys/bio.h .In sys/buf.h .Ft int -.Fn physio "dev_t dev" "struct uio *uio" "int ioflag" +.Fn physio "struct cdev *dev" "struct uio *uio" "int ioflag" .Sh DESCRIPTION The .Fn physio is a helper function typically called from character device .Fn read and .Fn write routines to start I/O on a user process buffer. The maximum amount of data to transfer with each call is determined by .Fa dev->si_iosize_max . The .Fn physio call converts the I/O request into a .Fn strategy request and passes the new request to the driver's .Fn strategy routine for processing. .Pp Since .Fa uio normally describes user space addresses, .Fn physio needs to lock those pages into memory. This is done by calling .Fn vmapbuf for the appropriate pages. .Fn physio always awaits the completion of the entire requested transfer before returning, unless an error condition is detected earlier. .Pp A break-down of the arguments follows: .Bl -tag -width indent .It Fa dev The device number identifying the device to interact with. .It Fa uio The description of the entire transfer as requested by the user process. Currently, the results of passing a .Fa uio structure with the .Va uio_segflg set to anything other than .Dv UIO_USERSPACE are undefined. .It Fa ioflag The ioflag argument from the .Fn read or .Fn write function calling .Fn physio . .El .Sh RETURN VALUES If successful .Fn physio returns 0. .Er EFAULT is returned if the address range described by .Fa uio is not accessible by the requesting process. .Fn physio will return any error resulting from calls to the device strategy routine, by examining the .Dv B_ERROR buffer flag and the .Va b_error field. Note that the actual transfer size may be less than requested by .Fa uio if the device signals an .Dq "end of file" condition. .Sh SEE ALSO .Xr read 2 , .Xr write 2 .Sh HISTORY The .Nm manual page is originally from .Nx with minor changes for applicability with .Fx . .Pp The .Nm call has been completely re-written for providing higher I/O and paging performance. Index: stable/9/share/man/man9/uio.9 =================================================================== --- stable/9/share/man/man9/uio.9 (revision 231293) +++ stable/9/share/man/man9/uio.9 (revision 231294) @@ -1,215 +1,215 @@ .\" .\" Copyright (c) 1997 Joerg Wunsch .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd July 9, 2011 +.Dd January 19, 2012 .Dt UIO 9 .Os .Sh NAME .Nm uio , .Nm uiomove , .Nm uiomove_nofault .Nd device driver I/O routines .Sh SYNOPSIS .In sys/types.h .In sys/uio.h .Bd -literal struct uio { struct iovec *uio_iov; /* scatter/gather list */ int uio_iovcnt; /* length of scatter/gather list */ off_t uio_offset; /* offset in target object */ ssize_t uio_resid; /* remaining bytes to copy */ enum uio_seg uio_segflg; /* address space */ enum uio_rw uio_rw; /* operation */ struct thread *uio_td; /* owner */ }; .Ed .Ft int .Fn uiomove "void *buf" "int howmuch" "struct uio *uiop" .Ft int .Fn uiomove_nofault "void *buf" "int howmuch" "struct uio *uiop" .Sh DESCRIPTION The functions .Fn uiomove and .Fn uiomove_nofault are used to transfer data between buffers and I/O vectors that might possibly cross the user/kernel space boundary. .Pp As a result of any .Xr read 2 , .Xr write 2 , .Xr readv 2 , or .Xr writev 2 system call that is being passed to a character-device driver, the appropriate driver .Va d_read or .Va d_write entry will be called with a pointer to a .Vt "struct uio" being passed. The transfer request is encoded in this structure. The driver itself should use .Fn uiomove or .Fn uiomove_nofault to get at the data in this structure. .Pp The fields in the .Vt uio structure are: .Bl -tag -width ".Va uio_iovcnt" .It Va uio_iov The array of I/O vectors to be processed. In the case of scatter/gather I/O, this will be more than one vector. .It Va uio_iovcnt The number of I/O vectors present. .It Va uio_offset The offset into the device. .It Va uio_resid The remaining number of bytes to process, updated after transfer. .It Va uio_segflg One of the following flags: .Bl -tag -width ".Dv UIO_USERSPACE" .It Dv UIO_USERSPACE The I/O vector points into a process's address space. .It Dv UIO_SYSSPACE The I/O vector points into the kernel address space. .It Dv UIO_NOCOPY Do not copy, already in object. .El .It Va uio_rw The direction of the desired transfer, either .Dv UIO_READ or .Dv UIO_WRITE . .It Va uio_td The pointer to a .Vt "struct thread" for the associated thread; used if .Va uio_segflg indicates that the transfer is to be made from/to a process's address space. .El .Pp The function .Fn uiomove_nofault requires that the buffer and I/O vectors be accessible without incurring a page fault. The source and destination addresses must be physically mapped for read and write access, respectively, and neither the source nor destination addresses may be pageable. Thus, the function .Fn uiomove_nofault can be called from contexts where acquiring virtual memory system locks or sleeping are prohibited. .Sh RETURN VALUES On success .Fn uiomove and .Fn uiomove_nofault will return 0; on error they will return an appropriate error code. .Sh EXAMPLES The idea is that the driver maintains a private buffer for its data, and processes the request in chunks of maximal the size of this buffer. Note that the buffer handling below is very simplified and will not work (the buffer pointer is not being advanced in case of a partial read), it is just here to demonstrate the .Nm handling. .Bd -literal /* MIN() can be found there: */ #include #define BUFSIZE 512 static char buffer[BUFSIZE]; static int data_available; /* amount of data that can be read */ static int -fooread(dev_t dev, struct uio *uio, int flag) +fooread(struct cdev *dev, struct uio *uio, int flag) { int rv, amnt; rv = 0; while (uio->uio_resid > 0) { if (data_available > 0) { amnt = MIN(uio->uio_resid, data_available); rv = uiomove(buffer, amnt, uio); if (rv != 0) break; data_available -= amnt; } else tsleep(...); /* wait for a better time */ } if (rv != 0) { /* do error cleanup here */ } return (rv); } .Ed .Sh ERRORS .Fn uiomove and .Fn uiomove_nofault will fail and return the following error code if: .Bl -tag -width Er .It Bq Er EFAULT The invoked .Xr copyin 9 or .Xr copyout 9 returned .Er EFAULT .El .Pp In addition, .Fn uiomove_nofault will fail and return the following error code if: .Bl -tag -width Er .It Bq Er EFAULT A page fault occurs. .El .Sh SEE ALSO .Xr read 2 , .Xr readv 2 , .Xr write 2 , .Xr writev 2 , .Xr copyin 9 , .Xr copyout 9 , .Xr sleep 9 .Sh HISTORY The .Nm mechanism appeared in some early version of .Ux . .Sh AUTHORS This manual page was written by .An J\(:org Wunsch . Index: stable/9/share/man/man9/vcount.9 =================================================================== --- stable/9/share/man/man9/vcount.9 (revision 231293) +++ stable/9/share/man/man9/vcount.9 (revision 231294) @@ -1,73 +1,73 @@ .\" -*- nroff -*- .\" .\" Copyright (c) 2000 Andrew Stevenson .\" .\" All rights reserved. .\" .\" This program is free software. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" If this manual page travels to places exotic (like projects other than .\" FreeBSD) I would love to hear about it. .\" Andrew .\" .\" $FreeBSD$ .\" -.Dd February 6, 2001 +.Dd January 19, 2012 .Dt VCOUNT 9 .Os .Sh NAME .Nm vcount , .Nm count_dev .Nd "get total number of references to a device" .Sh SYNOPSIS .In sys/param.h .In sys/time.h .In sys/conf.h .In sys/vnode.h .Ft int .Fn vcount "struct vnode *vp" .Ft int -.Fn count_dev "dev_t dev" +.Fn count_dev "struct cdev *dev" .Sh DESCRIPTION .Fn vcount is used to get the number of references to a particular device. It allows for the fact that multiple vnodes may reference the same device. .Fn count_dev does the same thing as .Fn vcount , but takes a -.Vt dev_t +.Vt "struct cdev" rather than a .Vt "struct vnode" pointer as an argument. .Sh RETURN VALUES .Fn vcount and .Fn count_dev both return the number of references to the device. .Sh SEE ALSO .Xr VFS 9 , .Xr vnode 9 .Sh AUTHORS This manual page was written by .An Andrew Stevenson . Index: stable/9/share/man/man9 =================================================================== --- stable/9/share/man/man9 (revision 231293) +++ stable/9/share/man/man9 (revision 231294) Property changes on: stable/9/share/man/man9 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/share/man/man9:r230330