]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man9/dev_clone.9
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man9 / dev_clone.9
1 .\" Copyright (c) 2008 Konstantin Belousov
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd January 3, 2009
28 .Dt DEV_CLONE 9
29 .Os
30 .Sh NAME
31 .Nm dev_clone ,
32 .Nm drain_dev_clone_events
33 .Nd eventhandler for name-based device cloning in devfs
34 .Sh SYNOPSIS
35 .In sys/param.h
36 .In sys/conf.h
37 .Ft void
38 .Fn clone_handler "void *arg" "struct ucred *cr" "char *name" "int namelen" "struct cdev **dev"
39 .Bd -literal
40 EVENTHANDLER_REGISTER(dev_clone, clone_handler, arg, priority);
41 .Ed
42 .Ft void
43 .Fn drain_dev_clone_events
44 .Sh DESCRIPTION
45 A device driver may register a listener that will be notified each time
46 a name lookup on the
47 .Xr devfs 5
48 mount point fails to find the vnode.
49 A listener shall be registered for the
50 .Va dev_clone
51 event.
52 When called, it is supplied with the first argument
53 .Va arg
54 that was specified at handler registration time,
55 appropriate credentials
56 .Va cr ,
57 and a name
58 .Va name
59 of length
60 .Va namelen
61 that we look for.
62 If the handler decides that the name is appropriate and wants to create the device
63 that will be associated with the name, it should return it to devfs
64 in the
65 .Va dev
66 argument.
67 .Pp
68 The
69 .Fn drain_dev_clone_events
70 function is a barrier.
71 It is guaranteed that all calls to eventhandlers for
72 .Nm dev_clone
73 that were started before
74 .Fn drain_dev_clone_events
75 call, are finished before it returns control.
76 .Sh SEE ALSO
77 .Xr devfs 5 ,
78 .Xr namei 9