added migrate time
[tridge/hacksm.git] / hacksm.h
1 #define _XOPEN_SOURCE 500
2 #define _GNU_SOURCE 
3
4 #include <stdio.h>
5 #include <unistd.h>
6 #include <stdlib.h>
7 #include <errno.h>
8 #include <sys/stat.h>
9 #include <fcntl.h>
10 #include <string.h>
11 #include <getopt.h>
12 #include <signal.h>
13 #include <utime.h>
14 #include <stdbool.h>
15 #include <sys/mman.h>
16 #include <sys/time.h>
17 #include <sys/wait.h>
18 #include <time.h>
19 #include <aio.h>
20 #include <dmapi.h>
21
22 #define discard_const(ptr) ((void *)((intptr_t)(ptr)))
23
24 const char *dmapi_event_string(dm_eventtype_t ev);
25 void hsm_recover_session(const char *name, dm_sessid_t *sid);
26 int hsm_store_open(dev_t device, ino_t inode, int flags);
27 int hsm_store_unlink(dev_t device, ino_t inode);
28
29 enum hsm_migrate_state {
30         HSM_STATE_START     = 0,
31         HSM_STATE_MIGRATED  = 1,
32         HSM_STATE_RECALL    = 2};
33
34 struct hsm_attr {
35         char magic[4];
36         time_t migrate_time;
37         off_t size;
38         dev_t device;
39         ino_t inode;
40         enum hsm_migrate_state state;
41 };
42
43 #define HSM_MAGIC "HSM1"
44 #define HSM_ATTRNAME "hackattr"
45
46 #define HSM_STORE "/hacksm_store"