diff options
author | 2011-07-09 03:10:27 +0000 | |
---|---|---|
committer | 2011-07-09 03:10:27 +0000 | |
commit | b514ebc1646a999714235478a2e51e5b19ae94f3 (patch) | |
tree | a2a93adbb43388dab8ec3326c8c4d05250774c67 /sys/kern/subr_hibernate.c | |
parent | remove that rlimit code, rc.d and login classes do it much betterer these (diff) | |
download | wireguard-openbsd-b514ebc1646a999714235478a2e51e5b19ae94f3.tar.xz wireguard-openbsd-b514ebc1646a999714235478a2e51e5b19ae94f3.zip |
Call (temporarily, until we have RLE page encoding) uvm_pmr_zero_everything
on suspend to ensure we get good zlib compression.
Add MI signature block (hibernate_info) comparison routine
Diffstat (limited to 'sys/kern/subr_hibernate.c')
-rw-r--r-- | sys/kern/subr_hibernate.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index 69cfb2f25ca..1e01e618a8e 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.11 2011/07/09 01:30:39 mlarkin Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.12 2011/07/09 03:10:27 mlarkin Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -819,3 +819,34 @@ hibernate_check_overlap(paddr_t r1s, paddr_t r1e, paddr_t r2s, paddr_t r2e) return (0); } + +/* + * hibernate_compare_signature + * + * Compare two hibernate_infos to determine if they are the same (eg, + * we should be performing a hibernate resume on this machine. + * Not all fields are checked - just enough to verify that the machine + * has the same memory configuration and kernel as the one that + * wrote the signature previously. + */ +int +hibernate_compare_signature(union hibernate_info *mine, + union hibernate_info *disk) +{ + u_int i; + + if (mine->nranges != disk->nranges) + return (1); + + if (strcmp(mine->kernel_version, disk->kernel_version) != 0) + return (1); + + for (i=0; i< mine->nranges; i++) { + if ((mine->ranges[i].base != disk->ranges[i].base) || + (mine->ranges[i].end != disk->ranges[i].end) ) + return (1); + } + + return (0); +} + |