From 339052d43343d0d087d5193738914b2d75d828e1 Mon Sep 17 00:00:00 2001 From: Lon Hohberger Date: Thu, 14 Jan 2010 15:33:50 -0500 Subject: [PATCH] Add missing static_map.h Signed-off-by: Lon Hohberger --- include/static_map.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 include/static_map.h diff --git a/include/static_map.h b/include/static_map.h new file mode 100644 index 0000000..3660018 --- /dev/null +++ b/include/static_map.h @@ -0,0 +1,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