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