summaryrefslogtreecommitdiffstats
path: root/sbin/dump/main.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2003-05-07 18:27:09 +0000
committermckusick <mckusick@FreeBSD.org>2003-05-07 18:27:09 +0000
commit2e1c393dfc9eb11b05e093718baa11cd6a695a7d (patch)
treea7524c265464698a3f6530ac94f5bfd5c18248e7 /sbin/dump/main.c
parent1d8f58ae39f8fac245c251478decd0c1cae5c402 (diff)
downloadFreeBSD-src-2e1c393dfc9eb11b05e093718baa11cd6a695a7d.zip
FreeBSD-src-2e1c393dfc9eb11b05e093718baa11cd6a695a7d.tar.gz
Dump is hard-wired to believe that it can read disks on
1024-byte boundaries. For many years this was a reasonable assumption. However, in recent years we have begun seeing devices with 2048-byte sectors. These devices return errors when dump tries to read starting in the middle of a sector or when it tries to read only the first half of a sector. Rather than change the native block size used by dump (and thus create an incompatible dump format), this fix checks for transfer requests that start and/or end on a non-sector boundary. When such a read is detected, the new code reads the entire sector and copies out just the part that dump needs. Reviewed by: Poul-Henning Kamp <phk@critter.freebsd.dk> Approved by: re (John Baldwin <jhb@FreeBSD.org>) Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sbin/dump/main.c')
-rw-r--r--sbin/dump/main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index 6866eb7..54ac7f0 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -388,6 +388,7 @@ main(int argc, char *argv[])
sync();
sblock = (struct fs *)sblock_buf;
for (i = 0; sblock_try[i] != -1; i++) {
+ sblock->fs_fsize = SBLOCKSIZE; /* needed in bread */
bread(sblock_try[i] >> dev_bshift, (char *) sblock, SBLOCKSIZE);
if ((sblock->fs_magic == FS_UFS1_MAGIC ||
(sblock->fs_magic == FS_UFS2_MAGIC &&
OpenPOWER on IntegriCloud