summaryrefslogtreecommitdiffstats
path: root/sys/sys/devfsext.h
blob: 425cbff00f9fd528c09023575bbe9e1576d9365d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright 1997,1998 Julian Elischer.  All rights reserved.
 * julian@freebsd.org
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *     this list of conditions and the following disclaimer in the documentation
 *     and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE HOLDER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * $Id: devfsext.h,v 1.21 1998/07/13 06:45:16 bde Exp $
 */

#ifndef _SYS_DEVFSEXT_H_
#define	_SYS_DEVFSEXT_H_

/*
 * Make a device at a path, and get a cookie for it in return.
 * Specify the type, the minor number and the devsw entry to use,
 * and the initial default perms/ownerships.
 */
void	*devfs_add_devswf __P((void *devsw, int minor, int chrblk, uid_t uid,
			       gid_t gid, int perms, char *fmt, ...))
			       __printflike(7, 8);
/*
 * Make a link to a device you already made, and have the cookie for 
 * We get another cookie, but for now, it can be discarded, as
 * at the moment there is nothing you can do with it that you couldn't do
 * with the original cookie. ( XXX this might be something I should change )
 */
void	*devfs_makelink __P((void *original, char *fmt, ...)) __printflike(2, 3);

/*
 * Remove all instances of a device you have made. INCLUDING LINKS.
 * I.e. either the cookie from the original device or the cookie
 * from a link will have the effect of removing both entries.
 * Removing with BOTH an original cookie and one from a link is
 * likely to cause a panic.
 */
void	devfs_remove_dev __P((void *devnmp));

/*
 * Check if a device exists and is the type you need. Returns NULL or a
 * cookie that can be used to try 'open' the device. XXX This is a bit
 * of a duplication of devfs_lookup(). I might one day try merge them a bit.
 * Used for mountroot under DEVFS. Path is relative to the base of the devfs.
 */
struct vnode *devfs_open_device __P((char *path, int devtype));
void devfs_close_device __P((struct vnode *vn));

dev_t devfs_vntodev __P((struct vnode *vn)); /* extract dev_t from devfs vn */

#define DV_CHR 0
#define DV_BLK 1
#define DV_DEV 2

/* XXX */
#define	UID_ROOT	0
#define	UID_BIN		3
#define	UID_UUCP	66

/* XXX */
#define	GID_WHEEL	0
#define	GID_KMEM	2
#define	GID_OPERATOR	5
#define	GID_BIN		7
#define	GID_GAMES	13
#define	GID_DIALER	68

#endif /* !_SYS_DEVFSEXT_H_ */
OpenPOWER on IntegriCloud