]> git.ozlabs.org Git - petitboot/blobdiff - discover/parser-utils.h
Use separate section for parsers array
[petitboot] / discover / parser-utils.h
index e82e3f9c81638be7cdbe2bedcbcca2eba98f66fa..955f5f4d7e6b7c730c3f4e7a2f8313dacd71afe1 100644 (file)
@@ -7,6 +7,16 @@
 
 #define artwork_pathname(file) (PKG_SHARE_DIR "/artwork/" file)
 
+#define define_parser(__name, __priority, __parse_fn)                  \
+       struct parser                                                   \
+               __attribute__((unused, section("parsers")))             \
+       __ ## __name ## _parser = {                                     \
+               .name           = #__name,                              \
+               .priority       = __priority,                           \
+               .parse          = __parse_fn,                           \
+       };
+
+
 void device_add_boot_option(struct device *device,
                struct boot_option *boot_option);