]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/ng_device.4
base: Remove support for the VTOC8 partitioning scheme
[FreeBSD/FreeBSD.git] / share / man / man4 / ng_device.4
1 .\" Copyright (c) 2002 Mark Santcroos <marks@ripe.net>
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\" 3. The name of the author may not be used to endorse or promote products
12 .\"    derived from this software without specific prior written permission.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd November 8, 2021
28 .Dt NG_DEVICE 4
29 .Os
30 .Sh NAME
31 .Nm ng_device
32 .Nd device netgraph node type
33 .Sh SYNOPSIS
34 .In netgraph/ng_device.h
35 .Sh DESCRIPTION
36 A
37 .Nm device
38 node is both a netgraph node and a system device interface.
39 When a
40 .Nm device
41 node is created, a new device entry appears which is accessible via the
42 regular file operators such as
43 .Xr open 2 ,
44 .Xr close 2 ,
45 .Xr read 2 ,
46 .Xr write 2 ,
47 etc.
48 .Pp
49 The first node is created as
50 .Pa /dev/ngd0 ,
51 subsequent nodes are
52 .Pa /dev/ngd1 , /dev/ngd2 ,
53 etc.
54 .Sh HOOKS
55 A
56 .Nm device
57 node has a single hook with an arbitrary name.
58 All data coming in over the hook will be presented to the device
59 for
60 .Xr read 2 .
61 All data coming in from the device entry by
62 .Xr write 2
63 will be forwarded to the hook.
64 .Sh CONTROL MESSAGES
65 The
66 .Nm device
67 node supports the generic control messages, plus the following:
68 .Bl -tag -width 3n
69 .It Dv NGM_DEVICE_GET_DEVNAME
70 Returns the device name corresponding to the node.
71 .It Dv NGM_DEVICE_ETHERALIGN
72 Apply the system ETHER_ALIGN offset to mbufs sent out the node's hook,
73 if running on an architecture that requires strict alignment.
74 Use this option when the data being injected via the device node ultimately
75 ends up being fed into the protocol stack as ethernet packets (e.g., via
76 an
77 .Xr ng_eiface 4
78 node).
79 .El
80 .\" Additionally, the node accepts
81 .\" .Xr ioctl 2 Ns s
82 .\" from the device entry.
83 .\" These will be encapsulated into
84 .\" .Xr netgraph 4
85 .\" messages and send out to the hook.
86 .Sh SHUTDOWN
87 This node shuts down upon receipt of a
88 .Dv NGM_SHUTDOWN
89 control message, or upon hook disconnection.
90 The associated device entry is removed and becomes available
91 for use by future
92 .Nm device
93 nodes.
94 .Sh SEE ALSO
95 .Xr netgraph 4 ,
96 .Xr ngctl 8
97 .Sh HISTORY
98 The
99 .Nm device
100 node type was first implemented in
101 .Fx 5.0 .
102 .Sh AUTHORS
103 .An Mark Santcroos Aq Mt marks@ripe.net
104 .An Gleb Smirnoff Aq Mt glebius@FreeBSD.org