Home | History | Annotate | Line # | Download | only in ptyfs
ptyfs.h revision 1.1.2.3
      1  1.1.2.3  skrll /*	$NetBSD: ptyfs.h,v 1.1.2.3 2004/11/29 07:24:51 skrll Exp $	*/
      2  1.1.2.2  skrll 
      3  1.1.2.2  skrll /*
      4  1.1.2.2  skrll  * Copyright (c) 1993
      5  1.1.2.2  skrll  *	The Regents of the University of California.  All rights reserved.
      6  1.1.2.2  skrll  *
      7  1.1.2.2  skrll  * This code is derived from software contributed to Berkeley by
      8  1.1.2.2  skrll  * Jan-Simon Pendry.
      9  1.1.2.2  skrll  *
     10  1.1.2.2  skrll  * Redistribution and use in source and binary forms, with or without
     11  1.1.2.2  skrll  * modification, are permitted provided that the following conditions
     12  1.1.2.2  skrll  * are met:
     13  1.1.2.2  skrll  * 1. Redistributions of source code must retain the above copyright
     14  1.1.2.2  skrll  *    notice, this list of conditions and the following disclaimer.
     15  1.1.2.2  skrll  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1.2.2  skrll  *    notice, this list of conditions and the following disclaimer in the
     17  1.1.2.2  skrll  *    documentation and/or other materials provided with the distribution.
     18  1.1.2.2  skrll  * 3. Neither the name of the University nor the names of its contributors
     19  1.1.2.2  skrll  *    may be used to endorse or promote products derived from this software
     20  1.1.2.2  skrll  *    without specific prior written permission.
     21  1.1.2.2  skrll  *
     22  1.1.2.2  skrll  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1.2.2  skrll  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1.2.2  skrll  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1.2.2  skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1.2.2  skrll  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1.2.2  skrll  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1.2.2  skrll  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1.2.2  skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1.2.2  skrll  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1.2.2  skrll  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1.2.2  skrll  * SUCH DAMAGE.
     33  1.1.2.2  skrll  *
     34  1.1.2.2  skrll  *	@(#)procfs.h	8.9 (Berkeley) 5/14/95
     35  1.1.2.2  skrll  */
     36  1.1.2.2  skrll 
     37  1.1.2.2  skrll /*
     38  1.1.2.2  skrll  * Copyright (c) 1993 Jan-Simon Pendry
     39  1.1.2.2  skrll  *
     40  1.1.2.2  skrll  * This code is derived from software contributed to Berkeley by
     41  1.1.2.2  skrll  * Jan-Simon Pendry.
     42  1.1.2.2  skrll  *
     43  1.1.2.2  skrll  * Redistribution and use in source and binary forms, with or without
     44  1.1.2.2  skrll  * modification, are permitted provided that the following conditions
     45  1.1.2.2  skrll  * are met:
     46  1.1.2.2  skrll  * 1. Redistributions of source code must retain the above copyright
     47  1.1.2.2  skrll  *    notice, this list of conditions and the following disclaimer.
     48  1.1.2.2  skrll  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.1.2.2  skrll  *    notice, this list of conditions and the following disclaimer in the
     50  1.1.2.2  skrll  *    documentation and/or other materials provided with the distribution.
     51  1.1.2.2  skrll  * 3. All advertising materials mentioning features or use of this software
     52  1.1.2.2  skrll  *    must display the following acknowledgement:
     53  1.1.2.2  skrll  *	This product includes software developed by the University of
     54  1.1.2.2  skrll  *	California, Berkeley and its contributors.
     55  1.1.2.2  skrll  * 4. Neither the name of the University nor the names of its contributors
     56  1.1.2.2  skrll  *    may be used to endorse or promote products derived from this software
     57  1.1.2.2  skrll  *    without specific prior written permission.
     58  1.1.2.2  skrll  *
     59  1.1.2.2  skrll  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     60  1.1.2.2  skrll  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     61  1.1.2.2  skrll  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     62  1.1.2.2  skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     63  1.1.2.2  skrll  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     64  1.1.2.2  skrll  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     65  1.1.2.2  skrll  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     66  1.1.2.2  skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     67  1.1.2.2  skrll  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     68  1.1.2.2  skrll  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     69  1.1.2.2  skrll  * SUCH DAMAGE.
     70  1.1.2.2  skrll  *
     71  1.1.2.2  skrll  *	@(#)procfs.h	8.9 (Berkeley) 5/14/95
     72  1.1.2.2  skrll  */
     73  1.1.2.2  skrll 
     74  1.1.2.2  skrll #ifdef _KERNEL
     75  1.1.2.2  skrll /*
     76  1.1.2.2  skrll  * The different types of node in a ptyfs filesystem
     77  1.1.2.2  skrll  */
     78  1.1.2.2  skrll typedef enum {
     79  1.1.2.2  skrll 	PTYFSpts,	/* The slave side of a pty */
     80  1.1.2.2  skrll 	PTYFSptc,	/* The controlling side of a pty */
     81  1.1.2.2  skrll 	PTYFSroot,	/* the filesystem root */
     82  1.1.2.2  skrll } ptyfstype;
     83  1.1.2.2  skrll 
     84  1.1.2.2  skrll /*
     85  1.1.2.2  skrll  * control data for the proc file system.
     86  1.1.2.2  skrll  */
     87  1.1.2.2  skrll struct ptyfsnode {
     88  1.1.2.2  skrll 	LIST_ENTRY(ptyfsnode) ptyfs_hash;	/* hash chain */
     89  1.1.2.2  skrll 	struct vnode	*ptyfs_vnode;	/* vnode associated with this ptyfsnode */
     90  1.1.2.2  skrll 	ptyfstype	ptyfs_type;	/* type of ptyfs node */
     91  1.1.2.2  skrll 	int		ptyfs_pty;	/* the pty index */
     92  1.1.2.2  skrll 	u_long		ptyfs_fileno;	/* unique file id */
     93  1.1.2.2  skrll 	int		ptyfs_flag;	/* status flag for times */
     94  1.1.2.2  skrll #define	PTYFS_ACCESS	1
     95  1.1.2.2  skrll #define	PTYFS_MODIFY	2
     96  1.1.2.2  skrll #define	PTYFS_CHANGE	4
     97  1.1.2.2  skrll 	/* Attribute information */
     98  1.1.2.2  skrll 	uid_t		ptyfs_uid;
     99  1.1.2.2  skrll 	gid_t		ptyfs_gid;
    100  1.1.2.2  skrll 	mode_t		ptyfs_mode;
    101  1.1.2.2  skrll 	int		ptyfs_flags;
    102  1.1.2.2  skrll 	struct timespec	ptyfs_ctime, ptyfs_mtime, ptyfs_atime, ptyfs_birthtime;
    103  1.1.2.2  skrll };
    104  1.1.2.2  skrll 
    105  1.1.2.3  skrll struct ptyfsmount {
    106  1.1.2.3  skrll 	gid_t pmnt_gid;
    107  1.1.2.3  skrll 	mode_t pmnt_mode;
    108  1.1.2.3  skrll };
    109  1.1.2.3  skrll 
    110  1.1.2.3  skrll #define VFSTOPTY(mp)	((struct ptyfsmount *)(mp)->mnt_data)
    111  1.1.2.3  skrll 
    112  1.1.2.2  skrll #endif /* _KERNEL */
    113  1.1.2.2  skrll 
    114  1.1.2.3  skrll struct ptyfs_args {
    115  1.1.2.3  skrll 	int version;
    116  1.1.2.3  skrll 	gid_t gid;
    117  1.1.2.3  skrll 	mode_t mode;
    118  1.1.2.3  skrll };
    119  1.1.2.3  skrll 
    120  1.1.2.3  skrll #define PTYFS_ARGSVERSION	1
    121  1.1.2.3  skrll 
    122  1.1.2.2  skrll /*
    123  1.1.2.2  skrll  * Kernel stuff follows
    124  1.1.2.2  skrll  */
    125  1.1.2.2  skrll #ifdef _KERNEL
    126  1.1.2.2  skrll 
    127  1.1.2.2  skrll #define UIO_MX 32
    128  1.1.2.2  skrll 
    129  1.1.2.2  skrll #define PTYFS_FILENO(pty, type) \
    130  1.1.2.2  skrll     ((((uint32_t)type) << 30) | (pty + 1))
    131  1.1.2.2  skrll 
    132  1.1.2.2  skrll #define PTYFS_MAKEDEV(ptyfs) \
    133  1.1.2.2  skrll     pty_makedev((ptyfs)->ptyfs_type == PTYFSpts ? 't' : 'p', (ptyfs)->ptyfs_pty)
    134  1.1.2.2  skrll 
    135  1.1.2.2  skrll /*
    136  1.1.2.2  skrll  * Convert between ptyfsnode vnode
    137  1.1.2.2  skrll  */
    138  1.1.2.2  skrll #define VTOPTYFS(vp)	((struct ptyfsnode *)(vp)->v_data)
    139  1.1.2.2  skrll #define PTYFSTOV(ptyfs)	((ptyfs)->ptyfs_vnode)
    140  1.1.2.2  skrll 
    141  1.1.2.2  skrll int ptyfs_freevp(struct vnode *);
    142  1.1.2.2  skrll int ptyfs_allocvp(struct mount *, struct vnode **, ptyfstype, int,
    143  1.1.2.2  skrll     struct lwp *);
    144  1.1.2.2  skrll void ptyfs_hashinit(void);
    145  1.1.2.2  skrll void ptyfs_hashreinit(void);
    146  1.1.2.2  skrll void ptyfs_hashdone(void);
    147  1.1.2.2  skrll 
    148  1.1.2.2  skrll extern int (**ptyfs_vnodeop_p)(void *);
    149  1.1.2.2  skrll extern struct vfsops ptyfs_vfsops;
    150  1.1.2.2  skrll 
    151  1.1.2.2  skrll int	ptyfs_root(struct mount *, struct vnode **);
    152  1.1.2.2  skrll 
    153  1.1.2.2  skrll #ifdef SYSCTL_SETUP_PROTO
    154  1.1.2.2  skrll SYSCTL_SETUP_PROTO(sysctl_vfs_ptyfs_setup);
    155  1.1.2.2  skrll #endif /* SYSCTL_SETUP_PROTO */
    156  1.1.2.2  skrll #endif /* _KERNEL */
    157