1 /*	$OpenBSD: fdesc.h,v 1.9 2003/08/14 07:46:39 mickey Exp $	*/
2 /*	$NetBSD: fdesc.h,v 1.9 1996/02/09 22:40:03 christos Exp $	*/
3 
4 /*
5  * Copyright (c) 1992, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * This code is derived from software donated to Berkeley by
9  * Jan-Simon Pendry.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *	@(#)fdesc.h	8.6 (Berkeley) 8/20/94
36  *
37  * #Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp #
38  */
39 
40 #ifdef _KERNEL
41 #define FD_ROOT		2
42 #define FD_DEVFD	3
43 #define FD_STDIN	4
44 #define FD_STDOUT	5
45 #define FD_STDERR	6
46 #define FD_CTTY		7
47 #define FD_DESC		8
48 #define FD_MAX		12
49 
50 typedef enum {
51 	Froot,
52 	Fdevfd,
53 	Fdesc,
54 	Flink,
55 	Fctty
56 } fdntype;
57 
58 struct fdescnode {
59 	LIST_ENTRY(fdescnode) fd_hash;	/* Hash list */
60 	struct vnode	*fd_vnode;	/* Back ptr to vnode */
61 	fdntype		fd_type;	/* Type of this node */
62 	unsigned	fd_fd;		/* Fd to be dup'ed */
63 	char		*fd_link;	/* Link to fd/n */
64 	int		fd_ix;		/* filesystem index */
65 };
66 
67 #define	VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
68 
69 extern dev_t devctty;
70 extern int fdesc_init(struct vfsconf *);
71 extern int fdesc_root(struct mount *, struct vnode **);
72 extern int fdesc_allocvp(fdntype, int, struct mount *, struct vnode **);
73 extern int (**fdesc_vnodeop_p)(void *);
74 extern const struct vfsops fdesc_vfsops;
75 #endif /* _KERNEL */
76