]> git.ozlabs.org Git - petitboot/commitdiff
lib/types: Create common file for type definitions
authorJeremy Kerr <jk@ozlabs.org>
Wed, 10 Apr 2013 02:19:13 +0000 (12:19 +1000)
committerGeoff Levand <geoff@infradead.org>
Wed, 10 Apr 2013 17:49:01 +0000 (10:49 -0700)
The device and boot_option types are defined in pb-protocol.h, but
aren't really specific to the procotol. This means a lot of
non-messaging-related files are #including the protocol definitions
unnecessarily.

This change separates the types out into lib/types/types.h.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Geoff Levand <geoff@infradead.org>
17 files changed:
discover/device-handler.c
discover/grub2-parser.c
discover/kboot-parser.c
discover/parser-utils.c
discover/parser-utils.h
discover/parser.c
discover/yaboot-parser.c
lib/Makefile.am
lib/pb-protocol/pb-protocol.h
lib/types/types.h [new file with mode: 0644]
test/parser/parser-test.c
ui/common/discover-client.h
ui/common/ui-system.h
ui/ncurses/nc-ked.h
ui/ncurses/nc-menu.h
ui/twin/pbt-client.c
ui/twin/pbt-menu.h

index bda724cc3badcf1ea46e6d92520b7e3c71411644..0d4349671dfa6c375f223cde0f43877c41ddad71 100644 (file)
@@ -10,7 +10,7 @@
 #include <talloc/talloc.h>
 #include <list/list.h>
 #include <log/log.h>
 #include <talloc/talloc.h>
 #include <list/list.h>
 #include <log/log.h>
-#include <pb-protocol/pb-protocol.h>
+#include <types/types.h>
 #include <system/system.h>
 
 #include "device-handler.h"
 #include <system/system.h>
 
 #include "device-handler.h"
index f6cbccbaa6e6311aaa402c87199c3c1526ce669c..df1b755715d776acf93b37e8095afcdddcdeba22 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "log/log.h"
 #include "talloc/talloc.h"
 
 #include "log/log.h"
 #include "talloc/talloc.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "parser-conf.h"
 #include "parser-utils.h"
 #include "paths.h"
 #include "parser-conf.h"
 #include "parser-utils.h"
 #include "paths.h"
index 29324cb224f3ac7ad454131b55803b4f75e796b1..2954d89d44c013c500ce634e7ef51bb22a2247c5 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "log/log.h"
 #include "talloc/talloc.h"
 
 #include "log/log.h"
 #include "talloc/talloc.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "parser-conf.h"
 #include "parser-utils.h"
 #include "paths.h"
 #include "parser-conf.h"
 #include "parser-utils.h"
 #include "paths.h"
index 47e30d8055040cb28b9b876ff7d88ffa4cb45ac6..5792f0a1d587a790814bd449af1f8d00aaf1f4cc 100644 (file)
@@ -4,7 +4,7 @@
 #include <log/log.h>
 #include <talloc/talloc.h>
 
 #include <log/log.h>
 #include <talloc/talloc.h>
 
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "event.h"
 #include "udev.h"
 #include "device-handler.h"
 #include "event.h"
 #include "udev.h"
 #include "device-handler.h"
index fe28b7bd74d7adfd100f011649fdbf27f17aca24..107f4f3ab02c6bba935e09b4552e72faf7cb5ed0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PARSER_UTILS_H
 #define PARSER_UTILS_H
 
 #ifndef PARSER_UTILS_H
 #define PARSER_UTILS_H
 
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "parser.h"
 
 #define streq(a,b) (!strcasecmp((a),(b)))
 #include "parser.h"
 
 #define streq(a,b) (!strcasecmp((a),(b)))
index beaacccbdb1973e3ccb1ba0b3a1e570f4c87cc61..d0b0477ff5389050713005d4d582de98d16e17e0 100644 (file)
@@ -1,7 +1,7 @@
 
 #include <stdlib.h>
 
 
 #include <stdlib.h>
 
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include <log/log.h>
 
 #include "device-handler.h"
 #include <log/log.h>
 
 #include "device-handler.h"
index 430649266aa77bcf6f67f5a1ed89466e441cd129..59e52b82ac9f0315de5ee62118a063b9da59169d 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "log/log.h"
 #include "talloc/talloc.h"
 
 #include "log/log.h"
 #include "talloc/talloc.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "parser-conf.h"
 #include "parser-utils.h"
 #include "paths.h"
 #include "parser-conf.h"
 #include "parser-utils.h"
 #include "paths.h"
index 6440fe4a4865ff04465e541653a29e414b5fa904..7847d0968a48576da199a9ce8369faafcc8d83af 100644 (file)
@@ -28,6 +28,7 @@ libpbcore_la_SOURCES = \
        waiter/waiter.h \
        pb-protocol/pb-protocol.c \
        pb-protocol/pb-protocol.h \
        waiter/waiter.h \
        pb-protocol/pb-protocol.c \
        pb-protocol/pb-protocol.h \
+       types/types.h \
        talloc/talloc.c \
        talloc/talloc.h \
        system/system.c \
        talloc/talloc.c \
        talloc/talloc.h \
        system/system.c \
index bfa92222606443e6632034c193125d2ad1f45068..07ef7e15f0a1cbe2bf4c501bf3242a947a343793 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdio.h>
 
 #include <list/list.h>
 #include <stdio.h>
 
 #include <list/list.h>
