- struct vfsconf *newvfsconf = NULL;
- int j;
- int (***opv_desc_vector_p)() = NULL;
- int (**opv_desc_vector)();
- struct vnodeopv_entry_desc *opve_descp;
- int error = 0;
-
-#pragma unused(loadArgument)
-
- /*
- * This routine is responsible for all the initialization that would
- * ordinarily be done as part of the system startup; it calls synthfs_init
- * to do the initialization that is strictly synthfs-specific.
- */
-
- DBG_VOP(("load_synthfs: starting ...\n"));
-
- MALLOC(newvfsconf, void *, sizeof(struct vfsconf), M_SYNTHFS, M_WAITOK);
- DBG_VOP(("load_synthfs: Allocated new vfsconf list entry, newvfsconf = 0x%08lx.\n", (unsigned long)newvfsconf));
- bzero(newvfsconf, sizeof(struct vfsconf));
-
- if (newvfsconf) {
- DBG_VOP(("load_synthfs: filling in newly allocated vfsconf entry at 0x%08lX.\n", (long)newvfsconf));
- newvfsconf->vfc_vfsops = &synthfs_vfsops;
- strncpy(&newvfsconf->vfc_name[0], synthfs_fs_name, MFSNAMELEN);
- newvfsconf->vfc_typenum = maxvfsconf++;
- newvfsconf->vfc_refcount = 0;
- newvfsconf->vfc_flags = 0;
- newvfsconf->vfc_mountroot = NULL; /* Can't mount root of file system [yet] */
-
- newvfsconf->vfc_next = NULL;
-
- /* Based on vfs_op_init and ... */
- opv_desc_vector_p = synthfs_vnodeop_opv_desc.opv_desc_vector_p;
-
- DBG_VOP(("load_synthfs: Allocating and initializing VNode ops vector...\n"));
-
- /*
- * Allocate and init the vector.
- * Also handle backwards compatibility.
- */
-
- MALLOC(*opv_desc_vector_p, PFI *, vfs_opv_numops*sizeof(PFI), M_SYNTHFS, M_WAITOK);
- bzero (*opv_desc_vector_p, vfs_opv_numops*sizeof(PFI));
- opv_desc_vector = *opv_desc_vector_p;
- for (j=0; synthfs_vnodeop_opv_desc.opv_desc_ops[j].opve_op; j++) {
- opve_descp = &(synthfs_vnodeop_opv_desc.opv_desc_ops[j]);
-
- /*
- * Sanity check: is this operation listed
- * in the list of operations? We check this
- * by seeing if its offest is zero. Since
- * the default routine should always be listed
- * first, it should be the only one with a zero
- * offset. Any other operation with a zero
- * offset is probably not listed in
- * vfs_op_descs, and so is probably an error.
- *
- * A panic here means the layer programmer
- * has committed the all-too common bug
- * of adding a new operation to the layer's
- * list of vnode operations but
- * not adding the operation to the system-wide
- * list of supported operations.
- */
- if (opve_descp->opve_op->vdesc_offset == 0 &&
- opve_descp->opve_op->vdesc_offset != VOFFSET(vop_default)) {
- DBG_VOP(("load_synthfs: operation %s not listed in %s.\n",
- opve_descp->opve_op->vdesc_name,
- "vfs_op_descs"));
- panic ("load_synthfs: bad operation");
- }
- /*
- * Fill in this entry.
- */
- opv_desc_vector[opve_descp->opve_op->vdesc_offset] =
- opve_descp->opve_impl;
- }
-
- /*
- * Finally, go back and replace unfilled routines
- * with their default. (Sigh, an O(n^3) algorithm. I
- * could make it better, but that'd be work, and n is small.)
- */
- opv_desc_vector_p = synthfs_vnodeop_opv_desc.opv_desc_vector_p;
-
- /*
- * Force every operations vector to have a default routine.
- */
- opv_desc_vector = *opv_desc_vector_p;
- if (opv_desc_vector[VOFFSET(vop_default)]==NULL) {
- panic("load_vp;fs: operation vector without default routine.");
- }
- for (j = 0;j<vfs_opv_numops; j++)
- if (opv_desc_vector[j] == NULL)
- opv_desc_vector[j] =
- opv_desc_vector[VOFFSET(vop_default)];
-
- if (error = vfsconf_add(newvfsconf)) {
- goto ErrExit;
- };
- goto InitFS;
-
-
-ErrExit: ;
- if (opv_desc_vector_p && *opv_desc_vector_p) FREE(*opv_desc_vector_p, M_SYNTHFS);
-
- if (newvfsconf) FREE (newvfsconf, M_SYNTHFS);
- goto StdExit;
-
-
-InitFS: ;
- DBG_VOP(("load_synthfs: calling synthfs_init()...\n"));
- synthfs_init(newvfsconf);
- };
-
-StdExit: ;