diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-06-15 20:52:03 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-06-15 20:52:03 +0000 |
commit | 36bbd74ce7b1d03b34846bfd76605dcd0afb9c38 (patch) | |
tree | 82f056fdf18b4891e1425b217ecb173e1e7a38d9 | |
parent | 150eafb37fe6a09e09b8d85d8d512bb6dfdcc9cc (diff) |
Formerly main.c.~11~
-rw-r--r-- | ufs/main.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -112,6 +112,9 @@ main (int argc, char **argv) char *devname; mach_port_t bootstrap; error_t err; + int sizes[DEV_GET_SIZE_COUNT]; + u_int sizescnt = 2; + save_argv = argv; @@ -133,9 +136,31 @@ main (int argc, char **argv) (diskfs_readonly ? 0 : D_WRITE) | D_READ, devname, &ufs_device); assert (!err); + + /* Check to make sure device sector size is reasonable. */ + err = device_get_status (ufs_device, DEV_GET_SIZE, sizes, &sizescnt); + assert (sizescnt == DEV_GET_SIZE_COUNT); + if (sizes[DEV_GET_SIZE_RECORD_SIZE] != DEV_BSIZE) + { + fprintf (stderr, "Bad device record size %d (should be %d)\n", + sizes[DEV_GET_SIZE_RECORD_SIZE], DEV_BSIZE); + exit (1); + } get_hypermetadata (); + /* Check to make sure device size is big enough. */ + if (sizes[DEV_GET_SIZE_DEVICE_SIZE] != 0) + if (sizes[DEV_GET_SIZE_DEVICE_SIZE] < 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); + } + if (!diskfs_readonly) { sblock->fs_clean = 0; |