+#include <types/types.h>
 
 #define PB_SOCKET_PATH "/tmp/petitboot.ui"
 
 
 #define PB_SOCKET_PATH "/tmp/petitboot.ui"
 
@@ -21,32 +22,6 @@ struct pb_protocol_message {
        char     payload[];
 };
 
        char     payload[];
 };
 
-struct device {
-       char *id;
-       char *name;
-       char *description;
-       char *icon_file;
-
-       struct list boot_options;
-
-       int n_options;
-       void *ui_info;
-};
-
-struct boot_option {
-       char *id;
-       char *name;
-       char *description;
-       char *icon_file;
-       char *boot_image_file;
-       char *initrd_file;
-       char *boot_args;
-
-       struct list_item list;
-
-       void *ui_info;
-};
-
 void pb_protocol_dump_device(const struct device *dev, const char *text,
        FILE *stream);
 int pb_protocol_device_len(const struct device *dev);
 void pb_protocol_dump_device(const struct device *dev, const char *text,
        FILE *stream);
 int pb_protocol_device_len(const struct device *dev);
diff --git a/lib/types/types.h b/lib/types/types.h
new file mode 100644 (file)
index 0000000..acd9e3e
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _TYPES_H
+#define _TYPES_H
+
+#include <list/list.h>
+
+struct device {
+       char            *id;
+       char            *name;
+       char            *description;
+       char            *icon_file;
+
+       int             n_options;
+       struct list     boot_options;
+
+       void            *ui_info;
+};
+
+struct boot_option {
+       char            *id;
+       char            *name;
+       char            *description;
+       char            *icon_file;
+       char            *boot_image_file;
+       char            *initrd_file;
+       char            *boot_args;
+
+       struct list_item        list;
+
+       void            *ui_info;
+};
+
+#endif /* _TYPES_H */
index 90b3e3b8e8693a9960b3ef5ed6d13854a677f98f..75533e3a116dd41ba0355851d793baeb4dfc50af 100644 (file)
@@ -7,7 +7,7 @@
 #include <unistd.h>
 
 #include <log/log.h>
 #include <unistd.h>
 
 #include <log/log.h>
-#include "pb-protocol/pb-protocol.h"
+#include <types/types.h>
 #include <talloc/talloc.h>
 
 #include "discover/device-handler.h"
 #include <talloc/talloc.h>
 
 #include "discover/device-handler.h"
index f9f74e5c622b4aa51d9c07c4ce76545d8f547dc4..4af936c57cf498644e51e75052f3a6278395463b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _DISCOVER_CLIENT_H
 #define _DISCOVER_CLIENT_H
 
 #ifndef _DISCOVER_CLIENT_H
 #define _DISCOVER_CLIENT_H
 
-#include <pb-protocol/pb-protocol.h>
+#include <types/types.h>
 
 struct discover_client;
 
 
 struct discover_client;
 
index 63d1a92d2374166cfb51ffbfa64f5a487adb3869..b75c4d1bfecbe45ff766354a912af37714479305 100644 (file)
 #if !defined(_PB_UI_SYSTEM_H)
 #define _PB_UI_SYSTEM_H
 
 #if !defined(_PB_UI_SYSTEM_H)
 #define _PB_UI_SYSTEM_H
 
-#include "pb-protocol/pb-protocol.h"
+#include <stdint.h>
+
 #include "system/system.h"
 #include "system/system.h"
+#include "types/types.h"
 #include "ui/common/timer.h"
 
 #include <signal.h>
 #include "ui/common/timer.h"
 
 #include <signal.h>
index 62fddd66f52cc2d5e4ace20e7086578b152039aa..2f2792d53f3ad99407fa48502fa67a8c579576ee 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/input.h> /* This must be included before ncurses.h */
 #include <form.h>
 
 #include <linux/input.h> /* This must be included before ncurses.h */
 #include <form.h>
 
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "ui/common/ui-system.h"
 #include "nc-scr.h"
 
 #include "ui/common/ui-system.h"
 #include "nc-scr.h"
 
index 4abec6fffe258cb8d1306a83e23127654e8d38d0..750bef5c898ef77c5c74594972d986c7252b710f 100644 (file)
@@ -24,7 +24,7 @@
 #include <menu.h>
 
 #include "log/log.h"
 #include <menu.h>
 
 #include "log/log.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 #include "nc-scr.h"
 
 struct pmenu;
 #include "nc-scr.h"
 
 struct pmenu;
index ed12e5a993a7d381550d4eac54e70f13d3f8263b..6a4d86308e9fc6910d06b2868c1c8ac522da683c 100644 (file)
@@ -23,6 +23,8 @@
 #include <assert.h>
 #include <string.h>
 
 #include <assert.h>
 #include <string.h>
 
+#include <pb-protocol/pb-protocol.h>
+
 #include "pbt-client.h"
 
 #include "log/log.h"
 #include "pbt-client.h"
 
 #include "log/log.h"
index 7547f16a3c08800a5e0ebed822a97320f6c3500f..cb696eaa98b7bcce64dfef3b5a7c10d20afb5f19 100644 (file)
@@ -19,7 +19,7 @@
 #define _PBT_MENU_H
 
 #include "list/list.h"
 #define _PBT_MENU_H
 
 #include "list/list.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
 
 #include "pbt-scr.h"
 
 
 #include "pbt-scr.h"