]> git.saurik.com Git - apple/xnu.git/blob - bsd/miscfs/devfs/devfs.h
xnu-792.12.6.tar.gz
[apple/xnu.git] / bsd / miscfs / devfs / devfs.h
1 /*
2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * Copyright 1997,1998 Julian Elischer. All rights reserved.
32 * julian@freebsd.org
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions are
36 * met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright notice,
40 * this list of conditions and the following disclaimer in the documentation
41 * and/or other materials provided with the distribution.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
44 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
45 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46 * DISCLAIMED. IN NO EVENT SHALL THE HOLDER OR CONTRIBUTORS BE LIABLE FOR
47 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
49 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 * miscfs/devfs/devfs.h
56 */
57
58 #ifndef _MISCFS_DEVFS_DEVFS_H_
59 #define _MISCFS_DEVFS_DEVFS_H_
60
61 #include <sys/appleapiopts.h>
62
63 #define DEVFS_CHAR 0
64 #define DEVFS_BLOCK 1
65
66 __BEGIN_DECLS
67
68 /*
69 * Function: devfs_make_node
70 *
71 * Purpose
72 * Create a device node with the given pathname in the devfs namespace.
73 *
74 * Parameters:
75 * dev - the dev_t value to associate
76 * chrblk - block or character device (DEVFS_CHAR or DEVFS_BLOCK)
77 * uid, gid - ownership
78 * perms - permissions
79 * fmt, ... - print format string and args to format the path name
80 * Returns:
81 * A handle to a device node if successful, NULL otherwise.
82 */
83 void * devfs_make_node(dev_t dev, int chrblk, uid_t uid, gid_t gid,
84 int perms, const char *fmt, ...);
85
86 #ifdef BSD_KERNEL_PRIVATE
87 /*
88 * Function: devfs_make_link
89 *
90 * Purpose:
91 * Create a link to a previously created device node.
92 *
93 * Returns:
94 * 0 if successful, -1 if failed
95 */
96 int devfs_link(void * handle, char *fmt, ...);
97 #endif /* BSD_KERNEL_PRIVATE */
98
99 /*
100 * Function: devfs_remove
101 *
102 * Purpose:
103 * Remove the device node returned by devfs_make_node() along with
104 * any links created with devfs_make_link().
105 */
106 void devfs_remove(void * handle);
107
108 __END_DECLS
109
110 #ifdef __APPLE_API_PRIVATE
111 /* XXX */
112 #define UID_ROOT 0
113 #define UID_BIN 3
114 #define UID_UUCP 66
115
116 /* XXX */
117 #define GID_WHEEL 0
118 #define GID_KMEM 2
119 #define GID_OPERATOR 5
120 #define GID_BIN 7
121 #define GID_GAMES 13
122 #define GID_DIALER 68
123 #endif /* __APPLE_API_PRIVATE */
124
125 #endif /* !_MISCFS_DEVFS_DEVFS_H_ */