File: static_map.h

package info (click to toggle)
fence-virt 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 772 kB
  • sloc: ansic: 10,257; cpp: 382; makefile: 272; sh: 214; lex: 113; yacc: 105
file content (32 lines) | stat: -rw-r--r-- 756 bytes parent folder | download
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
#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);
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) \
	obj->check(obj->info, src, tgt)
#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