[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Question on vnode's type
From:       Terry Lambert <tlambert () primenet ! com>
Date:       1998-09-28 0:53:50
[Download RAW message or body]

> There are nine types of vnodes available: VNON, VREG, VDIR, VBLK, VCHR,
> VLNK, VSOCK, VFIFO, VBAD.  Can anyone describe for me their usages?
> 
> Any help is appreciated.

VNON		No type
VREG		A regular file
VDIR		A directory
VBLK		A block special device
VCHR		A character special device
VLNK		A symbolic link
VSOCK		A socket
VFIFO		A FIFO (named pipe)
VBAD		An old style bad sector map


It is also useful to know:

	VFIFO uses the "struct fileops" from /sys/kern/sys_pipe.c
	VSOCK uses the "struct fileops" from /sys/kern/sys_socket.c(*)
	Everything else uses the one from /sys/kern/vfs_vnops.c

	(*) The System V IPC calls are implemented using the POSIX
	    domain sockets.

In general, the VFIFO/VSOCK code, which is why "struct fileops" is
used at all, is an artifact of an incomplete integration of the VFS
code into the kernel.

In general, the problems associated with this are:

(1)	You can't use advisory locking on VFIFO/VSOCK vnodes.
(2)	You must take extra indirection overhead on all read,
	write, ioctl, poll, and close calls.
(3)	No other normal vnode operations are permitted, except
	as they are special cased (e.g., an fcntl(2) call to
	F_SETOWN/F_GETOWN won't work on a DTYPE_PIPE/DTYPE_FIFO,
	but will work on a DTYPE_VNODE/DTYPE_SOCKET).
(4)	It offends people who have aesthetic sensibilities.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic