summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-04-10 12:19:13 +1000
committerGeoff Levand <geoff@infradead.org>2013-04-10 10:49:01 -0700
commitee86a0bd989511319adf3467b41b5b2e1f486aa6 (patch)
tree43ecd9479052388dc6bd3dae697fc2a9f6962d42
parent6b2d8ff75f1b9554d01dc6872b4498d660827e58 (diff)
downloadpetitboot-ee86a0bd989511319adf3467b41b5b2e1f486aa6.zip
petitboot-ee86a0bd989511319adf3467b41b5b2e1f486aa6.tar.gz
lib/types: Create common file for type definitions
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>
-rw-r--r--discover/device-handler.c2
-rw-r--r--discover/grub2-parser.c2
-rw-r--r--discover/kboot-parser.c2
-rw-r--r--discover/parser-utils.c2
-rw-r--r--discover/parser-utils.h2
-rw-r--r--discover/parser.c2
-rw-r--r--discover/yaboot-parser.c2
-rw-r--r--lib/Makefile.am1
-rw-r--r--lib/pb-protocol/pb-protocol.h27
-rw-r--r--lib/types/types.h32
-rw-r--r--test/parser/parser-test.c2
-rw-r--r--ui/common/discover-client.h2
-rw-r--r--ui/common/ui-system.h4
-rw-r--r--ui/ncurses/nc-ked.h2
-rw-r--r--ui/ncurses/nc-menu.h2
-rw-r--r--ui/twin/pbt-client.c2
-rw-r--r--ui/twin/pbt-menu.h2
17 files changed, 51 insertions, 39 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index bda724c..0d43496 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -10,7 +10,7 @@
#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"
diff --git a/discover/grub2-parser.c b/discover/grub2-parser.c
index f6cbccb..df1b755 100644
--- a/discover/grub2-parser.c
+++ b/discover/grub2-parser.c
@@ -27,7 +27,7 @@
#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"
diff --git a/discover/kboot-parser.c b/discover/kboot-parser.c
index 29324cb..2954d89 100644
--- a/discover/kboot-parser.c
+++ b/discover/kboot-parser.c
@@ -6,7 +6,7 @@
#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"
diff --git a/discover/parser-utils.c b/discover/parser-utils.c
index 47e30d8..5792f0a 100644
--- a/discover/parser-utils.c
+++ b/discover/parser-utils.c
@@ -4,7 +4,7 @@
#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"
diff --git a/discover/parser-utils.h b/discover/parser-utils.h
index fe28b7b..107f4f3 100644
--- a/discover/parser-utils.h
+++ b/discover/parser-utils.h
@@ -1,7 +1,7 @@
#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)))
diff --git a/discover/parser.c b/discover/parser.c
index beaaccc..d0b0477 100644
--- a/discover/parser.c
+++ b/discover/parser.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
#include <log/log.h>
#include "device-handler.h"
diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c
index 4306492..59e52b8 100644
--- a/discover/yaboot-parser.c
+++ b/discover/yaboot-parser.c
@@ -6,7 +6,7 @@
#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"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 6440fe4..7847d09 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -28,6 +28,7 @@ libpbcore_la_SOURCES = \
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 \
diff --git a/lib/pb-protocol/pb-protocol.h b/lib/pb-protocol/pb-protocol.h
index bfa9222..07ef7e1 100644
--- a/lib/pb-protocol/pb-protocol.h
+++ b/lib/pb-protocol/pb-protocol.h
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <list/list.h>
+#include <types/types.h>
#define PB_SOCKET_PATH "/tmp/petitboot.ui"
@@ -21,32 +22,6 @@ struct pb_protocol_message {
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);
diff --git a/lib/types/types.h b/lib/types/types.h
new file mode 100644
index 0000000..acd9e3e
--- /dev/null
+++ b/lib/types/types.h
@@ -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 */
diff --git a/test/parser/parser-test.c b/test/parser/parser-test.c
index 90b3e3b..75533e3 100644
--- a/test/parser/parser-test.c
+++ b/test/parser/parser-test.c
@@ -7,7 +7,7 @@
#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"
diff --git a/ui/common/discover-client.h b/ui/common/discover-client.h
index f9f74e5..4af936c 100644
--- a/ui/common/discover-client.h
+++ b/ui/common/discover-client.h
@@ -1,7 +1,7 @@
#ifndef _DISCOVER_CLIENT_H
#define _DISCOVER_CLIENT_H
-#include <pb-protocol/pb-protocol.h>
+#include <types/types.h>
struct discover_client;
diff --git a/ui/common/ui-system.h b/ui/common/ui-system.h
index 63d1a92..b75c4d1 100644
--- a/ui/common/ui-system.h
+++ b/ui/common/ui-system.h
@@ -19,8 +19,10 @@
#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 "types/types.h"
#include "ui/common/timer.h"
#include <signal.h>
diff --git a/ui/ncurses/nc-ked.h b/ui/ncurses/nc-ked.h
index 62fddd6..2f2792d 100644
--- a/ui/ncurses/nc-ked.h
+++ b/ui/ncurses/nc-ked.h
@@ -23,7 +23,7 @@
#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"
diff --git a/ui/ncurses/nc-menu.h b/ui/ncurses/nc-menu.h
index 4abec6f..750bef5 100644
--- a/ui/ncurses/nc-menu.h
+++ b/ui/ncurses/nc-menu.h
@@ -24,7 +24,7 @@
#include <menu.h>
#include "log/log.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
#include "nc-scr.h"
struct pmenu;
diff --git a/ui/twin/pbt-client.c b/ui/twin/pbt-client.c
index ed12e5a..6a4d863 100644
--- a/ui/twin/pbt-client.c
+++ b/ui/twin/pbt-client.c
@@ -23,6 +23,8 @@
#include <assert.h>
#include <string.h>
+#include <pb-protocol/pb-protocol.h>
+
#include "pbt-client.h"
#include "log/log.h"
diff --git a/ui/twin/pbt-menu.h b/ui/twin/pbt-menu.h
index 7547f16..cb696ea 100644
--- a/ui/twin/pbt-menu.h
+++ b/ui/twin/pbt-menu.h
@@ -19,7 +19,7 @@
#define _PBT_MENU_H
#include "list/list.h"
-#include "pb-protocol/pb-protocol.h"
+#include "types/types.h"
#include "pbt-scr.h"
OpenPOWER on IntegriCloud