2007-10-29 22:38:52 +01:00
|
|
|
/*
|
|
|
|
|
|
|
|
file: swap.h
|
|
|
|
|
2008-11-10 08:12:15 +01:00
|
|
|
Copyright (C) 1998-2004,2006,2008 Christophe GRENIER <grenier@cgsecurity.org>
|
2007-10-29 22:38:52 +01:00
|
|
|
|
|
|
|
this software is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the gnu general public license as published by
|
|
|
|
the free software foundation; either version 2 of the license, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
this program is distributed in the hope that it will be useful,
|
|
|
|
but without any warranty; without even the implied warranty of
|
|
|
|
merchantability or fitness for a particular purpose. see the
|
|
|
|
gnu general public license for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write the Free Software Foundation, Inc., 51
|
|
|
|
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
*/
|
2020-10-04 10:30:20 +02:00
|
|
|
|
|
|
|
#ifndef _SWAP_H
|
|
|
|
#define _SWAP_H
|
2009-01-10 16:04:39 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2007-10-29 22:38:52 +01:00
|
|
|
|
2012-08-12 20:43:38 +02:00
|
|
|
#define PAGE_SIZE 0x1000 /* 4k page */
|
|
|
|
#define PAGE_8K 0x2000 /* 8K page */
|
2007-10-29 22:38:52 +01:00
|
|
|
|
|
|
|
union swap_header {
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char reserved[PAGE_SIZE - 10];
|
|
|
|
char magic[10];
|
|
|
|
} magic;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
char bootbits[1024]; /* Space for disklabel etc. */
|
|
|
|
unsigned int version;
|
|
|
|
unsigned int last_page;
|
|
|
|
unsigned int nr_badpages;
|
|
|
|
/* char volume_name[16]; */
|
|
|
|
unsigned int padding[125];
|
|
|
|
unsigned int badpages[1];
|
|
|
|
} info;
|
2012-08-12 20:43:38 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
char reserved[PAGE_8K- 10];
|
|
|
|
char magic[10];
|
|
|
|
} magic8k;
|
2007-10-29 22:38:52 +01:00
|
|
|
};
|
|
|
|
|
2020-08-08 12:26:37 +02:00
|
|
|
/*@
|
|
|
|
@ requires \valid(disk_car);
|
|
|
|
@ requires \valid(partition);
|
|
|
|
@ requires separation: \separated(disk_car, partition);
|
2022-07-14 10:09:09 +02:00
|
|
|
@ decreases 0;
|
2020-08-08 12:26:37 +02:00
|
|
|
@*/
|
2009-02-03 09:29:29 +01:00
|
|
|
int check_Linux_SWAP(disk_t *disk_car, partition_t *partition);
|
2020-08-08 12:26:37 +02:00
|
|
|
|
|
|
|
/*@
|
|
|
|
@ requires \valid_read(swap_header);
|
|
|
|
@ requires \valid(partition);
|
|
|
|
@ requires separation: \separated(swap_header, partition);
|
|
|
|
@*/
|
2009-02-03 09:29:29 +01:00
|
|
|
int recover_Linux_SWAP(const union swap_header *swap_header, partition_t *partition);
|
2009-01-10 16:04:39 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* closing brace for extern "C" */
|
|
|
|
#endif
|
2020-10-04 10:30:20 +02:00
|
|
|
#endif
|