summaryrefslogtreecommitdiffstats
path: root/lib/libufs
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2003-01-27 01:57:15 +0000
committerjmallett <jmallett@FreeBSD.org>2003-01-27 01:57:15 +0000
commit3b9e60f68a666508e335feabcb1c7eb2afde4935 (patch)
tree4a7108f7b9b6bcaa390e9b87ff4b9d4371e343e1 /lib/libufs
parent194d4d0ebe88dd44ab7d65399df465a2dd2db945 (diff)
downloadFreeBSD-src-3b9e60f68a666508e335feabcb1c7eb2afde4935.zip
FreeBSD-src-3b9e60f68a666508e335feabcb1c7eb2afde4935.tar.gz
If we don't know where the sblock is (e.g. filling out a blank disk), then
get it from the fs structure. Really libufs should have interfaces to generate both what we export, and what we import, based on eachother, and this should be full of redundant code to make sure everything is right... But really, we don't even deal with checksums, so plenty of room to improve.
Diffstat (limited to 'lib/libufs')
-rw-r--r--lib/libufs/sblock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libufs/sblock.c b/lib/libufs/sblock.c
index d769edb..455fee0 100644
--- a/lib/libufs/sblock.c
+++ b/lib/libufs/sblock.c
@@ -99,6 +99,10 @@ sbwrite(struct uufsd *disk, int all)
fs = &disk->d_fs;
+ if (!disk->d_sblock) {
+ disk->d_sblock = disk->d_fs.fs_sblockloc / disk->d_bsize;
+ }
+
if (bwrite(disk, disk->d_sblock, fs, SBLOCKSIZE) == -1) {
ERROR(disk, "failed to write superblock");
return -1;
OpenPOWER on IntegriCloud