[PATCH v4] block: replace TABs with space

Thomas Huth posted 1 patch 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251007163511.334178-1-thuth@redhat.com
Maintainers: Stefan Hajnoczi <stefanha@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Stefan Weil <sw@weilnetz.de>, Eric Blake <eblake@redhat.com>, Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
include/block/nbd.h |  2 +-
block/bochs.c       | 14 +++++++-------
block/file-posix.c  |  6 +++---
block/file-win32.c  | 18 +++++++++---------
block/qcow.c        | 10 +++++-----
5 files changed, 25 insertions(+), 25 deletions(-)
[PATCH v4] block: replace TABs with space
Posted by Thomas Huth 1 month, 1 week ago
From: Yeqi Fu <fufuyqqqqqq@gmail.com>

Bring the block files in line with the QEMU coding style, with spaces
for indentation. This patch partially resolves the issue 371.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371
Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
Message-ID: <20230325085224.23842-1-fufuyqqqqqq@gmail.com>
[thuth: Rebased the patch to the current master branch]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 I came accross this old patch today - it fell through the cracks
 in 2023, but I think it's still worth to get the coding style
 finally fixed in these files.

 include/block/nbd.h |  2 +-
 block/bochs.c       | 14 +++++++-------
 block/file-posix.c  |  6 +++---
 block/file-win32.c  | 18 +++++++++---------
 block/qcow.c        | 10 +++++-----
 5 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/include/block/nbd.h b/include/block/nbd.h
index 92987c76fd6..ab40842da9a 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -296,7 +296,7 @@ enum {
     NBD_CMD_BLOCK_STATUS = 7,
 };
 
-#define NBD_DEFAULT_PORT	10809
+#define NBD_DEFAULT_PORT 10809
 
 /* Maximum size of a single READ/WRITE data buffer */
 #define NBD_MAX_BUFFER_SIZE (32 * 1024 * 1024)
diff --git a/block/bochs.c b/block/bochs.c
index b099fb52fe8..bfda88017d9 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -300,15 +300,15 @@ static void bochs_close(BlockDriverState *bs)
 }
 
 static BlockDriver bdrv_bochs = {
-    .format_name	= "bochs",
-    .instance_size	= sizeof(BDRVBochsState),
-    .bdrv_probe		= bochs_probe,
-    .bdrv_open		= bochs_open,
+    .format_name         = "bochs",
+    .instance_size       = sizeof(BDRVBochsState),
+    .bdrv_probe          = bochs_probe,
+    .bdrv_open           = bochs_open,
     .bdrv_child_perm     = bdrv_default_perms,
     .bdrv_refresh_limits = bochs_refresh_limits,
-    .bdrv_co_preadv = bochs_co_preadv,
-    .bdrv_close		= bochs_close,
-    .is_format          = true,
+    .bdrv_co_preadv      = bochs_co_preadv,
+    .bdrv_close          = bochs_close,
+    .is_format           = true,
 };
 
 static void bdrv_bochs_init(void)
diff --git a/block/file-posix.c b/block/file-posix.c
index 8c738674ced..8be4404c78c 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -133,7 +133,7 @@
 #define FTYPE_FILE   0
 #define FTYPE_CD     1
 
-#define MAX_BLOCKSIZE	4096
+#define MAX_BLOCKSIZE 4096
 
 /* Posix file locking bytes. Libvirt takes byte 0, we start from higher bytes,
  * leaving a few more bytes for its future use. */
