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