From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGdM0-0001Vk-AT for qemu-devel@nongnu.org; Tue, 25 Sep 2012 18:11:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TGdLz-0006vk-7K for qemu-devel@nongnu.org; Tue, 25 Sep 2012 18:11:44 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:55421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TGdLz-0006vf-0d for qemu-devel@nongnu.org; Tue, 25 Sep 2012 18:11:43 -0400 Received: by obbta14 with SMTP id ta14so6702775obb.4 for ; Tue, 25 Sep 2012 15:11:42 -0700 (PDT) From: Anthony Liguori In-Reply-To: <1348577763-12920-17-git-send-email-pbonzini@redhat.com> References: <1348577763-12920-1-git-send-email-pbonzini@redhat.com> <1348577763-12920-17-git-send-email-pbonzini@redhat.com> Date: Tue, 25 Sep 2012 17:11:38 -0500 Message-ID: <87a9wdn46d.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 16/17] aio: clean up now-unused functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Paolo Bonzini writes: > Some cleanups can now be made, now that the main loop does not anymore need > hooks into the bottom half code. > > Signed-off-by: Paolo Bonzini Reviewed-by: Anthony Liguori Regards, Anthony Liguori > --- > async.c | 23 +++++++---------------- > oslib-posix.c | 31 ------------------------------- > qemu-aio.h | 1 - > qemu-common.h | 1 - > 4 file modificati, 7 inserzioni(+), 49 rimozioni(-) > > diff --git a/async.c b/async.c > index 31c6c76..5a96d11 100644 > --- a/async.c > +++ b/async.c > @@ -117,16 +117,20 @@ void qemu_bh_delete(QEMUBH *bh) > bh->deleted = 1; > } > > -void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout) > +static gboolean > +aio_ctx_prepare(GSource *source, gint *timeout) > { > + AioContext *ctx = (AioContext *) source; > QEMUBH *bh; > + bool scheduled = false; > > for (bh = ctx->first_bh; bh; bh = bh->next) { > if (!bh->deleted && bh->scheduled) { > + scheduled = true; > if (bh->idle) { > /* idle bottom halves will be polled at least > * every 10ms */ > - *timeout = MIN(10, *timeout); > + *timeout = 10; > } else { > /* non-idle bottom halves will be executed > * immediately */ > @@ -135,21 +139,8 @@ void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout) > } > } > } > -} > - > -static gboolean > -aio_ctx_prepare(GSource *source, gint *timeout) > -{ > - AioContext *ctx = (AioContext *) source; > - uint32_t wait = -1; > - aio_bh_update_timeout(ctx, &wait); > - > - if (wait != -1) { > - *timeout = MIN(*timeout, wait); > - return wait == 0; > - } > > - return FALSE; > + return scheduled; > } > > static gboolean > diff --git a/oslib-posix.c b/oslib-posix.c > index dbeb627..9db9c3d 100644 > --- a/oslib-posix.c > +++ b/oslib-posix.c > @@ -61,9 +61,6 @@ static int running_on_valgrind = -1; > #ifdef CONFIG_LINUX > #include > #endif > -#ifdef CONFIG_EVENTFD > -#include > -#endif > > int qemu_get_thread_id(void) > { > @@ -183,34 +180,6 @@ int qemu_pipe(int pipefd[2]) > return ret; > } > > -/* > - * Creates an eventfd that looks like a pipe and has EFD_CLOEXEC set. > - */ > -int qemu_eventfd(int fds[2]) > -{ > -#ifdef CONFIG_EVENTFD > - int ret; > - > - ret = eventfd(0, 0); > - if (ret >= 0) { > - fds[0] = ret; > - fds[1] = dup(ret); > - if (fds[1] == -1) { > - close(ret); > - return -1; > - } > - qemu_set_cloexec(ret); > - qemu_set_cloexec(fds[1]); > - return 0; > - } > - if (errno != ENOSYS) { > - return -1; > - } > -#endif > - > - return qemu_pipe(fds); > -} > - > int qemu_utimens(const char *path, const struct timespec *times) > { > struct timeval tv[2], tv_now; > diff --git a/qemu-aio.h b/qemu-aio.h > index 2354617..1b7eb6e 100644 > --- a/qemu-aio.h > +++ b/qemu-aio.h > @@ -125,7 +125,6 @@ void aio_notify(AioContext *ctx); > * These are internal functions used by the QEMU main loop. > */ > int aio_bh_poll(AioContext *ctx); > -void aio_bh_update_timeout(AioContext *ctx, uint32_t *timeout); > > /** > * qemu_bh_schedule: Schedule a bottom half. > diff --git a/qemu-common.h b/qemu-common.h > index ac44657..1ea6ea3 100644 > --- a/qemu-common.h > +++ b/qemu-common.h > @@ -219,7 +219,6 @@ ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) > QEMU_WARN_UNUSED_RESULT; > > #ifndef _WIN32 > -int qemu_eventfd(int pipefd[2]); > int qemu_pipe(int pipefd[2]); > #endif > > -- > 1.7.12