diff mbox

posix-aio-compat: Expand tabs that have crept in

Message ID 1274961128-3358-1-git-send-email-stefanha@linux.vnet.ibm.com
State New
Headers show

Commit Message

Stefan Hajnoczi May 27, 2010, 11:52 a.m. UTC
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(-)

Comments

Kevin Wolf May 27, 2010, 12:50 p.m. UTC | #1
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
Stefan Hajnoczi May 27, 2010, 1:12 p.m. UTC | #2
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
Kevin Wolf May 27, 2010, 1:46 p.m. UTC | #3
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
Stefan Hajnoczi May 27, 2010, 2:12 p.m. UTC | #4
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
diff mbox

Patch

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;