/usr/include/criu/criu-plugin.h is in criu 2.0-2ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /*
* This file defines types and macros for CRIU plugins.
* Copyright (C) 2013-2014 Parallels, Inc
*
* This program 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 to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __CRIU_PLUGIN_H__
#define __CRIU_PLUGIN_H__
#include <limits.h>
#include <stdbool.h>
#define CRIU_PLUGIN_GEN_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define CRIU_PLUGIN_VERSION_MAJOR 0
#define CRIU_PLUGIN_VERSION_MINOR 2
#define CRIU_PLUGIN_VERSION_SUBLEVEL 0
#define CRIU_PLUGIN_VERSION_OLD CRIU_PLUGIN_GEN_VERSION(0,1,0)
#define CRIU_PLUGIN_VERSION \
CRIU_PLUGIN_GEN_VERSION(CRIU_PLUGIN_VERSION_MAJOR, \
CRIU_PLUGIN_VERSION_MINOR, \
CRIU_PLUGIN_VERSION_SUBLEVEL)
/*
* Plugin hook points and their arguments in hooks.
*/
enum {
CR_PLUGIN_HOOK__DUMP_UNIX_SK = 0,
CR_PLUGIN_HOOK__RESTORE_UNIX_SK = 1,
CR_PLUGIN_HOOK__DUMP_EXT_FILE = 2,
CR_PLUGIN_HOOK__RESTORE_EXT_FILE = 3,
CR_PLUGIN_HOOK__DUMP_EXT_MOUNT = 4,
CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT = 5,
CR_PLUGIN_HOOK__DUMP_EXT_LINK = 6,
CR_PLUGIN_HOOK__MAX
};
#define DECLARE_PLUGIN_HOOK_ARGS(__hook, ...) \
typedef int (__hook ##_t)(__VA_ARGS__)
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_UNIX_SK, int fd, int id);
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_UNIX_SK, int id);
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_FILE, int fd, int id);
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id);
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_MOUNT, char *mountpoint, int id);
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT, int id, char *mountpoint, char *old_root, int *is_file);
DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_LINK, int index, int type, char *kind);
enum {
CR_PLUGIN_STAGE__DUMP,
CR_PLUGIN_STAGE__PRE_DUMP,
CR_PLUGIN_STAGE__RESTORE,
CR_PLUGIN_STAGE_MAX
};
/*
* Plugin descriptor.
*/
typedef struct {
const char *name;
int (*init)(int stage);
void (*exit)(int stage, int ret);
unsigned int version;
unsigned int max_hooks;
void *hooks[CR_PLUGIN_HOOK__MAX];
} cr_plugin_desc_t;
extern cr_plugin_desc_t CR_PLUGIN_DESC;
#define CR_PLUGIN_REGISTER(___name, ___init, ___exit) \
cr_plugin_desc_t CR_PLUGIN_DESC = { \
.name = ___name, \
.init = ___init, \
.exit = ___exit, \
.version = CRIU_PLUGIN_VERSION, \
.max_hooks = CR_PLUGIN_HOOK__MAX, \
};
static inline int cr_plugin_dummy_init(int stage) { return 0; }
static inline void cr_plugin_dummy_exit(int stage, int ret) { }
#define CR_PLUGIN_REGISTER_DUMMY(___name) \
cr_plugin_desc_t CR_PLUGIN_DESC = { \
.name = ___name, \
.init = cr_plugin_dummy_init, \
.exit = cr_plugin_dummy_exit, \
.version = CRIU_PLUGIN_VERSION, \
.max_hooks = CR_PLUGIN_HOOK__MAX, \
};
#define CR_PLUGIN_REGISTER_HOOK(__hook, __func) \
static void __attribute__((constructor)) cr_plugin_register_hook_##__func (void) \
{ \
CR_PLUGIN_DESC.hooks[__hook] = (void *)__func; \
}
/* Public API */
extern int criu_get_image_dir(void);
/*
* Deprecated, will be removed in next version.
*/
typedef int (cr_plugin_init_t)(void);
typedef void (cr_plugin_fini_t)(void);
typedef int (cr_plugin_dump_unix_sk_t)(int fd, int id);
typedef int (cr_plugin_restore_unix_sk_t)(int id);
typedef int (cr_plugin_dump_file_t)(int fd, int id);
typedef int (cr_plugin_restore_file_t)(int id);
typedef int (cr_plugin_dump_ext_mount_t)(char *mountpoint, int id);
typedef int (cr_plugin_restore_ext_mount_t)(int id, char *mountpoint, char *old_root, int *is_file);
typedef int (cr_plugin_dump_ext_link_t)(int index, int type, char *kind);
#endif /* __CRIU_PLUGIN_H__ */
|