qemu-e2k/block
Philippe Mathieu-Daudé 880a7817c1 misc: Replace zero-length arrays with flexible array member (manual)
Description copied from Linux kernel commit from Gustavo A. R. Silva
(see [3]):

--v-- description start --v--

  The current codebase makes use of the zero-length array language
  extension to the C90 standard, but the preferred mechanism to
  declare variable-length types such as these ones is a flexible
  array member [1], introduced in C99:

  struct foo {
      int stuff;
      struct boo array[];
  };

  By making use of the mechanism above, we will get a compiler
  warning in case the flexible array does not occur last in the
  structure, which will help us prevent some kind of undefined
  behavior bugs from being unadvertenly introduced [2] to the
  Linux codebase from now on.

--^-- description end --^--

Do the similar housekeeping in the QEMU codebase (which uses
C99 since commit 7be41675f7).

All these instances of code were found with the help of the
following command (then manual analysis, without modifying
structures only having a single flexible array member, such
QEDTable in block/qed.h):

  git grep -F '[0];'

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f
[3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=17642a2fbd2c1

Inspired-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-16 22:07:42 +01:00
..
monitor monitor/hmp: Move hmp_drive_add_node to block-hmp-cmds.c 2020-03-09 18:20:22 +00:00
Makefile.objs monitor/hmp: rename device-hotplug.c to block/monitor/block-hmp-cmds.c 2020-03-09 18:05:31 +00:00
accounting.c block: add empty account cookie type 2019-10-10 10:56:18 +02:00
aio_task.c block: introduce aio task pool 2019-10-10 10:56:17 +02:00
backup-top.c block/block-copy: hide structure definitions 2020-03-11 12:42:30 +01:00
backup-top.h block: introduce backup-top filter driver 2019-10-10 10:56:18 +02:00
backup.c block/block-copy: hide structure definitions 2020-03-11 12:42:30 +01:00
blkdebug.c blkdebug: Allow taking/unsharing permissions 2020-01-06 13:43:06 +01:00
blklogwrites.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
blkreplay.c block: implement bdrv_snapshot_goto for blkreplay 2019-10-14 17:12:48 +02:00
blkverify.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
block-backend.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
block-copy.c block/block-copy: hide structure definitions 2020-03-11 12:42:30 +01:00
bochs.c block: Use QEMU_IS_ALIGNED 2019-09-16 14:48:30 +02:00
cloop.c block: Use QEMU_IS_ALIGNED 2019-09-16 14:48:30 +02:00
commit.c commit: Fix is_read for block_job_error_action() 2020-02-18 10:53:56 +01:00
copy-on-read.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
create.c block/create: Do not abort if a block driver is not available 2019-09-13 12:18:37 +02:00
crypto.c Block layer patches: 2020-03-12 16:51:26 +00:00
crypto.h Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
curl.c block/curl: HTTP header field names are case insensitive 2020-03-11 12:42:29 +01:00
dirty-bitmap.c bitmap: Enforce maximum bitmap name length 2019-11-18 16:01:34 -06:00
dmg-bz2.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
dmg-lzfse.c block: adding lzfse decompressing support as a module. 2018-12-14 11:52:40 +01:00
dmg.c block: Use QEMU_IS_ALIGNED 2019-09-16 14:48:30 +02:00
dmg.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
file-posix.c block: introducing 'bdrv_co_delete_file' interface 2020-03-11 15:54:38 +01:00
file-win32.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
filter-compress.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
gluster.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
io.c block: fix crash on zero-length unaligned write and read 2020-02-07 16:46:59 +00:00
io_uring.c block/io_uring: Remove superfluous semicolon 2020-02-18 10:54:02 +01:00
iscsi-opts.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
iscsi.c iscsi: Drop iscsi_co_create_opts() 2020-02-20 16:43:42 +01:00
linux-aio.c misc: Replace zero-length arrays with flexible array member (automatic) 2020-03-16 22:07:42 +01:00
mirror.c mirror: Double-check immediately before replacing 2020-02-18 11:55:40 +01:00
nbd.c block/nbd: fix memory leak in nbd_open() 2020-02-26 17:29:00 -06:00
nfs.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
null.c replay: add BH oneshot event for block layer 2019-10-14 17:12:48 +02:00
nvme.c block/nvme: add support for discard 2019-10-28 11:34:35 +01:00
parallels.c Block patches for softfreeze: 2019-10-28 14:40:01 +00:00
parallels.h Clean up includes 2018-02-09 05:05:11 +01:00
qapi-sysemu.c block: Move system emulator QMP commands to block/qapi-sysemu.c 2020-03-06 17:15:38 +01:00
qapi.c block: Fix VM size field width in snapshot dump 2020-02-20 16:43:42 +01:00
qcow.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
qcow2-bitmap.c block/qcow2-bitmap: Remove unneeded variable assignment 2020-02-18 10:53:56 +01:00
qcow2-cache.c core: replace getpagesize() with qemu_real_host_page_size 2019-10-26 15:38:06 +02:00
qcow2-cluster.c qcow2: Fix alloc_cluster_abort() for pre-existing clusters 2020-03-06 17:15:37 +01:00
qcow2-refcount.c qcow2: update_refcount(): Reset old_table_index after qcow2_cache_put() 2020-02-18 10:53:56 +01:00
qcow2-snapshot.c qcow2: Don't round the L1 table allocation up to the sector size 2020-02-06 13:47:45 +01:00
qcow2-threads.c block/qcow2-threads: fix qcow2_decompress 2020-03-11 12:42:30 +01:00
qcow2.c block/qcow2: do free crypto_opts in qcow2_close() 2020-03-11 12:42:30 +01:00
qcow2.h qcow2: Fix QCOW2_COMPRESSED_SECTOR_MASK 2019-11-07 14:37:46 +01:00
qed-check.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed-cluster.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-l2-cache.c qed: protect table cache with CoMutex 2017-07-17 11:34:11 +08:00
qed-table.c block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
qed.c block: Pass truncate exact=true where reasonable 2019-10-28 12:08:45 +01:00
qed.h block/qed: add missed coroutine_fn markers 2019-04-30 15:29:00 +02:00
quorum.c quorum: Stop marking it as a filter 2020-02-18 11:55:40 +01:00
raw-format.c block: Let format drivers pass @exact 2019-10-28 12:05:30 +01:00
rbd.c block/rbd: Add support for ceph namespaces 2020-03-06 17:21:28 +01:00
replication.c block/replication.c: Ignore requests after failover 2020-03-03 18:04:47 +08:00
sheepdog.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
snapshot.c block/snapshot: rename Error ** parameter to more common errp 2019-12-18 08:43:19 +01:00
ssh.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
stream.c block/stream: Remove redundant statement in stream_run() 2020-03-09 15:59:31 +01:00
throttle-groups.c throttle-groups: fix memory leak in throttle_group_set_limit: 2020-01-06 13:43:06 +01:00
throttle.c block: Remove bdrv_recurse_is_first_non_filter() 2020-02-18 11:55:40 +01:00
trace-events block/block-copy: use block_status 2020-03-11 12:42:30 +01:00
vdi.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
vhdx-endian.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
vhdx-log.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
vhdx.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
vhdx.h block/vhdx: Use IEC binary prefixes for size constants 2019-04-30 15:29:00 +02:00
vmdk.c misc: Replace zero-length arrays with flexible array member (manual) 2020-03-16 22:07:42 +01:00
vpc.c block: Add @exact parameter to bdrv_co_truncate() 2019-10-28 12:00:07 +01:00
vvfat.c block/vvfat: Do not unref qcow on closing backing bdrv 2020-02-18 10:53:56 +01:00
vxhs.c replay: add BH oneshot event for block layer 2019-10-14 17:12:48 +02:00
win32-aio.c Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
write-threshold.c qapi: Drop qapi_event_send_FOO()'s Error ** argument 2018-08-28 18:21:38 +02:00