vfs_init.c (27845) | vfs_init.c (29290) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed 6 * to Berkeley by John Heidemann of the UCLA Ficus project. 7 * 8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_init.c 8.3 (Berkeley) 1/4/94 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed 6 * to Berkeley by John Heidemann of the UCLA Ficus project. 7 * 8 * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_init.c 8.3 (Berkeley) 1/4/94 |
39 * $Id: vfs_init.c,v 1.25 1997/03/02 11:06:21 bde Exp $ | 39 * $Id: vfs_init.c,v 1.26 1997/08/02 14:31:44 bde Exp $ |
40 */ 41 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/mount.h> 47#include <sys/vnode.h> --- 17 unchanged lines hidden (view full) --- 65 66extern struct linker_set vfs_opv_descs_; 67#define vfs_opv_descs ((struct vnodeopv_desc **)vfs_opv_descs_.ls_items) 68 69extern struct linker_set vfs_set; 70 71extern struct vnodeop_desc *vfs_op_descs[]; 72 /* and the operations they perform */ | 40 */ 41 42 43#include <sys/param.h> 44#include <sys/systm.h> 45#include <sys/kernel.h> 46#include <sys/mount.h> 47#include <sys/vnode.h> --- 17 unchanged lines hidden (view full) --- 65 66extern struct linker_set vfs_opv_descs_; 67#define vfs_opv_descs ((struct vnodeopv_desc **)vfs_opv_descs_.ls_items) 68 69extern struct linker_set vfs_set; 70 71extern struct vnodeop_desc *vfs_op_descs[]; 72 /* and the operations they perform */ |
73/* 74 * This code doesn't work if the defn is **vnodop_defns with cc. 75 * The problem is because of the compiler sometimes putting in an 76 * extra level of indirection for arrays. It's an interesting 77 * "feature" of C. 78 */ 79static int vfs_opv_numops; | |
80 81/* 82 * A miscellaneous routine. 83 * A generic "default" routine that just returns an error. 84 */ 85int 86vn_default_error() 87{ --- 11 unchanged lines hidden (view full) --- 99 * vector. This allows third parties to extend the set of operations 100 * supported by another layer in a binary compatibile way. For example, 101 * assume that NFS needed to be modified to support Ficus. NFS has an entry 102 * (probably nfs_vnopdeop_decls) declaring all the operations NFS supports by 103 * default. Ficus could add another entry (ficus_nfs_vnodeop_decl_entensions) 104 * listing those new operations Ficus adds to NFS, all without modifying the 105 * NFS code. (Of couse, the OTW NFS protocol still needs to be munged, but 106 * that is a(whole)nother story.) This is a feature. | 73 74/* 75 * A miscellaneous routine. 76 * A generic "default" routine that just returns an error. 77 */ 78int 79vn_default_error() 80{ --- 11 unchanged lines hidden (view full) --- 92 * vector. This allows third parties to extend the set of operations 93 * supported by another layer in a binary compatibile way. For example, 94 * assume that NFS needed to be modified to support Ficus. NFS has an entry 95 * (probably nfs_vnopdeop_decls) declaring all the operations NFS supports by 96 * default. Ficus could add another entry (ficus_nfs_vnodeop_decl_entensions) 97 * listing those new operations Ficus adds to NFS, all without modifying the 98 * NFS code. (Of couse, the OTW NFS protocol still needs to be munged, but 99 * that is a(whole)nother story.) This is a feature. |
100 * 101 * Without an explicit reserve area, however, you must replace vnode_if.c 102 * and vnode_if.h when you do this, or you will be derefrencing of the 103 * end of vfs_op_descs[]. This is a flaw in the use of a structure 104 * pointer array rather than an agregate to define vfs_op_descs. So 105 * it's not a very dynamic "feature". |
|
107 */ 108void 109vfs_opv_init(struct vnodeopv_desc **them) 110{ 111 int i, j, k; 112 vop_t ***opv_desc_vector_p; 113 vop_t **opv_desc_vector; 114 struct vnodeopv_entry_desc *opve_descp; --- 77 unchanged lines hidden (view full) --- 192 * Initialize known vnode operations vectors. 193 */ 194static void 195vfs_op_init() 196{ 197 int i; 198 199 DODEBUG(printf("Vnode_interface_init.\n")); | 106 */ 107void 108vfs_opv_init(struct vnodeopv_desc **them) 109{ 110 int i, j, k; 111 vop_t ***opv_desc_vector_p; 112 vop_t **opv_desc_vector; 113 struct vnodeopv_entry_desc *opve_descp; --- 77 unchanged lines hidden (view full) --- 191 * Initialize known vnode operations vectors. 192 */ 193static void 194vfs_op_init() 195{ 196 int i; 197 198 DODEBUG(printf("Vnode_interface_init.\n")); |
199 DODEBUG(printf ("vfs_opv_numops=%d\n", vfs_opv_numops)); |
|
200 /* 201 * Set all vnode vectors to a well known value. 202 */ 203 for (i = 0; vfs_opv_descs[i]; i++) 204 *(vfs_opv_descs[i]->opv_desc_vector_p) = NULL; 205 /* | 200 /* 201 * Set all vnode vectors to a well known value. 202 */ 203 for (i = 0; vfs_opv_descs[i]; i++) 204 *(vfs_opv_descs[i]->opv_desc_vector_p) = NULL; 205 /* |
206 * Figure out how many ops there are by counting the table, 207 * and assign each its offset. | 206 * assign each op to its offset 207 * 208 * XXX This should not be needed, but is because the per 209 * XXX FS ops tables are not sorted according to the 210 * XXX vnodeop_desc's offset in vfs_op_descs. This 211 * XXX is the same reason we have to take the hit for 212 * XXX the static inline function calls instead of using 213 * XXX simple macro references. |
208 */ | 214 */ |
209 for (vfs_opv_numops = 0, i = 0; vfs_op_descs[i]; i++) { 210 vfs_op_descs[i]->vdesc_offset = vfs_opv_numops; 211 vfs_opv_numops++; 212 } 213 DODEBUG(printf ("vfs_opv_numops=%d\n", vfs_opv_numops)); | 215 for (i = 0; i < vfs_opv_numops; i++) 216 vfs_op_descs[i]->vdesc_offset = i; |
214} 215 216/* 217 * Routines having to do with the management of the vnode table. 218 */ 219extern struct vnodeops dead_vnodeops; 220extern struct vnodeops spec_vnodeops; 221struct vattr va_null; --- 71 unchanged lines hidden --- | 217} 218 219/* 220 * Routines having to do with the management of the vnode table. 221 */ 222extern struct vnodeops dead_vnodeops; 223extern struct vnodeops spec_vnodeops; 224struct vattr va_null; --- 71 unchanged lines hidden --- |