@@ -4578,7 +4578,7 @@ static BlockDriver bdrv_host_cdrom = {
     .protocol_name      = "host_cdrom",
     .instance_size      = sizeof(BDRVRawState),
     .bdrv_needs_filename = true,
-    .bdrv_probe_device	= cdrom_probe_device,
+    .bdrv_probe_device = cdrom_probe_device,
     .bdrv_parse_filename = cdrom_parse_filename,
     .bdrv_open          = cdrom_open,
     .bdrv_close         = raw_close,
@@ -4704,7 +4704,7 @@ static BlockDriver bdrv_host_cdrom = {
     .protocol_name      = "host_cdrom",
     .instance_size      = sizeof(BDRVRawState),
     .bdrv_needs_filename = true,
-    .bdrv_probe_device	= cdrom_probe_device,
+    .bdrv_probe_device = cdrom_probe_device,
     .bdrv_parse_filename = cdrom_parse_filename,
     .bdrv_open          = cdrom_open,
     .bdrv_close         = raw_close,
diff --git a/block/file-win32.c b/block/file-win32.c
index af9aea631cb..16bcef88c68 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -741,9 +741,9 @@ static QemuOptsList raw_create_opts = {
 };
 
 BlockDriver bdrv_file = {
-    .format_name	= "file",
-    .protocol_name	= "file",
-    .instance_size	= sizeof(BDRVRawState),
+    .format_name = "file",
+    .protocol_name = "file",
+    .instance_size = sizeof(BDRVRawState),
     .bdrv_needs_filename = true,
     .bdrv_parse_filename = raw_parse_filename,
     .bdrv_open          = raw_open,
@@ -914,14 +914,14 @@ done:
 }
 
 static BlockDriver bdrv_host_device = {
-    .format_name	= "host_device",
-    .protocol_name	= "host_device",
-    .instance_size	= sizeof(BDRVRawState),
+    .format_name = "host_device",
+    .protocol_name = "host_device",
+    .instance_size = sizeof(BDRVRawState),
     .bdrv_needs_filename = true,
     .bdrv_parse_filename = hdev_parse_filename,
-    .bdrv_probe_device	= hdev_probe_device,
-    .bdrv_open     	= hdev_open,
-    .bdrv_close		= raw_close,
+    .bdrv_probe_device = hdev_probe_device,
+    .bdrv_open = hdev_open,
+    .bdrv_close = raw_close,
     .bdrv_refresh_limits = hdev_refresh_limits,
 
     .bdrv_aio_preadv    = raw_aio_preadv,
diff --git a/block/qcow.c b/block/qcow.c
index 8a3e7591a92..b442bfe8357 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -1184,11 +1184,11 @@ static const char *const qcow_strong_runtime_opts[] = {
 };
 
 static BlockDriver bdrv_qcow = {
-    .format_name	= "qcow",
-    .instance_size	= sizeof(BDRVQcowState),
-    .bdrv_probe		= qcow_probe,
-    .bdrv_open		= qcow_open,
-    .bdrv_close		= qcow_close,
+    .format_name            = "qcow",
+    .instance_size          = sizeof(BDRVQcowState),
+    .bdrv_probe             = qcow_probe,
+    .bdrv_open              = qcow_open,
+    .bdrv_close             = qcow_close,
     .bdrv_child_perm        = bdrv_default_perms,
     .bdrv_reopen_prepare    = qcow_reopen_prepare,
     .bdrv_co_create         = qcow_co_create,
-- 
2.51.0
Re: [PATCH v4] block: replace TABs with space
Posted by Kevin Wolf 1 week, 3 days ago
Am 07.10.2025 um 18:35 hat Thomas Huth geschrieben:
> From: Yeqi Fu <fufuyqqqqqq@gmail.com>
> 
> Bring the block files in line with the QEMU coding style, with spaces
> for indentation. This patch partially resolves the issue 371.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371
> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> Message-ID: <20230325085224.23842-1-fufuyqqqqqq@gmail.com>
> [thuth: Rebased the patch to the current master branch]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  I came accross this old patch today - it fell through the cracks
>  in 2023, but I think it's still worth to get the coding style
>  finally fixed in these files.

Thanks, applied to the block branch (after bringing back some of the
vertical alignment that v3 had).

Kevin
Re: [PATCH v4] block: replace TABs with space
Posted by Vladimir Sementsov-Ogievskiy 2 weeks ago
On 07.10.25 19:35, Thomas Huth wrote:
> From: Yeqi Fu <fufuyqqqqqq@gmail.com>
> 
> Bring the block files in line with the QEMU coding style, with spaces
> for indentation. This patch partially resolves the issue 371.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371
> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> Message-ID: <20230325085224.23842-1-fufuyqqqqqq@gmail.com>
> [thuth: Rebased the patch to the current master branch]
> Signed-off-by: Thomas Huth <thuth@redhat.com>

lost patch?

It still applies to master, and fixes all <TAB> invocations in block/, check:

git grep -P '\t' -- block

- gives no output.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>


-- 
Best regards,
Vladimir
Re: [PATCH v4] block: replace TABs with space
Posted by Thomas Huth 2 weeks, 1 day ago
On 07/10/2025 18.35, Thomas Huth wrote:
> From: Yeqi Fu <fufuyqqqqqq@gmail.com>
> 
> Bring the block files in line with the QEMU coding style, with spaces
> for indentation. This patch partially resolves the issue 371.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371
> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> Message-ID: <20230325085224.23842-1-fufuyqqqqqq@gmail.com>
> [thuth: Rebased the patch to the current master branch]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   I came accross this old patch today - it fell through the cracks
>   in 2023, but I think it's still worth to get the coding style
>   finally fixed in these files.

Ping!

Kevin, if you don't have any concerns, could you pick it up via your block 
tree, please?

  Thanks,
   Thomas



> 
> diff --git a/include/block/nbd.h b/include/block/nbd.h
> index 92987c76fd6..ab40842da9a 100644
> --- a/include/block/nbd.h
> +++ b/include/block/nbd.h
> @@ -296,7 +296,7 @@ enum {
>       NBD_CMD_BLOCK_STATUS = 7,
>   };
>   
> -#define NBD_DEFAULT_PORT	10809
> +#define NBD_DEFAULT_PORT 10809
>   
>   /* Maximum size of a single READ/WRITE data buffer */
>   #define NBD_MAX_BUFFER_SIZE (32 * 1024 * 1024)
> diff --git a/block/bochs.c b/block/bochs.c
> index b099fb52fe8..bfda88017d9 100644
> --- a/block/bochs.c
> +++ b/block/bochs.c
> @@ -300,15 +300,15 @@ static void bochs_close(BlockDriverState *bs)
>   }
>   
>   static BlockDriver bdrv_bochs = {
> -    .format_name	= "bochs",
> -    .instance_size	= sizeof(BDRVBochsState),
> -    .bdrv_probe		= bochs_probe,
> -    .bdrv_open		= bochs_open,
> +    .format_name         = "bochs",
> +    .instance_size       = sizeof(BDRVBochsState),
> +    .bdrv_probe          = bochs_probe,
> +    .bdrv_open           = bochs_open,
>       .bdrv_child_perm     = bdrv_default_perms,
>       .bdrv_refresh_limits = bochs_refresh_limits,
> -    .bdrv_co_preadv = bochs_co_preadv,
> -    .bdrv_close		= bochs_close,
> -    .is_format          = true,
> +    .bdrv_co_preadv      = bochs_co_preadv,
> +    .bdrv_close          = bochs_close,
> +    .is_format           = true,
>   };
>   
>   static void bdrv_bochs_init(void)
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 8c738674ced..8be4404c78c 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -133,7 +133,7 @@
>   #define FTYPE_FILE   0
>   #define FTYPE_CD     1
>   
> -#define MAX_BLOCKSIZE	4096
> +#define MAX_BLOCKSIZE 4096
>   
>   /* Posix file locking bytes. Libvirt takes byte 0, we start from higher bytes,
>    * leaving a few more bytes for its future use. */
> @@ -4578,7 +4578,7 @@ static BlockDriver bdrv_host_cdrom = {
>       .protocol_name      = "host_cdrom",
>       .instance_size      = sizeof(BDRVRawState),
>       .bdrv_needs_filename = true,
> -    .bdrv_probe_device	= cdrom_probe_device,
> +    .bdrv_probe_device = cdrom_probe_device,
>       .bdrv_parse_filename = cdrom_parse_filename,
>       .bdrv_open          = cdrom_open,
>       .bdrv_close         = raw_close,
> @@ -4704,7 +4704,7 @@ static BlockDriver bdrv_host_cdrom = {
>       .protocol_name      = "host_cdrom",
>       .instance_size      = sizeof(BDRVRawState),
>       .bdrv_needs_filename = true,
> -    .bdrv_probe_device	= cdrom_probe_device,
> +    .bdrv_probe_device = cdrom_probe_device,
>       .bdrv_parse_filename = cdrom_parse_filename,
>       .bdrv_open          = cdrom_open,
>       .bdrv_close         = raw_close,
> diff --git a/block/file-win32.c b/block/file-win32.c
> index af9aea631cb..16bcef88c68 100644
> --- a/block/file-win32.c
> +++ b/block/file-win32.c
> @@ -741,9 +741,9 @@ static QemuOptsList raw_create_opts = {
>   };
>   
>   BlockDriver bdrv_file = {
> -    .format_name	= "file",
> -    .protocol_name	= "file",
> -    .instance_size	= sizeof(BDRVRawState),
> +    .format_name = "file",
> +    .protocol_name = "file",
> +    .instance_size = sizeof(BDRVRawState),
>       .bdrv_needs_filename = true,
>       .bdrv_parse_filename = raw_parse_filename,
>       .bdrv_open          = raw_open,
> @@ -914,14 +914,14 @@ done:
>   }
>   
>   static BlockDriver bdrv_host_device = {
> -    .format_name	= "host_device",
> -    .protocol_name	= "host_device",
> -    .instance_size	= sizeof(BDRVRawState),
> +    .format_name = "host_device",
> +    .protocol_name = "host_device",
> +    .instance_size = sizeof(BDRVRawState),
>       .bdrv_needs_filename = true,
>       .bdrv_parse_filename = hdev_parse_filename,
> -    .bdrv_probe_device	= hdev_probe_device,
> -    .bdrv_open     	= hdev_open,
> -    .bdrv_close		= raw_close,
> +    .bdrv_probe_device = hdev_probe_device,
> +    .bdrv_open = hdev_open,
> +    .bdrv_close = raw_close,
>       .bdrv_refresh_limits = hdev_refresh_limits,
>   
>       .bdrv_aio_preadv    = raw_aio_preadv,
> diff --git a/block/qcow.c b/block/qcow.c
> index 8a3e7591a92..b442bfe8357 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
> @@ -1184,11 +1184,11 @@ static const char *const qcow_strong_runtime_opts[] = {
>   };
>   
>   static BlockDriver bdrv_qcow = {
> -    .format_name	= "qcow",
> -    .instance_size	= sizeof(BDRVQcowState),
> -    .bdrv_probe		= qcow_probe,
> -    .bdrv_open		= qcow_open,
> -    .bdrv_close		= qcow_close,
> +    .format_name            = "qcow",
> +    .instance_size          = sizeof(BDRVQcowState),
> +    .bdrv_probe             = qcow_probe,
> +    .bdrv_open              = qcow_open,
> +    .bdrv_close             = qcow_close,
>       .bdrv_child_perm        = bdrv_default_perms,
>       .bdrv_reopen_prepare    = qcow_reopen_prepare,
>       .bdrv_co_create         = qcow_co_create,
Re: [PATCH v4] block: replace TABs with space
Posted by Kevin Wolf 2 weeks, 1 day ago
Am 30.10.2025 um 13:51 hat Thomas Huth geschrieben:
> On 07/10/2025 18.35, Thomas Huth wrote:
> > From: Yeqi Fu <fufuyqqqqqq@gmail.com>
> > 
> > Bring the block files in line with the QEMU coding style, with spaces
> > for indentation. This patch partially resolves the issue 371.
> > 
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371
> > Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> > Message-ID: <20230325085224.23842-1-fufuyqqqqqq@gmail.com>
> > [thuth: Rebased the patch to the current master branch]
> > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > ---
> >   I came accross this old patch today - it fell through the cracks
> >   in 2023, but I think it's still worth to get the coding style
> >   finally fixed in these files.
> 
> Ping!
> 
> Kevin, if you don't have any concerns, could you pick it up via your block
> tree, please?

I think v3 was closer to what I had in mind, so I was planning to have a
closer look and merge some mix of them. Just didn't get to it yet.

Kevin
Re: [PATCH v4] block: replace TABs with space
Posted by Stefan Hajnoczi 1 month, 1 week ago
On Tue, Oct 07, 2025 at 06:35:11PM +0200, Thomas Huth wrote:
> From: Yeqi Fu <fufuyqqqqqq@gmail.com>
> 
> Bring the block files in line with the QEMU coding style, with spaces
> for indentation. This patch partially resolves the issue 371.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/371
> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> Message-ID: <20230325085224.23842-1-fufuyqqqqqq@gmail.com>
> [thuth: Rebased the patch to the current master branch]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  I came accross this old patch today - it fell through the cracks
>  in 2023, but I think it's still worth to get the coding style
>  finally fixed in these files.
> 
>  include/block/nbd.h |  2 +-
>  block/bochs.c       | 14 +++++++-------
>  block/file-posix.c  |  6 +++---
>  block/file-win32.c  | 18 +++++++++---------
>  block/qcow.c        | 10 +++++-----
>  5 files changed, 25 insertions(+), 25 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>