GETDEVVP(9) Kernel Developer's Manual GETDEVVP(9)

getdevvp, bdevvp, cdevvpcreate a vnode for a device

#include <sys/param.h>
#include <sys/vnode.h>

int
getdevvp(dev_t dev, struct vnode **vpp, enum vtype type);

int
bdevvp(dev_t dev, struct vnode **vpp);

int
cdevvp(dev_t dev, struct vnode **vpp);

The () function creates a vnode for a device of type type with a device number of dev, and returns a pointer to it in vpp.

Its arguments are:

dev
The device number of the desired device.
vpp
Where the vnode will be returned on success.
type
The type of device, either:
For a block device, or
for a character device.

() and () use getdevvp internally, specifying the third argument. bdevvp() will create a vnode for a block device, and is used for the root file system and swap areas, among other things. cdevvp() will create a vnode for a character device and is used in console handling.

All functions return 0 on success. If an error occurs, vpp will point to a NULLVP. See getnewvnode(9) for further return values.

getnewvnode(9), vnode(9)

November 14, 2020 OpenBSD 7.5