devfs.h (95212) | devfs.h (100206) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 2000 5 * Poul-Henning Kamp. All rights reserved. | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 2000 5 * Poul-Henning Kamp. All rights reserved. |
6 * Copyright (c) 2002 7 * Dima Dorfman. All rights reserved. |
|
6 * 7 * This code is derived from software donated to Berkeley by 8 * Jan-Simon Pendry. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * @(#)kernfs.h 8.6 (Berkeley) 3/29/95 32 * From: FreeBSD: src/sys/miscfs/kernfs/kernfs.h 1.14 33 * | 8 * 9 * This code is derived from software donated to Berkeley by 10 * Jan-Simon Pendry. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kernfs.h 8.6 (Berkeley) 3/29/95 34 * From: FreeBSD: src/sys/miscfs/kernfs/kernfs.h 1.14 35 * |
34 * $FreeBSD: head/sys/fs/devfs/devfs.h 95212 2002-04-21 15:47:03Z bde $ | 36 * $FreeBSD: head/sys/fs/devfs/devfs.h 100206 2002-07-17 01:46:48Z dd $ |
35 */ 36 37#ifndef _FS_DEVFS_DEVFS_H_ 38#define _FS_DEVFS_DEVFS_H_ 39 | 37 */ 38 39#ifndef _FS_DEVFS_DEVFS_H_ 40#define _FS_DEVFS_DEVFS_H_ 41 |
40#ifdef _KERNEL /* No userland stuff in here... */ | 42#define DEVFS_MAGIC 0xdb0a087a |
41 42/* | 43 44/* |
45 * Identifiers. The ruleset and rule numbers are 16-bit values. The 46 * "rule ID" is a combination of the ruleset and rule number; it 47 * should be able to univocally describe a rule in the system. In 48 * this implementation, the upper 16 bits of the rule ID is the 49 * ruleset number; the lower 16 bits, the rule number within the 50 * aforementioned ruleset. 51 */ 52typedef uint16_t devfs_rnum; 53typedef uint16_t devfs_rsnum; 54typedef uint32_t devfs_rid; 55 56/* 57 * Identifier manipulators. 58 */ 59#define rid2rsn(rid) ((rid) >> 16) 60#define rid2rn(rid) ((rid) & 0xffff) 61#define mkrid(rsn, rn) ((rn) | ((rsn) << 16)) 62 63/* 64 * Plain DEVFS rule. This gets shared between kernel and userland 65 * verbatim, so it shouldn't contain any pointers or other kernel- or 66 * userland-specific values. 67 */ 68struct devfs_rule { 69 uint32_t dr_magic; /* Magic number. */ 70 devfs_rid dr_id; /* Identifier. */ 71 72 /* 73 * Conditions under which this rule should be applied. These 74 * are ANDed together since OR can be simulated by using 75 * multiple rules. dr_icond determines which of the other 76 * variables we should process. 77 */ 78 int dr_icond; 79#define DRC_DSWFLAGS 0x001 80#define DRC_PATHPTRN 0x002 81#define DRC_MAJOR 0x004 82 int dr_dswflags; /* cdevsw flags to match. */ 83#define DEVFS_MAXPTRNLEN 200 84 char dr_pathptrn[DEVFS_MAXPTRNLEN]; /* Pattern to match path. */ 85 int dr_major; /* Device major number. */ 86 87 /* 88 * Things to change. dr_iacts determines which of the other 89 * variables we should process. 90 */ 91 int dr_iacts; 92#define DRA_BACTS 0x001 93#define DRA_UID 0x002 94#define DRA_GID 0x004 95#define DRA_MODE 0x008 96#define DRA_INCSET 0x010 97 int dr_bacts; /* Boolean (on/off) action. */ 98#define DRB_HIDE 0x001 /* Hide entry (DE_WHITEOUT). */ 99#define DRB_UNHIDE 0x002 /* Unhide entry. */ 100 uid_t dr_uid; 101 gid_t dr_gid; 102 mode_t dr_mode; 103 devfs_rsnum dr_incset; /* Included ruleset. */ 104}; 105 106/* 107 * Rule-related ioctls. 108 */ 109#define DEVFSIO_RADD _IOWR('D', 0, struct devfs_rule) 110#define DEVFSIO_RDEL _IOW('D', 1, devfs_rid) 111#define DEVFSIO_RAPPLY _IOW('D', 2, struct devfs_rule) 112#define DEVFSIO_RAPPLYID _IOW('D', 3, devfs_rid) 113#define DEVFSIO_RGETNEXT _IOWR('D', 4, struct devfs_rule) 114 115#define DEVFSIO_SUSE _IOW('D', 10, devfs_rsnum) 116#define DEVFSIO_SAPPLY _IOW('D', 11, devfs_rsnum) 117#define DEVFSIO_SGETNEXT _IOWR('D', 12, devfs_rsnum) 118 119/* XXX: DEVFSIO_RS_GET_INFO for refcount, active if any, etc. */ 120 121#ifdef _KERNEL 122 123/* |
|
43 * These are default sizes for the DEVFS inode table and the overflow 44 * table. If the default table overflows we allocate the overflow 45 * table, the size of which can also be set with a sysctl. If the 46 * overflow table fills you're toast. 47 */ 48#ifndef NDEVFSINO 49#define NDEVFSINO 1024 50#endif --- 38 unchanged lines hidden (view full) --- 89 struct vnode *dm_root; /* Root node */ 90 struct devfs_dirent *dm_rootdir; 91 struct devfs_dirent *dm_basedir; 92 unsigned dm_generation; 93 struct devfs_dirent *dm_dirent[NDEVFSINO]; 94 struct devfs_dirent **dm_overflow; 95 int dm_inode; 96 struct lock dm_lock; | 124 * These are default sizes for the DEVFS inode table and the overflow 125 * table. If the default table overflows we allocate the overflow 126 * table, the size of which can also be set with a sysctl. If the 127 * overflow table fills you're toast. 128 */ 129#ifndef NDEVFSINO 130#define NDEVFSINO 1024 131#endif --- 38 unchanged lines hidden (view full) --- 170 struct vnode *dm_root; /* Root node */ 171 struct devfs_dirent *dm_rootdir; 172 struct devfs_dirent *dm_basedir; 173 unsigned dm_generation; 174 struct devfs_dirent *dm_dirent[NDEVFSINO]; 175 struct devfs_dirent **dm_overflow; 176 int dm_inode; 177 struct lock dm_lock; |
178 devfs_rsnum dm_ruleset; |
|
97}; 98 99/* 100 * This is what we fill in dm_dirent[N] for a deleted entry. 101 */ 102#define DE_DELETED ((struct devfs_dirent *)sizeof(struct devfs_dirent)) 103 104#define VFSTODEVFS(mp) ((struct devfs_mount *)((mp)->mnt_data)) 105 106extern vop_t **devfs_vnodeop_p; 107extern vop_t **devfs_specop_p; 108 | 179}; 180 181/* 182 * This is what we fill in dm_dirent[N] for a deleted entry. 183 */ 184#define DE_DELETED ((struct devfs_dirent *)sizeof(struct devfs_dirent)) 185 186#define VFSTODEVFS(mp) ((struct devfs_mount *)((mp)->mnt_data)) 187 188extern vop_t **devfs_vnodeop_p; 189extern vop_t **devfs_specop_p; 190 |
191void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de); 192void devfs_rules_init(void); 193int devfs_rules_ioctl(struct mount *mp, int cmd, caddr_t data, struct thread *td); 194void devfs_rules_newmount(struct devfs_mount *dm, struct thread *td); |
|
109int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); 110dev_t *devfs_itod (int inode); 111struct devfs_dirent **devfs_itode (struct devfs_mount *dm, int inode); 112int devfs_populate (struct devfs_mount *dm); 113struct devfs_dirent *devfs_newdirent (char *name, int namelen); 114void devfs_purge (struct devfs_dirent *dd); 115struct devfs_dirent *devfs_vmkdir (char *name, int namelen, struct devfs_dirent *dotdot); 116 117#endif /* _KERNEL */ 118 119#endif /* !_FS_DEVFS_DEVFS_H_ */ | 195int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); 196dev_t *devfs_itod (int inode); 197struct devfs_dirent **devfs_itode (struct devfs_mount *dm, int inode); 198int devfs_populate (struct devfs_mount *dm); 199struct devfs_dirent *devfs_newdirent (char *name, int namelen); 200void devfs_purge (struct devfs_dirent *dd); 201struct devfs_dirent *devfs_vmkdir (char *name, int namelen, struct devfs_dirent *dotdot); 202 203#endif /* _KERNEL */ 204 205#endif /* !_FS_DEVFS_DEVFS_H_ */ |