block: Minor cleanups
Subsystems (2)
cover block: Minor cleanups
I had to go through all block drivers and noticed some details that aren't as expected, so I thought I might as well fix them...
Kevin Wolf (2):
block/meson.build: Restore alphabetical order of files
block: Make more BlockDriver definitions static
block/copy-before-write.c | 2 +- block/preallocate.c | 2 +- block/snapshot-access.c | 2 +- block/meson.build | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/2 block/meson.build: Restore alphabetical order of files
When commit 5e5733e5999 created block/meson.build, the list of unconditionally added files was in alphabetical order. Later commits added new files in random places. Reorder the list to be alphabetical again. (As for ordering foo.c against foo-*.c, there are both ways used currently; standardise on having foo.c first, even though this is different from the original commit 5e5733e5999.)
--- block/meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
block/meson.build +6 -6
@@ -4,41 +4,41 @@ block_ss.add(files( 'aio_task.c', 'amend.c', 'backup.c', - 'copy-before-write.c', 'blkdebug.c', 'blklogwrites.c', 'blkverify.c', 'block-backend.c', 'block-copy.c', - 'graph-lock.c', 'commit.c', + 'copy-before-write.c', 'copy-on-read.c', - 'preallocate.c', - 'progress_meter.c', 'create.c', 'crypto.c', 'dirty-bitmap.c', 'filter-compress.c', + 'graph-lock.c', 'io.c', 'mirror.c', 'nbd.c', 'null.c', 'plug.c', + 'preallocate.c', + 'progress_meter.c', 'qapi.c', + 'qcow2.c', 'qcow2-bitmap.c', 'qcow2-cache.c', 'qcow2-cluster.c', 'qcow2-refcount.c', 'qcow2-snapshot.c', 'qcow2-threads.c', - 'qcow2.c', 'quorum.c', 'raw-format.c', 'reqlist.c', 'snapshot.c', 'snapshot-access.c', - 'throttle-groups.c', 'throttle.c', + 'throttle-groups.c', 'write-threshold.c', ), zstd, zlib, gnutls)
Signature · 1 line
2.41.0
Re: [PATCH 1/2] block/meson.build: Restore alphabetical order of files
Quoted 11 lines · Kevin Wolf
When commit
5e5733e5999createdblock/meson.build, the list of unconditionally added files was in alphabetical order. Later commits added new files in random places. Reorder the list to be alphabetical again. (As for orderingfoo.cagainst foo-*.c, there are both ways used currently; standardise on havingfoo.cfirst, even though this is different from the original commit5e5733e5999.)Signed-off-by Kevin Wolf <[email protected]>--- block/meson.build | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
PATCH 2/2 block: Make more BlockDriver definitions static
In reply to Kevin WolfMost block driver implementations don't have any reason for their BlockDriver to be public. The only exceptions are bdrv_file, bdrv_raw and bdrv_qcow2, which are actually used in other source files.
Make all other BlockDriver definitions static if they aren't yet.
--- block/copy-before-write.c | 2 +- block/preallocate.c | 2 +- block/snapshot-access.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
block/copy-before-write.c +1 -1
@@ -503,7 +503,7 @@ static void cbw_close(BlockDriverState *bs) s->bcs =NULL ; } -BlockDriver bdrv_cbw_filter = { +static BlockDriver bdrv_cbw_filter = { .format_name ="copy-before-write" , .instance_size =sizeof (BDRVCopyBeforeWriteState),
block/preallocate.c +1 -1
@@ -535,7 +535,7 @@ static void preallocate_child_perm(BlockDriverState *bs, BdrvChild *c, } } -BlockDriver bdrv_preallocate_filter = { +static BlockDriver bdrv_preallocate_filter = { .format_name ="preallocate" , .instance_size =sizeof (BDRVPreallocateState),
block/snapshot-access.c +1 -1
@@ -108,7 +108,7 @@ static void snapshot_access_child_perm(BlockDriverState *bs, BdrvChild *c, *nshared =BLK_PERM_ALL ; } -BlockDriver bdrv_snapshot_access_drv = { +static BlockDriver bdrv_snapshot_access_drv = { .format_name ="snapshot-access" , .bdrv_open = snapshot_access_open,
Signature · 1 line
2.41.0
Re: [PATCH 2/2] block: Make more BlockDriver definitions static
Quoted 4 lines · Kevin Wolf
Most block driver implementations don't have any reason for their BlockDriver to be public. The only exceptions are
bdrv_file,bdrv_rawandbdrv_qcow2, which are actually used in other source files.
Quoted 8 lines
Make all other BlockDriver definitions static if they aren't yet.
Signed-off-by Kevin Wolf <[email protected]>--- block/copy-before-write.c | 2 +- block/preallocate.c | 2 +- block/snapshot-access.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)