From e2cbb31311dcb5aad532570f7dffd777a8408ff1 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 10 Nov 1998 09:04:09 +0000 Subject: Make the vnode opv vector construction fully dynamic. Previously we leaked memory on each unload and were limited to items referenced in the kernel copy of vnode_if.c. Now a kernel module is free to create it's own VOP_FOO() routines and the rest of the system will happily deal with it, including passthrough layers like union/umap/etc. Have VFS_SET() call a common vfs_modevent() handler rather than inline duplicating the common code all over the place. Have VNODEOP_SET() have the vnodeops removed at unload time (assuming a module) so that the vop_t ** vector is reclaimed. Slightly adjust the vop_t ** vectors so that calling slot 0 is a panic rather than a page fault. This could happen if VOP_something() was called without *any* handlers being present anywhere (including in vfs_default.c). slot 1 becomes the default vector for the vnodeop table. TODO: reclaim zones on unload (eg: nfs code) --- sys/kern/vnode_if.pl | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'sys/kern/vnode_if.pl') diff --git a/sys/kern/vnode_if.pl b/sys/kern/vnode_if.pl index d289c35..8193edb 100644 --- a/sys/kern/vnode_if.pl +++ b/sys/kern/vnode_if.pl @@ -32,7 +32,7 @@ # SUCH DAMAGE. # # @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93 -# $Id: vnode_if.sh,v 1.14 1997/12/19 23:25:16 bde Exp $ +# $Id: vnode_if.sh,v 1.15 1998/07/04 20:45:32 julian Exp $ # # Script to produce VFS front-end sugar. @@ -188,7 +188,7 @@ cat << END_OF_LEADING_COMMENT > $CFILE #include struct vnodeop_desc vop_default_desc = { - 0, + 1, /* special case, vop_default => 1 */ "default", 0, NULL, @@ -400,39 +400,3 @@ struct vnodeop_desc vop_bwrite_desc = { NULL, }; END_OF_SPECIAL_CASES - -# Add the vfs_op_descs array to the C file. -$AWK ' - BEGIN { - printf("\nstruct vnodeop_desc *vfs_op_descs[] = {\n"); - printf("\t&vop_default_desc, /* MUST BE FIRST */\n"); - printf("\t&vop_strategy_desc, /* XXX: SPECIAL CASE */\n"); - printf("\t&vop_bwrite_desc, /* XXX: SPECIAL CASE */\n"); - } - END { - printf("\tNULL\n};\n"); - } - NF == 0 || $0 ~ "^#" { - next; - } - { - # Get the function name. - printf("\t&%s_desc,\n", $1); - - # Skip the function arguments. - for (;;) { - if (getline <= 0) - exit - if ($0 ~ "^};") - break; - } - }' < $SRC >> $CFILE - -cat << END_OF_NUMOPS_CODE >> $CFILE - -/* - * the -1 is to account for the NULL - * XXX is the NULL still necessary? I don't think so... - */ -int vfs_opv_numops = (sizeof(vfs_op_descs)/sizeof(struct vnodeop_desc *)) - 1; -END_OF_NUMOPS_CODE -- cgit v1.1