]> git.saurik.com Git - apple/xnu.git/blame_incremental - bsd/miscfs/devfs/fdesc.h
xnu-2782.10.72.tar.gz
[apple/xnu.git] / bsd / miscfs / devfs / fdesc.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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 */
68#ifndef __FDESC_FDESC_H__
69#define __FDESC_FDESC_H__
70
71#include <sys/appleapiopts.h>
72
73#ifdef __APPLE_API_PRIVATE
74#ifdef KERNEL
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
81#define FD_DESC 8
82#define FD_MAX 12
83
84typedef enum {
85 Fdesc,
86} fdntype;
87
88struct fdescnode {
89 LIST_ENTRY(fdescnode) fd_hash; /* Hash list */
90 struct vnode *fd_vnode; /* Back ptr to vnode */
91 fdntype fd_type; /* Type of this node */
92 long fd_fd; /* Fd to be dup'ed */
93 const char *fd_link; /* Link to fd/n */
94 int fd_ix; /* filesystem index */
95};
96
97#define VFSTOFDESC(mp) ((struct fdescmount *)((mp)->mnt_data))
98#define VTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)
99
100__BEGIN_DECLS
101extern int fdesc_allocvp(fdntype, int, struct mount *, struct vnode **, enum vtype, int);
102extern int fdesc_badop(void);
103extern int fdesc_getattr(struct vnop_getattr_args *ap);
104extern int fdesc_inactive(struct vnop_inactive_args *ap);
105extern int devfs_fdesc_init(void);
106extern int devfs_fdesc_makelinks(void);
107extern int fdesc_ioctl(struct vnop_ioctl_args *ap);
108extern int devfs_devfd_lookup(struct vnop_lookup_args *ap);
109extern int devfs_devfd_readdir(struct vnop_readdir_args *ap);
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
121extern int (**fdesc_vnodeop_p)(void *);
122extern int (**devfs_devfd_vnodeop_p)(void*);
123extern struct vfsops fdesc_vfsops;
124__END_DECLS
125
126#endif /* KERNEL */
127#endif /* __APPLE_API_PRIVATE */
128#endif /* __FDESC_FDESC_H__ */