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