summaryrefslogtreecommitdiff
path: root/ufs
diff options
context:
space:
mode:
Diffstat (limited to 'ufs')
-rw-r--r--ufs/main.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/ufs/main.c b/ufs/main.c
index f0ffa3f5..61531c22 100644
--- a/ufs/main.c
+++ b/ufs/main.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -36,6 +36,9 @@ struct store_parsed *store_parsed = 0;
char *diskfs_disk_name = 0;
+/* Number of device blocks per DEV_BSIZE block. */
+unsigned log2_dev_blocks_per_dev_bsize = 0;
+
/* Set diskfs_root_node to the root inode. */
static void
warp_root (void)
@@ -190,14 +193,17 @@ main (int argc, char **argv)
if (err)
error (3, err, "%s", diskfs_disk_name);
- if (store->block_size != DEV_BSIZE)
- error (4, err, "%s: Bad device record size %d (should be %d)",
+ if (store->block_size > DEV_BSIZE)
+ error (4, err, "%s: Bad device block size %d (should be <= %d)",
diskfs_disk_name, store->block_size, DEV_BSIZE);
- if (store->log2_block_size == 0)
- error (4, err, "%s: Device block size (%d) not a power of 2",
- diskfs_disk_name, store->block_size);
-
- assert (store->size >= SBSIZE + SBOFF);
+ if (store->size < SBSIZE + SBOFF)
+ error (5, 0, "%s: Disk too small (%ld bytes)", diskfs_disk_name,
+ store->size);
+
+ log2_dev_blocks_per_dev_bsize = 0;
+ while ((1 << log2_dev_blocks_per_dev_bsize) < DEV_BSIZE)
+ log2_dev_blocks_per_dev_bsize++;
+ log2_dev_blocks_per_dev_bsize -= store->log2_block_size;
/* Map the entire disk. */
create_disk_pager ();