1*c2e9cb94Sad /* $NetBSD: fdesc.h,v 1.23 2020/01/17 20:08:09 ad Exp $ */ 2cf92afd6Scgd 3e6035453Scgd /* 4cde1d475Smycroft * Copyright (c) 1992, 1993 5cde1d475Smycroft * The Regents of the University of California. All rights reserved. 6e6035453Scgd * 74942f8a8Scgd * This code is derived from software donated to Berkeley by 8e6035453Scgd * Jan-Simon Pendry. 9e6035453Scgd * 10320661fcScgd * Redistribution and use in source and binary forms, with or without 11320661fcScgd * modification, are permitted provided that the following conditions 12320661fcScgd * are met: 13320661fcScgd * 1. Redistributions of source code must retain the above copyright 14320661fcScgd * notice, this list of conditions and the following disclaimer. 15320661fcScgd * 2. Redistributions in binary form must reproduce the above copyright 16320661fcScgd * notice, this list of conditions and the following disclaimer in the 17320661fcScgd * documentation and/or other materials provided with the distribution. 18aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 19320661fcScgd * may be used to endorse or promote products derived from this software 20320661fcScgd * without specific prior written permission. 21e6035453Scgd * 22320661fcScgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23320661fcScgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24320661fcScgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25320661fcScgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26320661fcScgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27320661fcScgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28320661fcScgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29320661fcScgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30320661fcScgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31320661fcScgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32320661fcScgd * SUCH DAMAGE. 33e6035453Scgd * 34e5bc90f4Sfvdl * @(#)fdesc.h 8.8 (Berkeley) 4/3/95 352981ef65Smycroft * 362981ef65Smycroft * #Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp # 37e6035453Scgd */ 38e6035453Scgd 396efcd1b6Sbriggs #ifdef _KERNEL 40e6035453Scgd 414942f8a8Scgd #define FD_ROOT 2 424942f8a8Scgd #define FD_DEVFD 3 434942f8a8Scgd #define FD_STDIN 4 444942f8a8Scgd #define FD_STDOUT 5 454942f8a8Scgd #define FD_STDERR 6 464942f8a8Scgd #define FD_CTTY 7 474942f8a8Scgd #define FD_DESC 8 484942f8a8Scgd #define FD_MAX 12 494942f8a8Scgd 504942f8a8Scgd typedef enum { 514942f8a8Scgd Froot, 524942f8a8Scgd Fdevfd, 534942f8a8Scgd Fdesc, 544942f8a8Scgd Flink, 554942f8a8Scgd Fctty 564942f8a8Scgd } fdntype; 574942f8a8Scgd 58e6035453Scgd struct fdescnode { 59cde1d475Smycroft struct vnode *fd_vnode; /* Back ptr to vnode */ 604942f8a8Scgd fdntype fd_type; /* Type of this node */ 614942f8a8Scgd unsigned fd_fd; /* Fd to be dup'ed */ 623e04c969Shannken const char *fd_link; /* Link to fd/n */ 634942f8a8Scgd int fd_ix; /* filesystem index */ 64e6035453Scgd }; 65e6035453Scgd 66e6035453Scgd #define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data) 67e6035453Scgd 687004654cSchristos #define FDESC_MAXNAMLEN 255 697004654cSchristos 704942f8a8Scgd extern dev_t devctty; 71af97f2e8Sxtraeme extern void fdesc_init(void); 72af97f2e8Sxtraeme extern void fdesc_done(void); 73*c2e9cb94Sad extern int fdesc_root(struct mount *, int, struct vnode **); 74af97f2e8Sxtraeme extern int fdesc_allocvp(fdntype, int, struct mount *, struct vnode **); 75af97f2e8Sxtraeme extern int (**fdesc_vnodeop_p)(void *); 76e6035453Scgd extern struct vfsops fdesc_vfsops; 7710a7ba9eSatatat 786efcd1b6Sbriggs #endif /* _KERNEL */ 79