lib/system: Add vgscan, vgchange utilities
[petitboot] / discover / parser-utils.h
index e82e3f9c81638be7cdbe2bedcbcca2eba98f66fa..9096b311ce6ecc00b4fd0d3f0c851fe8f588a4c5 100644 (file)
@@ -1,12 +1,25 @@
 #ifndef PARSER_UTILS_H
 #define PARSER_UTILS_H
 
+#include "types/types.h"
 #include "parser.h"
 
 #define streq(a,b) (!strcasecmp((a),(b)))
 
 #define artwork_pathname(file) (PKG_SHARE_DIR "/artwork/" file)
 
+#define __parser_funcname(_n) __register_parser ## _ ## _n
+#define  _parser_funcname(_n) __parser_funcname(_n)
+
+#define register_parser(_parser)                                       \
+       static  __attribute__((constructor))                            \
+               void _parser_funcname(__COUNTER__)(void)                \
+       {                                                               \
+               __register_parser(&_parser);                            \
+       }
+
+void __register_parser(struct parser *parser);
+
 void device_add_boot_option(struct device *device,
                struct boot_option *boot_option);