console-server: introduce `struct console_server`
Lift `struct console_server` from `struct console`
struct console_server will enable obmc-console to support multiple
consoles in a single obmc-console-server in the future.
Currently the 'struct console_server' only supports one active console.
Change-Id: Icb22fb46f217b174f3bccc0a03485549d82d1d6b
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/console-server.h b/console-server.h
index ac827c8..1b7c15c 100644
--- a/console-server.h
+++ b/console-server.h
@@ -97,8 +97,7 @@
TTY_DEVICE_PTY,
};
-/* Console server structure */
-struct console {
+struct console_server {
struct {
const char *kname;
char *dev;
@@ -115,6 +114,15 @@
} uart;
};
} tty;
+
+ struct console *active;
+};
+
+struct console {
+ // point back to the console server
+ // which we are a member of
+ struct console_server *server;
+
const char *console_id;
/* Socket name starts with null character hence we need length */
@@ -215,7 +223,7 @@
ringbuffer_poll_fn_t poll_fn, void *data);
/* Console server API */
-void tty_init_termios(struct console *console);
+void tty_init_termios(struct console_server *server);
/* socket paths */
ssize_t console_socket_path(socket_path_t path, const char *id);