static int sysctl_vfs_generic_conf(SYSCTLFN_ARGS) { struct vfsconf vfc; extern const char * const mountcompatnames[]; extern int nmountcompatnames; struct sysctlnode node; struct vfsops *vfsp; u_int vfsnum; if (namelen != 1) return (ENOTDIR); vfsnum = name[0]; if (vfsnum >= nmountcompatnames || mountcompatnames[vfsnum] == NULL) return (EOPNOTSUPP); vfsp = vfs_getopsbyname(mountcompatnames[vfsnum]); if (vfsp == NULL) return (EOPNOTSUPP); vfc.vfc_vfsops = vfsp; strncpy(vfc.vfc_name, vfsp->vfs_name, sizeof(vfc.vfc_name)); vfc.vfc_typenum = vfsnum; vfc.vfc_refcount = vfsp->vfs_refcount; vfc.vfc_flags = 0; vfc.vfc_mountroot = vfsp->vfs_mountroot; vfc.vfc_next = NULL; vfs_delref(vfsp); node = *rnode; node.sysctl_data = &vfc; return (sysctl_lookup(SYSCTLFN_CALL(&node))); }
void cpu_rootconf(void) { struct dev_data *dd; struct device *dv; struct vfsops *vops; /* * Find boot device. */ if ((bootdev & B_MAGICMASK) != B_DEVMAGIC) { printf("WARNING: boot program didn't supply boot device.\n"); printf("Please update your boot program.\n"); } else { findbootdev(); if (booted_device == NULL) { printf("WARNING: can't find match for bootdev:\n"); printf( "type = %d, ctlr = %d, slave = %d, punit = %d, part = %d\n", B_TYPE(bootdev), B_ADAPTOR(bootdev), B_CONTROLLER(bootdev), B_UNIT(bootdev), B_PARTITION(bootdev)); bootdev = 0; /* invalidate bootdev */ } else { printf("boot device: %s\n", booted_device->dv_xname); } } dv = booted_device; /* * If wild carded root device and wired down NFS root file system, * pick the network interface device to use. */ if (rootspec == NULL) { vops = vfs_getopsbyname("nfs"); if (vops != NULL && vops->vfs_mountroot == mountroot) { for (dd = LIST_FIRST(&dev_data_list); dd != NULL; dd = LIST_NEXT(dd, dd_list)) { if (device_class(dd->dd_dev) == DV_IFNET) { /* Got it! */ dv = dd->dd_dev; break; } } if (dd == NULL) { printf("no network interface for NFS root"); dv = NULL; } } } /* * If bootdev is bogus, ask the user anyhow. */ if (bootdev == 0) boothowto |= RB_ASKNAME; /* * If we booted from tape, ask the user. */ if (booted_device != NULL && device_class(booted_device) == DV_TAPE) boothowto |= RB_ASKNAME; setroot(dv, booted_partition); /* * Set bootdev based on what we found as the root. * This is given to the boot program when we reboot. */ setbootdev(); }