xref: /openbsd/share/man/man9/getdevvp.9 (revision 961ae58b)
1.\"     $OpenBSD: getdevvp.9,v 1.9 2020/11/14 10:35:58 jmc Exp $
2.\"
3.\" Copyright (C) 2002 Peter A. Werner. All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice(s), this list of conditions and the following disclaimer as
10.\"    the first lines of this file unmodified other than the possible
11.\"    addition of one or more copyright notices.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice(s), this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
26.\" DAMAGE.
27.\"
28.\"
29.Dd $Mdocdate: November 14 2020 $
30.Dt GETDEVVP 9
31.Os
32.Sh NAME
33.Nm getdevvp ,
34.Nm bdevvp ,
35.Nm cdevvp
36.Nd create a vnode for a device
37.Sh SYNOPSIS
38.In sys/param.h
39.In sys/vnode.h
40.Ft int
41.Fn getdevvp "dev_t dev" "struct vnode **vpp" "enum vtype type"
42.Ft int
43.Fn bdevvp "dev_t dev" "struct vnode **vpp"
44.Ft int
45.Fn cdevvp "dev_t dev" "struct vnode **vpp"
46.Sh DESCRIPTION
47The
48.Fn getdevvp
49function creates a vnode for a device of type
50.Fa type
51with a device number of
52.Fa dev ,
53and returns a pointer to it in
54.Fa vpp .
55.Pp
56Its arguments are:
57.Bl -tag -width "rootrefs"
58.It Fa dev
59The device number of the desired device.
60.It Fa vpp
61Where the vnode will be returned on success.
62.It Fa type
63The type of device, either:
64.Bl -tag -width "VBLK"
65.It Dv VBLK
66For a block device, or
67.It Dv VCHR
68for a character device.
69.El
70.El
71.Pp
72.Fn bdevvp
73and
74.Fn cdevvp
75use getdevvp internally, specifying the third argument.
76.Fn bdevvp
77will create a vnode for a block device, and is used for the root file system
78and swap areas, among other things.
79.Fn cdevvp
80will create a vnode for a character device and is used in console handling.
81.Sh RETURN VALUES
82All functions return 0 on success.
83If an error occurs, vpp will point to a NULLVP.
84See
85.Xr getnewvnode 9
86for further return values.
87.Sh SEE ALSO
88.Xr getnewvnode 9 ,
89.Xr vnode 9
90