summaryrefslogtreecommitdiffstats
path: root/sys/tools/vnode_if.awk
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-11-10 09:04:09 +0000
committerpeter <peter@FreeBSD.org>1998-11-10 09:04:09 +0000
commite2cbb31311dcb5aad532570f7dffd777a8408ff1 (patch)
tree6100304ba9db8f31f528cba0b8c097a47549fe8f /sys/tools/vnode_if.awk
parentb8784ef1750330bf06be7cd66106d137faba55b7 (diff)
downloadFreeBSD-src-e2cbb31311dcb5aad532570f7dffd777a8408ff1.zip
FreeBSD-src-e2cbb31311dcb5aad532570f7dffd777a8408ff1.tar.gz
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)
Diffstat (limited to 'sys/tools/vnode_if.awk')
-rw-r--r--sys/tools/vnode_if.awk40
1 files changed, 2 insertions, 38 deletions
diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk
index d289c35..8193edb 100644
--- a/sys/tools/vnode_if.awk
+++ b/sys/tools/vnode_if.awk
@@ -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 <sys/vnode.h>
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
OpenPOWER on IntegriCloud