]> git.saurik.com Git - apple/xnu.git/blame - bsd/miscfs/devfs/fdesc.h
xnu-4570.1.46.tar.gz
[apple/xnu.git] / bsd / miscfs / devfs / fdesc.h
CommitLineData
1c79356b 1/*
5d5c5d0d
A
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29/*
30 * Copyright (c) 1992, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * This code is derived from software donated to Berkeley by
34 * Jan-Simon Pendry.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 * @(#)fdesc.h 8.6 (Berkeley) 8/20/94
65 *
66 * #Id: fdesc.h,v 1.8 1993/04/06 15:28:33 jsp Exp #
67 */
9bccf70c
A
68#ifndef __FDESC_FDESC_H__
69#define __FDESC_FDESC_H__
1c79356b 70
9bccf70c
A
71#include <sys/appleapiopts.h>
72
73#ifdef __APPLE_API_PRIVATE
1c79356b 74#ifdef KERNEL
1c79356b
A
75
76#define FD_ROOT 2
77#define FD_DEVFD 3
78#define FD_STDIN 4
79#define FD_STDOUT 5
80#define FD_STDERR 6
1c79356b
A
81#define FD_DESC 8
82#define FD_MAX 12
83
84typedef enum {
1c79356b 85 Fdesc,
1c79356b
A
86} fdntype;
87
88struct fdescnode {
2d21ac55
A
89 LIST_ENTRY(fdescnode) fd_hash; /* Hash list */
90 struct vnode *fd_vnode; /* Back ptr to vnode */
91447636 91 fdntype fd_type; /* Type of this node */
b0d623f7 92 long fd_fd; /* Fd to be dup'ed */
2d21ac55
A
93 const char *fd_link; /* Link to fd/n */
94 int fd_ix; /* filesystem index */
1c79356b
A
95};
96
97#define VFSTOFDESC(mp) ((struct fdescmount *)((mp)->mnt_data))
98#define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
99
b0d623f7
A
100__BEGIN_DECLS
101extern int fdesc_allocvp(fdntype, int, struct mount *, struct vnode **, enum vtype, int);
91447636
A
102extern int fdesc_badop(void);
103extern int fdesc_getattr(struct vnop_getattr_args *ap);
104extern int fdesc_inactive(struct vnop_inactive_args *ap);
b0d623f7
A
105extern int devfs_fdesc_init(void);
106extern int devfs_fdesc_makelinks(void);
91447636 107extern int fdesc_ioctl(struct vnop_ioctl_args *ap);
b0d623f7
A
108extern int devfs_devfd_lookup(struct vnop_lookup_args *ap);
109extern int devfs_devfd_readdir(struct vnop_readdir_args *ap);
91447636
A
110extern int fdesc_open(struct vnop_open_args *ap);
111extern int fdesc_pathconf(struct vnop_pathconf_args *ap);
112extern int fdesc_read(struct vnop_read_args *ap);
113extern int fdesc_readdir(struct vnop_readdir_args *ap);
114extern int fdesc_readlink(struct vnop_readlink_args *ap);
115extern int fdesc_reclaim(struct vnop_reclaim_args *ap);
116extern int fdesc_root(struct mount *, struct vnode **, vfs_context_t);
117extern int fdesc_select(struct vnop_select_args *ap);
118extern int fdesc_setattr(struct vnop_setattr_args *ap);
119extern int fdesc_write(struct vnop_write_args *ap);
120
1c79356b 121extern int (**fdesc_vnodeop_p)(void *);
b0d623f7 122extern int (**devfs_devfd_vnodeop_p)(void*);
1c79356b 123extern struct vfsops fdesc_vfsops;
b0d623f7
A
124__END_DECLS
125
1c79356b 126#endif /* KERNEL */
9bccf70c
A
127#endif /* __APPLE_API_PRIVATE */
128#endif /* __FDESC_FDESC_H__ */