diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-04-05 19:24:20 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-04-05 19:24:20 +0000 |
commit | 91d53299a66d3b262293490f7fae4ffcaad08de4 (patch) | |
tree | 3522371ee2542af04878808e7a54c88f765ad087 /ufs/hyper.c | |
parent | 474b2b5ebc91dc6560b8aa6d8833cf6a9aec7929 (diff) |
Formerly hyper.c.~4~
Diffstat (limited to 'ufs/hyper.c')
-rw-r--r-- | ufs/hyper.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ufs/hyper.c b/ufs/hyper.c index dfe76bcf..bd58b7e4 100644 --- a/ufs/hyper.c +++ b/ufs/hyper.c @@ -18,6 +18,7 @@ #include "ufs.h" #include "fs.h" #include <string.h> +#include <stdio.h> void get_hypermetadata (void) @@ -26,7 +27,26 @@ get_hypermetadata (void) err = dev_read_sync (SBLOCK, (vm_address_t *)&sblock, SBSIZE); assert (!err); - + + if (sblock->fs_magic != FS_MAGIC) + { + fprintf (stderr, "Bad magic number %#lx (should be %#x)\n", + sblock->fs_magic, FS_MAGIC); + exit (1); + } + if (sblock->fs_bsize > 8192) + { + fprintf (stderr, "Block size %ld is too big (max is 8192 bytes)\n", + sblock->fs_bsize); + exit (1); + } + if (sblock->fs_bsize < sizeof (struct fs)) + { + fprintf (stderr, "Block size %ld is too small (min is %ld bytes)\n", + sblock->fs_bsize, sizeof (struct fs)); + exit (1); + } + /* If this is an old filesystem, then we have some more work to do; some crucial constants might not be set; we are therefore forced to set them here. */ |