pseudofs.h (75295) | pseudofs.h (77998) |
---|---|
1/*- 2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * | 1/*- 2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/fs/pseudofs/pseudofs.h 75295 2001-04-07 19:51:12Z des $ | 28 * $FreeBSD: head/sys/fs/pseudofs/pseudofs.h 77998 2001-06-10 18:39:21Z des $ |
29 */ 30 31#ifndef _PSEUDOFS_H_INCLUDED 32#define _PSEUDOFS_H_INCLUDED 33 34/* 35 * Limits and constants 36 */ 37#define PFS_NAMELEN 24 38#define PFS_DELEN (8 + PFS_NAMELEN) 39 40typedef enum { 41 pfstype_none = 0, 42 pfstype_root, 43 pfstype_dir, 44 pfstype_this, 45 pfstype_parent, 46 pfstype_file, 47 pfstype_symlink, | 29 */ 30 31#ifndef _PSEUDOFS_H_INCLUDED 32#define _PSEUDOFS_H_INCLUDED 33 34/* 35 * Limits and constants 36 */ 37#define PFS_NAMELEN 24 38#define PFS_DELEN (8 + PFS_NAMELEN) 39 40typedef enum { 41 pfstype_none = 0, 42 pfstype_root, 43 pfstype_dir, 44 pfstype_this, 45 pfstype_parent, 46 pfstype_file, 47 pfstype_symlink, |
48 pfstype_procdep | 48 pfstype_procdir |
49} pfs_type_t; 50 | 49} pfs_type_t; 50 |
51/* Flags */ 52#define PFS_DYNAMIC 1 53 | |
54/* 55 * Data structures 56 */ 57struct pfs_info; 58struct pfs_node; 59struct pfs_bitmap; 60 | 51/* 52 * Data structures 53 */ 54struct pfs_info; 55struct pfs_node; 56struct pfs_bitmap; 57 |
61typedef int (*pfs_fill_t)(struct pfs_node *, struct proc *, struct sbuf *); | 58#define PFS_FILL_ARGS \ 59 struct proc *curp, struct proc *p, struct pfs_node *pn, struct sbuf *sb 60#define PFS_FILL_PROTO(name) \ 61 int name(PFS_FILL_ARGS); 62typedef int (*pfs_fill_t)(PFS_FILL_ARGS); |
62 63struct pfs_bitmap; /* opaque */ 64 65/* 66 * pfs_info: describes a pseudofs instance 67 */ 68struct pfs_info { 69 char pi_name[MFSNAMELEN]; 70 struct pfs_node *pi_root; 71 /* members below this line aren't initialized */ 72 /* currently, the mutex is only used to protect the bitmap */ 73 struct mtx pi_mutex; 74 struct pfs_bitmap *pi_bitmap; 75}; 76 77/* | 63 64struct pfs_bitmap; /* opaque */ 65 66/* 67 * pfs_info: describes a pseudofs instance 68 */ 69struct pfs_info { 70 char pi_name[MFSNAMELEN]; 71 struct pfs_node *pi_root; 72 /* members below this line aren't initialized */ 73 /* currently, the mutex is only used to protect the bitmap */ 74 struct mtx pi_mutex; 75 struct pfs_bitmap *pi_bitmap; 76}; 77 78/* |
78 * pfs_node: describes a node (file or directory) within a pseudofs | 79 * pfs_node: describes a node (file or directory) within a pseudofs |
79 */ 80struct pfs_node { 81 char pn_name[PFS_NAMELEN]; 82 pfs_type_t pn_type; 83 int pn_flags; 84 uid_t pn_uid; 85 gid_t pn_gid; 86 mode_t pn_mode; 87 union { 88 void *_pn_data; 89 pfs_fill_t _pn_func; 90 struct pfs_node *_pn_nodes; 91 } u1; 92#define pn_data u1._pn_data 93#define pn_func u1._pn_func 94#define pn_nodes u1._pn_nodes 95 /* members below this line aren't initialized */ 96 struct pfs_node *pn_parent; | 80 */ 81struct pfs_node { 82 char pn_name[PFS_NAMELEN]; 83 pfs_type_t pn_type; 84 int pn_flags; 85 uid_t pn_uid; 86 gid_t pn_gid; 87 mode_t pn_mode; 88 union { 89 void *_pn_data; 90 pfs_fill_t _pn_func; 91 struct pfs_node *_pn_nodes; 92 } u1; 93#define pn_data u1._pn_data 94#define pn_func u1._pn_func 95#define pn_nodes u1._pn_nodes 96 /* members below this line aren't initialized */ 97 struct pfs_node *pn_parent; |
97 union { 98 u_int32_t _pn_fileno; 99 struct pfs_node *_pn_shadow; 100 } u2; 101#define pn_fileno u2._pn_fileno 102#define pn_shadow u2._pn_shadow | 98 u_int32_t pn_fileno; |
103}; 104 105#define PFS_NODE(name, type, flags, uid, gid, mode, data) \ 106 { (name), (type), (flags), (uid), (gid), (mode), { (data) } } 107#define PFS_DIR(name, flags, uid, gid, mode, nodes) \ 108 PFS_NODE(name, pfstype_dir, flags, uid, gid, mode, nodes) 109#define PFS_ROOT(nodes) \ 110 PFS_NODE("/", pfstype_root, 0, 0, 0, 0555, nodes) 111#define PFS_THIS \ 112 PFS_NODE(".", pfstype_this, 0, 0, 0, 0, NULL) 113#define PFS_PARENT \ 114 PFS_NODE("..", pfstype_parent, 0, 0, 0, 0, NULL) 115#define PFS_FILE(name, flags, uid, gid, mode, func) \ 116 PFS_NODE(name, pfstype_file, flags, uid, gid, mode, func) 117#define PFS_SYMLINK(name, flags, uid, gid, mode, func) \ 118 PFS_NODE(name, pfstype_symlink, flags, uid, gid, mode, func) | 99}; 100 101#define PFS_NODE(name, type, flags, uid, gid, mode, data) \ 102 { (name), (type), (flags), (uid), (gid), (mode), { (data) } } 103#define PFS_DIR(name, flags, uid, gid, mode, nodes) \ 104 PFS_NODE(name, pfstype_dir, flags, uid, gid, mode, nodes) 105#define PFS_ROOT(nodes) \ 106 PFS_NODE("/", pfstype_root, 0, 0, 0, 0555, nodes) 107#define PFS_THIS \ 108 PFS_NODE(".", pfstype_this, 0, 0, 0, 0, NULL) 109#define PFS_PARENT \ 110 PFS_NODE("..", pfstype_parent, 0, 0, 0, 0, NULL) 111#define PFS_FILE(name, flags, uid, gid, mode, func) \ 112 PFS_NODE(name, pfstype_file, flags, uid, gid, mode, func) 113#define PFS_SYMLINK(name, flags, uid, gid, mode, func) \ 114 PFS_NODE(name, pfstype_symlink, flags, uid, gid, mode, func) |
115#define PFS_PROCDIR(uid, gid, mode, nodes) \ 116 PFS_NODE("", pfstype_procdir, 0, uid, gid, mode, nodes) |
|
119#define PFS_LASTNODE \ 120 PFS_NODE("", pfstype_none, 0, 0, 0, 0, NULL) 121 122/* 123 * VFS interface 124 */ 125int pfs_mount (struct pfs_info *pi, 126 struct mount *mp, char *path, caddr_t data, --- 55 unchanged lines hidden --- | 117#define PFS_LASTNODE \ 118 PFS_NODE("", pfstype_none, 0, 0, 0, 0, NULL) 119 120/* 121 * VFS interface 122 */ 123int pfs_mount (struct pfs_info *pi, 124 struct mount *mp, char *path, caddr_t data, --- 55 unchanged lines hidden --- |