]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. |
3 | * | |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
0a7de745 | 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. | |
0a7de745 | 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. | |
0a7de745 | 17 | * |
2d21ac55 A |
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. | |
0a7de745 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * Copyright 1997,1998 Julian Elischer. All rights reserved. | |
30 | * julian@freebsd.org | |
0a7de745 | 31 | * |
1c79356b A |
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. | |
0a7de745 | 40 | * |
1c79356b A |
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. | |
0a7de745 | 52 | * |
1c79356b A |
53 | * miscfs/devfs/devfs.h |
54 | */ | |
55 | ||
56 | #ifndef _MISCFS_DEVFS_DEVFS_H_ | |
0a7de745 | 57 | #define _MISCFS_DEVFS_DEVFS_H_ |
1c79356b | 58 | |
9bccf70c | 59 | #include <sys/appleapiopts.h> |
5ba3f43e | 60 | #include <sys/cdefs.h> |
9bccf70c | 61 | |
0a7de745 A |
62 | #define DEVFS_CHAR 0 |
63 | #define DEVFS_BLOCK 1 | |
1c79356b | 64 | |
2d21ac55 A |
65 | /* |
66 | * Argument to clone callback after dev | |
67 | */ | |
0a7de745 A |
68 | #define DEVFS_CLONE_ALLOC 1 /* Allocate minor number slot */ |
69 | #define DEVFS_CLONE_FREE 0 /* Free minor number slot */ | |
2d21ac55 | 70 | |
1c79356b A |
71 | __BEGIN_DECLS |
72 | ||
2d21ac55 A |
73 | /* |
74 | * Function: devfs_make_node_clone | |
75 | * | |
76 | * Purpose | |
77 | * Create a device node with the given pathname in the devfs namespace; | |
78 | * before returning a dev_t value for an open instance, the dev_t has | |
79 | * it's minor number updated by calling the supplied clone function on | |
80 | * the supplied dev.. | |
81 | * | |
82 | * Parameters: | |
0a7de745 | 83 | * dev - the dev_t value to associate |
2d21ac55 A |
84 | * chrblk - block or character device (DEVFS_CHAR or DEVFS_BLOCK) |
85 | * uid, gid - ownership | |
86 | * perms - permissions | |
87 | * clone - minor number cloning function | |
88 | * fmt, ... - print format string and args to format the path name | |
89 | * Returns: | |
90 | * A handle to a device node if successful, NULL otherwise. | |
91 | */ | |
0a7de745 A |
92 | void * devfs_make_node_clone(dev_t dev, int chrblk, uid_t uid, gid_t gid, |
93 | int perms, int (*clone)(dev_t dev, int action), | |
94 | const char *fmt, ...); | |
2d21ac55 | 95 | |
1c79356b A |
96 | /* |
97 | * Function: devfs_make_node | |
98 | * | |
99 | * Purpose | |
100 | * Create a device node with the given pathname in the devfs namespace. | |
101 | * | |
102 | * Parameters: | |
0a7de745 | 103 | * dev - the dev_t value to associate |
1c79356b A |
104 | * chrblk - block or character device (DEVFS_CHAR or DEVFS_BLOCK) |
105 | * uid, gid - ownership | |
106 | * perms - permissions | |
107 | * fmt, ... - print format string and args to format the path name | |
108 | * Returns: | |
109 | * A handle to a device node if successful, NULL otherwise. | |
110 | */ | |
0a7de745 A |
111 | void * devfs_make_node(dev_t dev, int chrblk, uid_t uid, gid_t gid, |
112 | int perms, const char *fmt, ...); | |
1c79356b | 113 | |
91447636 | 114 | #ifdef BSD_KERNEL_PRIVATE |
1c79356b A |
115 | /* |
116 | * Function: devfs_make_link | |
117 | * | |
118 | * Purpose: | |
119 | * Create a link to a previously created device node. | |
120 | * | |
121 | * Returns: | |
122 | * 0 if successful, -1 if failed | |
123 | */ | |
0a7de745 | 124 | int devfs_make_link(void * handle, char *fmt, ...); |
91447636 | 125 | #endif /* BSD_KERNEL_PRIVATE */ |
1c79356b A |
126 | |
127 | /* | |
128 | * Function: devfs_remove | |
129 | * | |
130 | * Purpose: | |
131 | * Remove the device node returned by devfs_make_node() along with | |
132 | * any links created with devfs_make_link(). | |
133 | */ | |
0a7de745 | 134 | void devfs_remove(void * handle); |
1c79356b A |
135 | |
136 | __END_DECLS | |
137 | ||
9bccf70c | 138 | #ifdef __APPLE_API_PRIVATE |
1c79356b | 139 | /* XXX */ |
0a7de745 A |
140 | #define UID_ROOT 0 |
141 | #define UID_BIN 3 | |
142 | #define UID_UUCP 66 | |
1c79356b A |
143 | |
144 | /* XXX */ | |
0a7de745 A |
145 | #define GID_WHEEL 0 |
146 | #define GID_KMEM 2 | |
147 | #define GID_TTY 4 | |
148 | #define GID_OPERATOR 5 | |
149 | #define GID_BIN 7 | |
150 | #define GID_GAMES 13 | |
151 | #define GID_DIALER 68 | |
a1c7dba1 | 152 | #define GID_WINDOWSERVER 88 |
9bccf70c | 153 | #endif /* __APPLE_API_PRIVATE */ |
1c79356b A |
154 | |
155 | #endif /* !_MISCFS_DEVFS_DEVFS_H_ */ |