rem: size_t      sz;
context: init_vnode_layer(void){    int         err;    vnode       *vns;    vnode_id    vnid;    int         i;    fsystem     *fs;    nspace      *ns;    void        *data;    size_t      sz;    extern vnode_ops rootfs;  /* XXXdbg */    /*    compute vnnum based on memsize. 256 vnodes with 8MB.    compute usdvnnum based on vnnum. only 1/4 of total vnodes should    remain unlocked.     */    vnnum = memsize >> 15;    usdvnnum = vnnum >> 2;    vns = (vnode *) calloc(sizeof(vnode) * vnnum, 1);    for(i=0; i<vnnum; i++) {        vns[i].vnid = invalid_vnid;        vns[i].ns = NULL;        vns[i].mounted = NULL;        vns[i].remove = FALSE;        vns[i].busy = FALSE;        vns[i].inlist = FREE_LIST;        vns[i].nspace.next = vns[i].nspace.prev = NULL;        vns[i].list.next = (i == vnnum-1 ? NULL : &vns[i+1]);        vns[i].list.prev = (i == 0 ? NULL : &vns[i-1]);        vns[i].rcnt = 0;        vns[i].data = NULL;    }    lists[FREE_LIST].head = &vns[0];    lists[FREE_LIST].tail = &vns[vnnum-1];    lists[FREE_LIST].num = vnnum;    lists[USED_LIST].head = NULL;    lists[USED_LIST].tail = NULL;    lists[USED_LIST].num = 0;    lists[LOCKED_LIST].head = NULL;    lists[LOCKED_LIST].tail = NULL;    lists[LOCKED_LIST].num = 0;        skiplist = NewSL(&compare_vnode, NULL, NO_DUPLICATES);    /*    set max # of file systems and mount points.    with 8MB, up to 32 fs and 64 mount points.    */    nns = memsize >> 17;    nfs = memsize >> 18;    nxfsid = 1;    nxnsid = 1;    nstab = (nspace **) malloc(nns * sizeof(void *));    memset(nstab, 0, nns * sizeof(void *));    fstab = (fsystem **) malloc(nfs * sizeof(void *));    memset(fstab, 0, nfs * sizeof(void *));    new_lock(&vnlock, "vnlock");    new_lock(&fstablock, "fstablock");    /*    determine the max number of files the kernel can open.    8MB -> 256    */    max_glb_file = memsize >> 15;    global_fds = new_fds(max_glb_file);    /*    install file systems    */    install_file_system(&rootfs, "rootfs", TRUE, -1);    /*    mount the root file system    */    fs = inc_file_system("rootfs");    ns = (nspace *) malloc(sizeof(nspace));    ns->fs = fs;    ns->nsid = nxnsid++;    nstab[ns->nsid % nns] = ns;    ns->vnodes.head = ns->vnodes.tail = NULL;    ns->data = NULL;    ns->root = NULL;    ns->mount = NULL;    ns->shutdown = FALSE;    ns->prev = ns->next = NULL;    nshead = ns;    err = (*fs->ops.mount)(ns->nsid, NULL, 0, NULL, 0, &data, &vnid);    ns->data = data;    ns->root = lookup_vnode(ns->nsid, vnid);    rootvn = ns->root;#ifndef USER#ifdef DEBUG    add_debugger_cmd("ioctx",   dump_ioctx,   "dump a thread ioctx struct");    add_debugger_cmd("vnode",   dump_vnode,   "dump a vnode struct");    add_debugger_cmd("fdarray", dump_fdarray, "dump an fd array");    add_debugger_cmd("ofile",   dump_ofile,   "dump an ofile struct");    add_debugger_cmd("nspace",  dump_nspace,  "dump a nspace struct");    add_debugger_cmd("fsystem", dump_fsystem, "dump a fsystem struct");    add_debugger_cmd("ioinfo",  dump_io_info, "dump io info for a thread");    add_debugger_cmd("findvn",  find_vn,      "find a vnid (in all threads)");#endif /* DEBUG */#endif /* USER*/    return 0;}