-/* $OpenBSD: subr_hibernate.c,v 1.131 2022/01/07 02:26:53 guenther Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.132 2022/01/07 02:47:07 guenther Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
* guaranteed to not match any valid hib.
*/
int
-hibernate_clear_signature(void)
+hibernate_clear_signature(union hibernate_info *hib)
{
union hibernate_info blank_hiber_info;
- union hibernate_info hib;
/* Zero out a blank hiber_info */
memset(&blank_hiber_info, 0, sizeof(union hibernate_info));
- /* Get the signature block location */
- if (get_hibernate_info(&hib, 0))
- return (1);
-
/* Write (zeroed) hibernate info to disk */
DPRINTF("clearing hibernate signature block location: %lld\n",
- hib.sig_offset);
- if (hibernate_block_io(&hib,
- hib.sig_offset,
+ hib->sig_offset);
+ if (hibernate_block_io(hib,
+ hib->sig_offset,
DEV_BSIZE, (vaddr_t)&blank_hiber_info, 1))
printf("Warning: could not clear hibernate signature\n");
* We (possibly) found a hibernate signature. Clear signature first,
* to prevent accidental resume or endless resume cycles later.
*/
- if (hibernate_clear_signature()) {
+ if (hibernate_clear_signature(&hib)) {
DPRINTF("error clearing hibernate signature block\n");
splx(s);
return;
-/* $OpenBSD: hibernate.h,v 1.42 2018/06/21 07:33:30 mlarkin Exp $ */
+/* $OpenBSD: hibernate.h,v 1.43 2022/01/07 02:47:06 guenther Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
int hibernate_write_signature(union hibernate_info *);
int hibernate_write_chunktable(union hibernate_info *);
int hibernate_write_chunks(union hibernate_info *);
-int hibernate_clear_signature(void);
+int hibernate_clear_signature(union hibernate_info *);
int hibernate_compare_signature(union hibernate_info *,
union hibernate_info *);
void hibernate_resume(void);