summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-09-10 20:11:02 +0000
committerphk <phk@FreeBSD.org>1997-09-10 20:11:02 +0000
commita300d400e95ae536e411be55d358e7ab886c2edf (patch)
tree0f8ca44ceac4e4291bff2fc1dd520413fe096337
parent1a50603a249c2949b7e49144a2ecebc38586ec6d (diff)
downloadFreeBSD-src-a300d400e95ae536e411be55d358e7ab886c2edf.zip
FreeBSD-src-a300d400e95ae536e411be55d358e7ab886c2edf.tar.gz
3 lines of code and updates to a number of comments.
Reviewed by: phk Submitted by: Terry Lambert <tlambert@primenet.com>
-rw-r--r--sys/kern/vfs_init.c33
-rw-r--r--sys/kern/vnode_if.pl12
-rw-r--r--sys/kern/vnode_if.sh12
-rw-r--r--sys/tools/vnode_if.awk12
4 files changed, 51 insertions, 18 deletions
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index 5754b62..b52b08b 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
- * $Id: vfs_init.c,v 1.25 1997/03/02 11:06:21 bde Exp $
+ * $Id: vfs_init.c,v 1.26 1997/08/02 14:31:44 bde Exp $
*/
@@ -70,13 +70,6 @@ extern struct linker_set vfs_set;
extern struct vnodeop_desc *vfs_op_descs[];
/* and the operations they perform */
-/*
- * This code doesn't work if the defn is **vnodop_defns with cc.
- * The problem is because of the compiler sometimes putting in an
- * extra level of indirection for arrays. It's an interesting
- * "feature" of C.
- */
-static int vfs_opv_numops;
/*
* A miscellaneous routine.
@@ -104,6 +97,12 @@ vn_default_error()
* listing those new operations Ficus adds to NFS, all without modifying the
* NFS code. (Of couse, the OTW NFS protocol still needs to be munged, but
* that is a(whole)nother story.) This is a feature.
+ *
+ * Without an explicit reserve area, however, you must replace vnode_if.c
+ * and vnode_if.h when you do this, or you will be derefrencing of the
+ * end of vfs_op_descs[]. This is a flaw in the use of a structure
+ * pointer array rather than an agregate to define vfs_op_descs. So
+ * it's not a very dynamic "feature".
*/
void
vfs_opv_init(struct vnodeopv_desc **them)
@@ -197,20 +196,24 @@ vfs_op_init()
int i;
DODEBUG(printf("Vnode_interface_init.\n"));
+ DODEBUG(printf ("vfs_opv_numops=%d\n", vfs_opv_numops));
/*
* Set all vnode vectors to a well known value.
*/
for (i = 0; vfs_opv_descs[i]; i++)
*(vfs_opv_descs[i]->opv_desc_vector_p) = NULL;
/*
- * Figure out how many ops there are by counting the table,
- * and assign each its offset.
+ * assign each op to its offset
+ *
+ * XXX This should not be needed, but is because the per
+ * XXX FS ops tables are not sorted according to the
+ * XXX vnodeop_desc's offset in vfs_op_descs. This
+ * XXX is the same reason we have to take the hit for
+ * XXX the static inline function calls instead of using
+ * XXX simple macro references.
*/
- for (vfs_opv_numops = 0, i = 0; vfs_op_descs[i]; i++) {
- vfs_op_descs[i]->vdesc_offset = vfs_opv_numops;
- vfs_opv_numops++;
- }
- DODEBUG(printf ("vfs_opv_numops=%d\n", vfs_opv_numops));
+ for (i = 0; i < vfs_opv_numops; i++)
+ vfs_op_descs[i]->vdesc_offset = i;
}
/*
diff --git a/sys/kern/vnode_if.pl b/sys/kern/vnode_if.pl
index 75f49a7..d351d8e 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$
+# $Id: vnode_if.sh,v 1.11 1997/02/22 09:39:36 peter Exp $
#
# Script to produce VFS front-end sugar.
@@ -397,6 +397,8 @@ static inline int VOP_BWRITE(bp)
a.a_bp = bp;
return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a));
}
+
+extern int vfs_opv_numops;
END_OF_SPECIAL_CASES
cat << END_OF_SPECIAL_CASES >> $CFILE
@@ -457,3 +459,11 @@ $AWK '
}
}' < $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
diff --git a/sys/kern/vnode_if.sh b/sys/kern/vnode_if.sh
index 75f49a7..d351d8e 100644
--- a/sys/kern/vnode_if.sh
+++ b/sys/kern/vnode_if.sh
@@ -32,7 +32,7 @@
# SUCH DAMAGE.
#
# @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93
-# $Id$
+# $Id: vnode_if.sh,v 1.11 1997/02/22 09:39:36 peter Exp $
#
# Script to produce VFS front-end sugar.
@@ -397,6 +397,8 @@ static inline int VOP_BWRITE(bp)
a.a_bp = bp;
return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a));
}
+
+extern int vfs_opv_numops;
END_OF_SPECIAL_CASES
cat << END_OF_SPECIAL_CASES >> $CFILE
@@ -457,3 +459,11 @@ $AWK '
}
}' < $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
diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk
index 75f49a7..d351d8e 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$
+# $Id: vnode_if.sh,v 1.11 1997/02/22 09:39:36 peter Exp $
#
# Script to produce VFS front-end sugar.
@@ -397,6 +397,8 @@ static inline int VOP_BWRITE(bp)
a.a_bp = bp;
return (VCALL((bp)->b_vp, VOFFSET(vop_bwrite), &a));
}
+
+extern int vfs_opv_numops;
END_OF_SPECIAL_CASES
cat << END_OF_SPECIAL_CASES >> $CFILE
@@ -457,3 +459,11 @@ $AWK '
}
}' < $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