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