diff options
author | Miles Bader <miles@gnu.org> | 1997-06-20 19:26:29 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-06-20 19:26:29 +0000 |
commit | 8525a4a02951672e3938d03a95f10dc5fc57aa51 (patch) | |
tree | 533101d0565d3601a122c4a6ecde22d07cc1105b | |
parent | cb252fa897afb4adb1b6a2a52c6573cb20328f6a (diff) |
(log2_dev_blocks_per_bsize):
New variable.
(main):
Only require device-block-size to be <= DEV_BSIZE.
Get rid of device-block-size-is-power-of-2 check.
Set LOG2_DEV_BLOCKS_PER_BSIZE.
Exit with an error if the disk is too small rather than assert failing.
-rw-r--r-- | ufs/main.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -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 (); |