summaryrefslogtreecommitdiffstats
path: root/agents/virt/include/static_map.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 06:50:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 06:50:17 +0000
commit86ed03f8adee56c050c73018537371c230a664a6 (patch)
treeeae3d04cdf1c49848e5a671327ab38297f4acb0d /agents/virt/include/static_map.h
parentInitial commit. (diff)
downloadfence-agents-upstream.tar.xz
fence-agents-upstream.zip
Adding upstream version 4.12.1.upstream/4.12.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--agents/virt/include/static_map.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/agents/virt/include/static_map.h b/agents/virt/include/static_map.h
new file mode 100644
index 0000000..736e823
--- /dev/null
+++ b/agents/virt/include/static_map.h
@@ -0,0 +1,34 @@
+#ifndef _STATIC_MAP_H
+#define _STATIC_MAP_H
+
+typedef int (*map_load_t)(void *config, void **perm_info);
+typedef int (*map_check_t)(void *info, const char *src, const char *tgt_uuid, const char *tgt_name);
+typedef void (*map_cleanup_t)(void **info);
+
+typedef struct {
+ map_load_t load;
+ map_check_t check;
+ map_cleanup_t cleanup;
+ void *info;
+} map_object_t;
+
+/*
+ * These macros may be called from within a loadable module
+ */
+#define map_load(obj, config) \
+ obj->load(config, &obj->info)
+#define map_check(obj, src, tgt_uuid) \
+ obj->check(obj->info, src, tgt_uuid, NULL)
+#define map_check2(obj, src, tgt_uuid, tgt_name) \
+ obj->check(obj->info, src, tgt_uuid, tgt_name)
+#define map_free(obj) \
+ obj->cleanup(obj->info)
+
+/* Returns a copy of our simple config object */
+void *map_init(void);
+
+/* Frees a previously-allocated copy of our simple config object */
+void map_release(void *c);
+
+
+#endif