summaryrefslogtreecommitdiff
path: root/kernel/power/tuxonice_io.h
blob: 683eab7a0bf92d7f3683e82c2652bcf1c8eae478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * kernel/power/tuxonice_io.h
 *
 * Copyright (C) 2005-2015 Nigel Cunningham (nigel at nigelcunningham com au)
 *
 * This file is released under the GPLv2.
 *
 * It contains high level IO routines for hibernating.
 *
 */

#include <linux/utsname.h>
#include "tuxonice_pagedir.h"

/* Non-module data saved in our image header */
struct toi_header {
        /*
         * Mirror struct swsusp_info, but without
         * the page aligned attribute
         */
        struct new_utsname uts;
        u32 version_code;
        unsigned long num_physpages;
        int cpus;
        unsigned long image_pages;
        unsigned long pages;
        unsigned long size;

        /* Our own data */
        unsigned long orig_mem_free;
        int page_size;
        int pageset_2_size;
        int param0;
        int param1;
        int param2;
        int param3;
        int progress0;
        int progress1;
        int progress2;
        int progress3;
        int io_time[2][2];
        struct pagedir pagedir;
        dev_t root_fs;
        unsigned long bkd; /* Boot kernel data locn */
};

extern int write_pageset(struct pagedir *pagedir);
extern int write_image_header(void);
extern int read_pageset1(void);
extern int read_pageset2(int overwrittenpagesonly);

extern int toi_attempt_to_parse_resume_device(int quiet);
extern void attempt_to_parse_resume_device2(void);
extern void attempt_to_parse_alt_resume_param(void);
int image_exists_read(const char *page, int count);
int image_exists_write(const char *buffer, int count);
extern void save_restore_alt_param(int replace, int quiet);
extern atomic_t toi_io_workers;

/* Args to save_restore_alt_param */
#define RESTORE 0
#define SAVE 1

#define NOQUIET 0
#define QUIET 1

extern wait_queue_head_t toi_io_queue_flusher;
extern int toi_bio_queue_flusher_should_finish;

int fs_info_space_needed(void);

extern int toi_max_workers;