diff options
author | David 'Digit' Turner <digit@android.com> | 2011-02-02 21:39:10 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@android.com> | 2011-02-02 22:01:44 +0100 |
commit | b6c168bbb6477145e843bb4a2e56e72e6d47822d (patch) | |
tree | f74ead6211540d266ce0dd5c468a6f24b8f4aee3 /android/protocol/ui-commands-impl.c | |
parent | d6eda1d7b357746ad8d9a4c80dc0235ef56c40e0 (diff) | |
download | external_qemu-b6c168bbb6477145e843bb4a2e56e72e6d47822d.zip external_qemu-b6c168bbb6477145e843bb4a2e56e72e6d47822d.tar.gz external_qemu-b6c168bbb6477145e843bb4a2e56e72e6d47822d.tar.bz2 |
Remove QEMU-ism from UI code.
This gets rid of qemu_set_fd_handler() users in the UI
program. We can remove its implementation from vl-android-ui.c
+ Really remove qemu-timer-ui.c :-)
Change-Id: I490df8ad5d5eea36b332bf54e2b156f6b5872bf4
Diffstat (limited to 'android/protocol/ui-commands-impl.c')
-rw-r--r-- | android/protocol/ui-commands-impl.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/android/protocol/ui-commands-impl.c b/android/protocol/ui-commands-impl.c index 2ca4194..f07a1ad 100644 --- a/android/protocol/ui-commands-impl.c +++ b/android/protocol/ui-commands-impl.c @@ -16,7 +16,7 @@ * from the Core. */ -#include "console.h" +#include <unistd.h> #include "android/looper.h" #include "android/async-utils.h" #include "android/sync-utils.h" @@ -44,6 +44,9 @@ typedef struct UICmdImpl { /* Socket descriptor for the UI service. */ int sock; + /* Custom i/o handler */ + LoopIo io[1]; + /* Command reader state. */ UICmdImplState reader_state; @@ -113,7 +116,7 @@ _uiCmdImpl_handle_command(UICmdImpl* uicmd, * opaque - UICmdImpl instance. */ static void -_uiCmdImpl_io_read(void* opaque) +_uiCmdImpl_io_callback(void* opaque, int fd, unsigned events) { UICmdImpl* uicmd = opaque; int status; @@ -181,7 +184,7 @@ _uiCmdImpl_io_read(void* opaque) } int -uiCmdImpl_create(SockAddress* console_socket) +uiCmdImpl_create(SockAddress* console_socket, Looper* looper) { char* handshake = NULL; @@ -203,16 +206,10 @@ uiCmdImpl_create(SockAddress* console_socket) // Initialize UI command reader. _uiCmdImpl.sock = core_connection_get_socket(_uiCmdImpl.core_connection); - if (qemu_set_fd_handler(_uiCmdImpl.sock, _uiCmdImpl_io_read, NULL, - &_uiCmdImpl)) { - derror("Unable to set up UI _uiCmdImpl_io_read callback: %s\n", - errno_str); - uiCmdImpl_destroy(); - if (handshake != NULL) { - free(handshake); - } - return -1; - } + loopIo_init(_uiCmdImpl.io, looper, _uiCmdImpl.sock, + _uiCmdImpl_io_callback, + &_uiCmdImpl); + loopIo_wantRead(_uiCmdImpl.io); fprintf(stdout, "core-ui-control is now connected to the core at %s.", sock_address_to_string(console_socket)); @@ -232,7 +229,7 @@ uiCmdImpl_destroy(void) { if (_uiCmdImpl.core_connection != NULL) { // Disable I/O callbacks. - qemu_set_fd_handler(_uiCmdImpl.sock, NULL, NULL, NULL); + loopIo_done(_uiCmdImpl.io); core_connection_close(_uiCmdImpl.core_connection); core_connection_free(_uiCmdImpl.core_connection); _uiCmdImpl.core_connection = NULL; |