diff options
author | 2013-11-09 04:38:42 +0000 | |
---|---|---|
committer | 2013-11-09 04:38:42 +0000 | |
commit | 225caf6273d96397f4c0dc20b6d023a857f11e9b (patch) | |
tree | a745f781c8f926d5edad422f471ef684c7d9dfb8 /sys/kern/subr_hibernate.c | |
parent | add Intel 8 series kt (amt serial over lan) (diff) | |
download | wireguard-openbsd-225caf6273d96397f4c0dc20b6d023a857f11e9b.tar.xz wireguard-openbsd-225caf6273d96397f4c0dc20b6d023a857f11e9b.zip |
unbias the chunks and chunktable writing and reading. as a result, it
is now possible to move the chunktable right after the chunks, not at
the end of the swap.
ok mlarkin
Diffstat (limited to 'sys/kern/subr_hibernate.c')
-rw-r--r-- | sys/kern/subr_hibernate.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index 28a60cd51e3..4e3dfcba006 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.78 2013/11/06 19:53:08 deraadt Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.79 2013/11/09 04:38:42 deraadt Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -943,14 +943,10 @@ hibernate_write_chunktable(union hibernate_info *hib) struct hibernate_disk_chunk *chunks; vaddr_t hibernate_chunk_table_start; size_t hibernate_chunk_table_size; - daddr_t chunkbase; int i, err; hibernate_chunk_table_size = HIBERNATE_CHUNK_TABLE_SIZE; - chunkbase = hib->sig_offset - - (hibernate_chunk_table_size / DEV_BSIZE); - hibernate_chunk_table_start = hib->piglet_va + HIBERNATE_CHUNK_SIZE; @@ -960,7 +956,7 @@ hibernate_write_chunktable(union hibernate_info *hib) /* Write chunk table */ for (i = 0; i < hibernate_chunk_table_size; i += MAXPHYS) { if ((err = hib->io_func(hib->dev, - chunkbase + (i/DEV_BSIZE), + hib->chunktable_offset + (i/DEV_BSIZE), (vaddr_t)(hibernate_chunk_table_start + i), MAXPHYS, HIB_W, hib->io_page))) { DPRINTF("chunktable write error: %d\n", err); @@ -1549,6 +1545,7 @@ hibernate_write_chunks(union hibernate_info *hib) chunks[i].offset) * DEV_BSIZE; } + hib->chunktable_offset = hib->image_offset + blkctr; return (0); } @@ -1622,7 +1619,7 @@ hibernate_read_image(union hibernate_info *hib) /* Calculate total chunk table size in disk blocks */ chunktable_size = HIBERNATE_CHUNK_TABLE_SIZE / DEV_BSIZE; - blkctr = hib->sig_offset - chunktable_size; + blkctr = hib->chunktable_offset; chunktable = (vaddr_t)km_alloc(HIBERNATE_CHUNK_TABLE_SIZE, &kv_any, &kp_none, &kd_nowait); |