diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 687f66c619b3..5b6c39544b0a 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_linker.c,v 1.26 1999/02/16 10:49:48 dfr Exp $ + * $Id: kern_linker.c,v 1.27 1999/02/20 21:22:00 dfr Exp $ */ #include "opt_ddb.h" @@ -306,8 +306,8 @@ linker_load_file(const char* filename, linker_file_t* result) if (error != ENOENT) foundfile = 1; if (lf) { - linker_file_sysinit(lf); linker_file_register_sysctls(lf); + linker_file_sysinit(lf); *result = lf; error = 0; diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 1cbe2d43ad5c..d88deca3a870 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.43 1999/01/28 17:32:00 dillon Exp $ + * $Id: vfs_init.c,v 1.44 1999/02/16 10:49:49 dfr Exp $ */ @@ -331,13 +331,14 @@ int vfs_register(struct vfsconf *vfc) { struct linker_set *l; + struct sysctl_oid *oidp; struct vfsconf *vfsp; vfsp = NULL; l = &sysctl__vfs; if (vfsconf) for (vfsp = vfsconf; vfsp->vfc_next; vfsp = vfsp->vfc_next) - if (!strcmp(vfc->vfc_name, vfsp->vfc_name)) + if (strcmp(vfc->vfc_name, vfsp->vfc_name) == 0) return EEXIST; vfc->vfc_typenum = maxvfsconf++; @@ -347,6 +348,24 @@ vfs_register(struct vfsconf *vfc) vfsconf = vfc; vfc->vfc_next = NULL; + /* + * If this filesystem has a sysctl node under vfs + * (i.e. vfs.xxfs), then change the oid number of that node to + * match the filesystem's type number. This allows user code + * which uses the type number to read sysctl variables defined + * by the filesystem to continue working. Since the oids are + * in a sorted list, we need to make sure the order is + * preserved by re-registering the oid after modifying its + * number. + */ + for (oidp = SLIST_FIRST(&sysctl__vfs_children); oidp; + oidp = SLIST_NEXT(oidp, oid_link)) + if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) { + sysctl_unregister_oid(oidp); + oidp->oid_number = vfc->vfc_typenum; + sysctl_register_oid(oidp); + } + /* * Call init function for this VFS... */