summaryrefslogtreecommitdiff
path: root/ufs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-04-05 19:24:20 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-04-05 19:24:20 +0000
commitf4fc5fcda4fc24a31aef39ab8de44c441d41d342 (patch)
tree8b9d35f633eaa4015a91d55eeb035d8321f85cb1 /ufs
parentdbba26f827e34f3bd6edcf348251aa8f86823671 (diff)
Formerly hyper.c.~4~
Diffstat (limited to 'ufs')
-rw-r--r--ufs/hyper.c22
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. */