]> git.saurik.com Git - apple/xnu.git/blob - bsd/miscfs/devfs/devfs.h
xnu-792.17.14.tar.gz
[apple/xnu.git] / bsd / miscfs / devfs / devfs.h
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 /*
29 * Copyright 1997,1998 Julian Elischer. All rights reserved.
30 * julian@freebsd.org
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions are
34 * met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright notice,
38 * this list of conditions and the following disclaimer in the documentation
39 * and/or other materials provided with the distribution.
40 *
41 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
42 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
43 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44 * DISCLAIMED. IN NO EVENT SHALL THE HOLDER OR CONTRIBUTORS BE LIABLE FOR
45 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
47 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
48 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * miscfs/devfs/devfs.h
54 */
55
56 #ifndef _MISCFS_DEVFS_DEVFS_H_
57 #define _MISCFS_DEVFS_DEVFS_H_
58
59 #include <sys/appleapiopts.h>
60
61 #define DEVFS_CHAR 0
62 #define DEVFS_BLOCK 1
63
64 __BEGIN_DECLS
65
66 /*
67 * Function: devfs_make_node
68 *
69 * Purpose
70 * Create a device node with the given pathname in the devfs namespace.
71 *
72 * Parameters:
73 * dev - the dev_t value to associate
74 * chrblk - block or character device (DEVFS_CHAR or DEVFS_BLOCK)
75 * uid, gid - ownership
76 * perms - permissions
77 * fmt, ... - print format string and args to format the path name
78 * Returns:
79 * A handle to a device node if successful, NULL otherwise.
80 */
81 void * devfs_make_node(dev_t dev, int chrblk, uid_t uid, gid_t gid,
82 int perms, const char *fmt, ...);
83
84 #ifdef BSD_KERNEL_PRIVATE
85 /*
86 * Function: devfs_make_link
87 *
88 * Purpose:
89 * Create a link to a previously created device node.
90 *
91 * Returns:
92 * 0 if successful, -1 if failed
93 */
94 int devfs_link(void * handle, char *fmt, ...);
95 #endif /* BSD_KERNEL_PRIVATE */
96
97 /*
98 * Function: devfs_remove
99 *
100 * Purpose:
101 * Remove the device node returned by devfs_make_node() along with
102 * any links created with devfs_make_link().
103 */
104 void devfs_remove(void * handle);
105
106 __END_DECLS
107
108 #ifdef __APPLE_API_PRIVATE
109 /* XXX */
110 #define UID_ROOT 0
111 #define UID_BIN 3
112 #define UID_UUCP 66
113
114 /* XXX */
115 #define GID_WHEEL 0
116 #define GID_KMEM 2
117 #define GID_OPERATOR 5
118 #define GID_BIN 7
119 #define GID_GAMES 13
120 #define GID_DIALER 68
121 #endif /* __APPLE_API_PRIVATE */
122
123 #endif /* !_MISCFS_DEVFS_DEVFS_H_ */