All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] aio-posix: remove useless parameter
@ 2016-07-14 12:57 Cao jin
  2016-07-14 14:10 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Cao jin @ 2016-07-14 12:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Fam Zheng, Eric Blake

Parameter **errp of aio_context_setup() is useless, remove it
and clean up the related code.

Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Fam Zheng <famz@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 aio-posix.c         | 3 ++-
 aio-win32.c         | 2 +-
 async.c             | 8 ++------
 include/block/aio.h | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)

v3 changelog:
1. printf errno, and fix build failure on Windows (Stefan)


diff --git a/aio-posix.c b/aio-posix.c
index 6006122..0bb4144 100644
--- a/aio-posix.c
+++ b/aio-posix.c
@@ -485,12 +485,13 @@ bool aio_poll(AioContext *ctx, bool blocking)
     return progress;
 }
 
-void aio_context_setup(AioContext *ctx, Error **errp)
+void aio_context_setup(AioContext *ctx)
 {
 #ifdef CONFIG_EPOLL_CREATE1
     assert(!ctx->epollfd);
     ctx->epollfd = epoll_create1(EPOLL_CLOEXEC);
     if (ctx->epollfd == -1) {
+        fprintf(stderr, "Failed to create epoll instance: %d", errno);
         ctx->epoll_available = false;
     } else {
         ctx->epoll_available = true;
diff --git a/aio-win32.c b/aio-win32.c
index 6aaa32a..c8c249e 100644
--- a/aio-win32.c
+++ b/aio-win32.c
@@ -371,6 +371,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
     return progress;
 }
 
-void aio_context_setup(AioContext *ctx, Error **errp)
+void aio_context_setup(AioContext *ctx)
 {
 }
diff --git a/async.c b/async.c
index fb7dd92..8589017 100644
--- a/async.c
+++ b/async.c
@@ -327,14 +327,10 @@ AioContext *aio_context_new(Error **errp)
 {
     int ret;
     AioContext *ctx;
-    Error *local_err = NULL;
 
     ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext));
-    aio_context_setup(ctx, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        goto fail;
-    }
+    aio_context_setup(ctx);
+
     ret = event_notifier_init(&ctx->notifier, false);
     if (ret < 0) {
         error_setg_errno(errp, -ret, "Failed to initialize event notifier");
diff --git a/include/block/aio.h b/include/block/aio.h
index 88a64ee..0922b69 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -439,6 +439,6 @@ static inline bool aio_node_check(AioContext *ctx, bool is_external)
  *
  * Initialize the aio context.
  */
-void aio_context_setup(AioContext *ctx, Error **errp);
+void aio_context_setup(AioContext *ctx);
 
 #endif
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v3] aio-posix: remove useless parameter
  2016-07-14 12:57 [Qemu-devel] [PATCH v3] aio-posix: remove useless parameter Cao jin
@ 2016-07-14 14:10 ` Eric Blake
  2016-07-15  1:27   ` Cao jin
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2016-07-14 14:10 UTC (permalink / raw)
  To: Cao jin, qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Fam Zheng

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

On 07/14/2016 06:57 AM, Cao jin wrote:
> Parameter **errp of aio_context_setup() is useless, remove it
> and clean up the related code.
> 
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Cc: Fam Zheng <famz@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  aio-posix.c         | 3 ++-
>  aio-win32.c         | 2 +-
>  async.c             | 8 ++------
>  include/block/aio.h | 2 +-
>  4 files changed, 6 insertions(+), 9 deletions(-)
> 
> v3 changelog:
> 1. printf errno, and fix build failure on Windows (Stefan)
> 
> 
> diff --git a/aio-posix.c b/aio-posix.c
> index 6006122..0bb4144 100644
> --- a/aio-posix.c
> +++ b/aio-posix.c
> @@ -485,12 +485,13 @@ bool aio_poll(AioContext *ctx, bool blocking)
>      return progress;
>  }
>  
> -void aio_context_setup(AioContext *ctx, Error **errp)
> +void aio_context_setup(AioContext *ctx)
>  {
>  #ifdef CONFIG_EPOLL_CREATE1
>      assert(!ctx->epollfd);
>      ctx->epollfd = epoll_create1(EPOLL_CLOEXEC);
>      if (ctx->epollfd == -1) {
> +        fprintf(stderr, "Failed to create epoll instance: %d", errno);

Better is to use %s and strerror(errno), as a raw int isn't very meaningful.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v3] aio-posix: remove useless parameter
  2016-07-14 14:10 ` Eric Blake
@ 2016-07-15  1:27   ` Cao jin
  0 siblings, 0 replies; 3+ messages in thread
From: Cao jin @ 2016-07-15  1:27 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Fam Zheng



On 07/14/2016 10:10 PM, Eric Blake wrote:
> On 07/14/2016 06:57 AM, Cao jin wrote:
>> Parameter **errp of aio_context_setup() is useless, remove it
>> and clean up the related code.
>>
>> Cc: Stefan Hajnoczi <stefanha@redhat.com>
>> Cc: Fam Zheng <famz@redhat.com>
>> Cc: Eric Blake <eblake@redhat.com>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   aio-posix.c         | 3 ++-
>>   aio-win32.c         | 2 +-
>>   async.c             | 8 ++------
>>   include/block/aio.h | 2 +-
>>   4 files changed, 6 insertions(+), 9 deletions(-)
>>
>> v3 changelog:
>> 1. printf errno, and fix build failure on Windows (Stefan)
>>
>>
>> diff --git a/aio-posix.c b/aio-posix.c
>> index 6006122..0bb4144 100644
>> --- a/aio-posix.c
>> +++ b/aio-posix.c
>> @@ -485,12 +485,13 @@ bool aio_poll(AioContext *ctx, bool blocking)
>>       return progress;
>>   }
>>
>> -void aio_context_setup(AioContext *ctx, Error **errp)
>> +void aio_context_setup(AioContext *ctx)
>>   {
>>   #ifdef CONFIG_EPOLL_CREATE1
>>       assert(!ctx->epollfd);
>>       ctx->epollfd = epoll_create1(EPOLL_CLOEXEC);
>>       if (ctx->epollfd == -1) {
>> +        fprintf(stderr, "Failed to create epoll instance: %d", errno);
>
> Better is to use %s and strerror(errno), as a raw int isn't very meaningful.
>

strerror came to my mind first, I regret not using it:P

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-15  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 12:57 [Qemu-devel] [PATCH v3] aio-posix: remove useless parameter Cao jin
2016-07-14 14:10 ` Eric Blake
2016-07-15  1:27   ` Cao jin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.