qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in
@ 2010-05-27 11:52 Stefan Hajnoczi
  2010-05-27 12:50 ` Kevin Wolf
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2010-05-27 11:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

This patch expands tabs on a few lines so the code formats nicely and
follows the QEMU coding style.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 posix-aio-compat.c |   58 ++++++++++++++++++++++++++--------------------------
 1 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index b43c531..a67ffe3 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -35,7 +35,7 @@ struct qemu_paiocb {
     int aio_fildes;
     union {
         struct iovec *aio_iov;
-	void *aio_ioctl_buf;
+        void *aio_ioctl_buf;
     };
     int aio_niov;
     size_t aio_nbytes;
@@ -119,21 +119,21 @@ static void thread_create(pthread_t *thread, pthread_attr_t *attr,
 
 static ssize_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
 {
-	int ret;
-
-	ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);
-	if (ret == -1)
-		return -errno;
-
-	/*
-	 * This looks weird, but the aio code only consideres a request
-	 * successfull if it has written the number full number of bytes.
-	 *
-	 * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,
-	 * so in fact we return the ioctl command here to make posix_aio_read()
-	 * happy..
-	 */
-	return aiocb->aio_nbytes;
+    int ret;
+
+    ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);
+    if (ret == -1)
+        return -errno;
+
+    /*
+     * This looks weird, but the aio code only consideres a request
+     * successfull if it has written the number full number of bytes.
+     *
+     * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,
+     * so in fact we return the ioctl command here to make posix_aio_read()
+     * happy..
+     */
+    return aiocb->aio_nbytes;
 }
 
 static ssize_t handle_aiocb_flush(struct qemu_paiocb *aiocb)
@@ -249,10 +249,10 @@ static ssize_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
          * Try preadv/pwritev first and fall back to linearizing the
          * buffer if it's not supported.
          */
-	if (preadv_present) {
+        if (preadv_present) {
             nbytes = handle_aiocb_rw_vector(aiocb);
             if (nbytes == aiocb->aio_nbytes)
-	        return nbytes;
+                return nbytes;
             if (nbytes < 0 && nbytes != -ENOSYS)
                 return nbytes;
             preadv_present = 0;
@@ -335,19 +335,19 @@ static void *aio_thread(void *unused)
         switch (aiocb->aio_type & QEMU_AIO_TYPE_MASK) {
         case QEMU_AIO_READ:
         case QEMU_AIO_WRITE:
-		ret = handle_aiocb_rw(aiocb);
-		break;
+            ret = handle_aiocb_rw(aiocb);
+            break;
         case QEMU_AIO_FLUSH:
-                ret = handle_aiocb_flush(aiocb);
-                break;
+            ret = handle_aiocb_flush(aiocb);
+            break;
         case QEMU_AIO_IOCTL:
-		ret = handle_aiocb_ioctl(aiocb);
-		break;
-	default:
-		fprintf(stderr, "invalid aio request (0x%x)\n", aiocb->aio_type);
-		ret = -EINVAL;
-		break;
-	}
+            ret = handle_aiocb_ioctl(aiocb);
+            break;
+        default:
+            fprintf(stderr, "invalid aio request (0x%x)\n", aiocb->aio_type);
+            ret = -EINVAL;
+            break;
+        }
 
         mutex_lock(&lock);
         aiocb->ret = ret;
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in
  2010-05-27 11:52 [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in Stefan Hajnoczi
@ 2010-05-27 12:50 ` Kevin Wolf
  2010-05-27 13:12   ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2010-05-27 12:50 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Am 27.05.2010 13:52, schrieb Stefan Hajnoczi:
> This patch expands tabs on a few lines so the code formats nicely and
> follows the QEMU coding style.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Thanks, applied to the block branch.

I'm usually not a big supporter of patches that only change style, but
tabs are nasty and you can ignore these whitespace changes in git blame
at least, so for all I care let's take it for once.

Kevin

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

* Re: [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in
  2010-05-27 12:50 ` Kevin Wolf
@ 2010-05-27 13:12   ` Stefan Hajnoczi
  2010-05-27 13:46     ` Kevin Wolf
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2010-05-27 13:12 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On Thu, May 27, 2010 at 02:50:54PM +0200, Kevin Wolf wrote:
> I'm usually not a big supporter of patches that only change style, but
> tabs are nasty and you can ignore these whitespace changes in git blame
> at least, so for all I care let's take it for once.

Interesting, I tend to prefer separate code change and whitespace change
patches.  It's hard to review a patch that combines code and whitespace
changes because you have to manually compare the touched lines to see
what, if anything, has changed.

Is this the policy across all of QEMU or your preference for
block-related code?  I'll try to follow it for that area in the future.

Thanks,
Stefan

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

* Re: [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in
  2010-05-27 13:12   ` Stefan Hajnoczi
@ 2010-05-27 13:46     ` Kevin Wolf
  2010-05-27 14:12       ` Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wolf @ 2010-05-27 13:46 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Am 27.05.2010 15:12, schrieb Stefan Hajnoczi:
> On Thu, May 27, 2010 at 02:50:54PM +0200, Kevin Wolf wrote:
>> I'm usually not a big supporter of patches that only change style, but
>> tabs are nasty and you can ignore these whitespace changes in git blame
>> at least, so for all I care let's take it for once.
> 
> Interesting, I tend to prefer separate code change and whitespace change
> patches.  It's hard to review a patch that combines code and whitespace
> changes because you have to manually compare the touched lines to see
> what, if anything, has changed.

That's not what I mean either. I usually avoid any style fixes in code
that I don't touch otherwise. So when I need to fix an if condition
anyway, I can add missing braces there as well, but I wouldn't write a
patch that adds braces everywhere.

The main reason is that it would break git blame output by listing some
completely unrelated style fixes instead of the patch that really added
or semantically changed the line. Whitespace changes are not quite as
bad, though, as there is git blame -w.

> Is this the policy across all of QEMU or your preference for
> block-related code?  I'll try to follow it for that area in the future.

I don't think it's written down explicitly, but I remember some
discussion about style fixes which basically resulted in "do new code
right, leave old code alone".

Kevin

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

* Re: [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in
  2010-05-27 13:46     ` Kevin Wolf
@ 2010-05-27 14:12       ` Stefan Hajnoczi
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2010-05-27 14:12 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Stefan Hajnoczi, qemu-devel

On Thu, May 27, 2010 at 2:46 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> I don't think it's written down explicitly, but I remember some
> discussion about style fixes which basically resulted in "do new code
> right, leave old code alone".

Okay, fair enough.

Stefan

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

end of thread, other threads:[~2010-05-27 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 11:52 [Qemu-devel] [PATCH] posix-aio-compat: Expand tabs that have crept in Stefan Hajnoczi
2010-05-27 12:50 ` Kevin Wolf
2010-05-27 13:12   ` Stefan Hajnoczi
2010-05-27 13:46     ` Kevin Wolf
2010-05-27 14:12       ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).