From owner-freebsd-hackers Sun Sep 27 17:54:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA20780 for freebsd-hackers-outgoing; Sun, 27 Sep 1998 17:54:16 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp01.primenet.com (smtp01.primenet.com [206.165.6.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA20771 for ; Sun, 27 Sep 1998 17:54:09 -0700 (PDT) (envelope-from tlambert@usr05.primenet.com) Received: (from daemon@localhost) by smtp01.primenet.com (8.8.8/8.8.8) id RAA27180; Sun, 27 Sep 1998 17:53:55 -0700 (MST) Received: from usr05.primenet.com(206.165.6.205) via SMTP by smtp01.primenet.com, id smtpd027165; Sun Sep 27 17:53:52 1998 Received: (from tlambert@localhost) by usr05.primenet.com (8.8.5/8.8.5) id RAA07815; Sun, 27 Sep 1998 17:53:50 -0700 (MST) From: Terry Lambert Message-Id: <199809280053.RAA07815@usr05.primenet.com> Subject: Re: Question on vnode's type To: bf20761@binghamton.edu (zhihuizhang) Date: Mon, 28 Sep 1998 00:53:50 +0000 (GMT) Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: from "zhihuizhang" at Sep 26, 98 11:43:45 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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