diff options
-rw-r--r-- | ufs/main.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -98,7 +98,6 @@ main (int argc, char **argv) error_t err; int sizes[DEV_GET_SIZE_COUNT]; u_int sizescnt = 2; - save_argv = argv; @@ -145,6 +144,29 @@ main (int argc, char **argv) exit (1); } + diskpagersize = sizes[DEV_GET_SIZE_DEVICE_SIZE]; + assert (diskpagersize >= SBSIZE + SBOFF); + + /* Map the entire disk. */ + create_disk_pager (); + + err = vm_map (mach_task_self (), (vm_address_t *)&disk_image, + diskpagersize, 0, 1, diskpagerport, 0, 0, + VM_PROT_READ | (diskfs_readonly ? 0 : VM_PROT_WRITE), + VM_PROT_READ | (diskfs_readonly ? 0 : VM_PROT_WRITE), + VM_INHERIT_NONE); + assert (!err); + + if (diskpagersize < sblock->fs_size * sblock->fs_fsize) + { + fprintf (stderr, + "Disk size %d less than necessary " + "(superblock says we need %ld)\n", + sizes[DEV_GET_SIZE_DEVICE_SIZE], + sblock->fs_size * sblock->fs_fsize); + exit (1); + } + get_hypermetadata (); /* Check to make sure device size is big enough. */ |