xref: /openbsd/share/man/man4/vnd.4 (revision 3489512b)
1.\"	$OpenBSD: vnd.4,v 1.28 2014/07/02 22:35:42 matthew Exp $
2.\"	$NetBSD: vnd.4,v 1.1 1995/12/30 18:10:48 thorpej Exp $
3.\"
4.\" Copyright (c) 1995 Jason R. Thorpe.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed for the NetBSD Project
18.\"	by Jason R. Thorpe.
19.\" 4. Neither the name of the author nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
30.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.Dd $Mdocdate: July 2 2014 $
36.Dt VND 4
37.Os
38.Sh NAME
39.Nm vnd
40.Nd vnode disk driver
41.Sh SYNOPSIS
42.Cd "pseudo-device vnd" Op Ar count
43.Sh DESCRIPTION
44The
45.Nm
46driver provides a disk-like interface to a file.
47This is useful for a variety of applications, such as building miniroot or
48floppy disk images.
49.Pp
50This document assumes familiarity with how to generate kernels and
51how to properly configure disks and pseudo-devices in a kernel
52configuration file.
53.Pp
54In order to compile in support for
55.Nm vnd
56devices, a line similar to the following must be present in the kernel
57configuration file:
58.Bd -unfilled -offset indent
59pseudo-device	vnd	4	# vnode disk driver
60.Ed
61.Pp
62The
63.Ar count
64argument is how many
65.Nm vnds
66memory is allocated for at boot time.
67In this example, no more than 4
68.Nm vnds
69may be configured.
70.Pp
71There is a run-time utility that is used for configuring
72.Nm vnds .
73See
74.Xr vnconfig 8
75for more information.
76.Sh IOCTL INTERFACE
77The following
78.Xr ioctl 2
79calls are defined in
80.In dev/vndioctl.h :
81.Bl -tag -width Ds
82.It Dv VNDIOCSET Fa "struct vnd_ioctl *"
83Associate the file
84.Va vnd_file
85with a
86.Nm
87pseudo device, optionally encrypted using the Blowfish cipher and the key
88specified in
89.Va vnd_key
90of length
91.Va vnd_keylen .
92The size of the configured device is returned in
93.Va vnd_size .
94.Bd -literal -offset indent
95struct vnd_ioctl {
96	char	*vnd_file;
97	off_t	vnd_size;
98	u_char	*vnd_key;
99	int	vnd_keylen;
100};
101.Ed
102.It Dv VNDIOCCLR Fa "struct vnd_ioctl *"
103Disassociate a
104.Nm
105device.
106.It Dv VNDIOCGET Fa "struct vnd_user *"
107Get the associated file name, device, inode number, and unit number of a
108.Nm
109device.
110If
111.Va vnu_unit
112is \-1, information on the
113.Nm
114device corresponding to the file descriptor passed to
115.Xr ioctl 2
116will be returned.
117Otherwise,
118.Va vnu_unit
119may contain the unit number of another
120.Nm
121device.
122This allows for opening just
123.Li vnd0
124and querying all available devices.
125.Bd -literal -offset indent
126struct vnd_user {
127	char	vnufile[VNDNLEN];
128	int	vnu_unit;
129	dev_t	vnu_dev;
130	ino_t	vnu_ino;
131};
132.Ed
133.El
134.Pp
135Additionally, some
136.Xr disklabel 8
137related
138.Xr ioctl 2
139calls defined in
140.In sys/dkio.h
141are available:
142.Dv DIOCGDINFO ,
143.Dv DIOCSDINFO ,
144and
145.Dv DIOCWDINFO .
146They are documented in
147.Xr sd 4 .
148.Sh FILES
149.Bl -tag -width /dev/{,r}vnd* -compact
150.It Pa /dev/{,r}vnd*
151.Nm
152device special files
153.El
154.Sh SEE ALSO
155.Xr ioctl 2 ,
156.Xr sd 4 ,
157.Xr disklabel 5 ,
158.Xr config 8 ,
159.Xr disklabel 8 ,
160.Xr fdisk 8 ,
161.Xr fsck 8 ,
162.Xr MAKEDEV 8 ,
163.Xr mount 8 ,
164.Xr newfs 8 ,
165.Xr vnconfig 8
166