Split dbus related code into separate file
Moved dbus related code into separate file. This can be used to disable
dbus interface if required.
Change-Id: I880639983edaf00c64acc4acb786203c51b414e7
Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>
diff --git a/console-server.h b/console-server.h
index f42b3ad..9418e23 100644
--- a/console-server.h
+++ b/console-server.h
@@ -79,6 +79,45 @@
typedef enum poller_ret (*poller_timeout_fn_t)(struct handler *handler,
void *data);
+/* Console server structure */
+struct console {
+ const char *tty_kname;
+ char *tty_sysfs_devnode;
+ char *tty_dev;
+ const char *console_id;
+ int tty_sirq;
+ uint16_t tty_lpc_addr;
+ speed_t tty_baud;
+ int tty_fd;
+
+ struct ringbuffer *rb;
+
+ struct handler **handlers;
+ long n_handlers;
+
+ struct poller **pollers;
+ long n_pollers;
+
+ struct pollfd *pollfds;
+ struct sd_bus *bus;
+};
+
+/* poller API */
+struct poller {
+ struct handler *handler;
+ void *data;
+ poller_event_fn_t event_fn;
+ poller_timeout_fn_t timeout_fn;
+ struct timeval timeout;
+ bool remove;
+};
+/* we have two extra entry in the pollfds array for the VUART tty */
+enum internal_pollfds {
+ POLLFD_HOSTTTY = 0,
+ POLLFD_DBUS = 1,
+ MAX_INTERNAL_POLLFD = 2,
+};
+
struct poller *console_poller_register(struct console *console,
struct handler *handler,
poller_event_fn_t poller_fn,
@@ -143,6 +182,9 @@
console_ringbuffer_consumer_register(struct console *console,
ringbuffer_poll_fn_t poll_fn, void *data);
+/* Console server API */
+void tty_init_termios(struct console *console);
+
/* config API */
struct config;
const char *config_get_value(struct config *config, const char *name);
@@ -164,6 +206,10 @@
/* utils */
int write_buf_to_fd(int fd, const uint8_t *buf, size_t len);
+/* console-dbus API */
+void dbus_init(struct console *console,
+ struct config *config __attribute__((unused)));
+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#ifndef offsetof