xref: /original-bsd/sys/miscfs/fdesc/fdesc.h (revision b6592f3d)
1 /*
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software donated to Berkeley by
6  * Jan-Simon Pendry.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)fdesc.h	8.6 (Berkeley) 08/20/94
11  *
12  * $Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp $
13  */
14 
15 #ifdef KERNEL
16 struct fdescmount {
17 	struct vnode	*f_root;	/* Root node */
18 };
19 
20 #define FD_ROOT		2
21 #define FD_DEVFD	3
22 #define FD_STDIN	4
23 #define FD_STDOUT	5
24 #define FD_STDERR	6
25 #define FD_CTTY		7
26 #define FD_DESC		8
27 #define FD_MAX		12
28 
29 typedef enum {
30 	Froot,
31 	Fdevfd,
32 	Fdesc,
33 	Flink,
34 	Fctty
35 } fdntype;
36 
37 struct fdescnode {
38 	LIST_ENTRY(fdescnode) fd_hash;	/* Hash list */
39 	struct vnode	*fd_vnode;	/* Back ptr to vnode */
40 	fdntype		fd_type;	/* Type of this node */
41 	unsigned	fd_fd;		/* Fd to be dup'ed */
42 	char		*fd_link;	/* Link to fd/n */
43 	int		fd_ix;		/* filesystem index */
44 };
45 
46 #define VFSTOFDESC(mp)	((struct fdescmount *)((mp)->mnt_data))
47 #define	VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
48 
49 extern dev_t devctty;
50 extern int fdesc_init __P((void));
51 extern int fdesc_root __P((struct mount *, struct vnode **));
52 extern int fdesc_allocvp __P((fdntype, int, struct mount *, struct vnode **));
53 extern int (**fdesc_vnodeop_p)();
54 extern struct vfsops fdesc_vfsops;
55 #endif /* KERNEL */
56