Commit e60f469ca80e0b39b7cf85aef0d3b1ff32a67cba

Authored by aurel32
1 parent aaedd1f9

Use C99 initializers for BlockDriver methods

Consistently use the C99 named initializer format for the BlockDriver
methods to make the method table more readable and more easily
extensible.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6768 c046a42c-6fe2-441c-8c8c-71466251a162
block-bochs.c
... ... @@ -242,11 +242,10 @@ static void bochs_close(BlockDriverState *bs)
242 242 }
243 243  
244 244 BlockDriver bdrv_bochs = {
245   - "bochs",
246   - sizeof(BDRVBochsState),
247   - bochs_probe,
248   - bochs_open,
249   - bochs_read,
250   - NULL,
251   - bochs_close,
  245 + .format_name = "bochs",
  246 + .instance_size = sizeof(BDRVBochsState),
  247 + .bdrv_probe = bochs_probe,
  248 + .bdrv_open = bochs_open,
  249 + .bdrv_read = bochs_read,
  250 + .bdrv_close = bochs_close,
252 251 };
... ...
block-cloop.c
... ... @@ -154,11 +154,10 @@ static void cloop_close(BlockDriverState *bs)
154 154 }
155 155  
156 156 BlockDriver bdrv_cloop = {
157   - "cloop",
158   - sizeof(BDRVCloopState),
159   - cloop_probe,
160   - cloop_open,
161   - cloop_read,
162   - NULL,
163   - cloop_close,
  157 + .format_name = "cloop",
  158 + .instance_size = sizeof(BDRVCloopState),
  159 + .bdrv_probe = cloop_probe,
  160 + .bdrv_open = cloop_open,
  161 + .bdrv_read = cloop_read,
  162 + .bdrv_close = cloop_close,
164 163 };
... ...
block-cow.c
... ... @@ -253,15 +253,15 @@ static void cow_flush(BlockDriverState *bs)
253 253 }
254 254  
255 255 BlockDriver bdrv_cow = {
256   - "cow",
257   - sizeof(BDRVCowState),
258   - cow_probe,
259   - cow_open,
260   - cow_read,
261   - cow_write,
262   - cow_close,
263   - cow_create,
264   - cow_flush,
265   - cow_is_allocated,
  256 + .format_name = "cow",
  257 + .instance_size = sizeof(BDRVCowState),
  258 + .bdrv_probe = cow_probe,
  259 + .bdrv_open = cow_open,
  260 + .bdrv_read = cow_read,
  261 + .bdrv_write = cow_write,
  262 + .bdrv_close = cow_close,
  263 + .bdrv_create = cow_create,
  264 + .bdrv_flush = cow_flush,
  265 + .bdrv_is_allocated = cow_is_allocated,
266 266 };
267 267 #endif
... ...
block-dmg.c
... ... @@ -284,11 +284,10 @@ static void dmg_close(BlockDriverState *bs)
284 284 }
285 285  
286 286 BlockDriver bdrv_dmg = {
287   - "dmg",
288   - sizeof(BDRVDMGState),
289   - dmg_probe,
290   - dmg_open,
291   - dmg_read,
292   - NULL,
293   - dmg_close,
  287 + .format_name = "dmg",
  288 + .instance_size = sizeof(BDRVDMGState),
  289 + .bdrv_probe = dmg_probe,
  290 + .bdrv_open = dmg_open,
  291 + .bdrv_read = dmg_read,
  292 + .bdrv_close = dmg_close,
294 293 };
... ...
block-nbd.c
... ... @@ -177,13 +177,12 @@ static int64_t nbd_getlength(BlockDriverState *bs)
177 177 }
178 178  
179 179 BlockDriver bdrv_nbd = {
180   - "nbd",
181   - sizeof(BDRVNBDState),
182   - NULL, /* no probe for protocols */
183   - nbd_open,
184   - nbd_read,
185   - nbd_write,
186   - nbd_close,
187   - .bdrv_getlength = nbd_getlength,
188   - .protocol_name = "nbd",
  180 + .format_name = "nbd",
  181 + .instance_size = sizeof(BDRVNBDState),
  182 + .bdrv_open = nbd_open,
  183 + .bdrv_read = nbd_read,
  184 + .bdrv_write = nbd_write,
  185 + .bdrv_close = nbd_close,
  186 + .bdrv_getlength = nbd_getlength,
  187 + .protocol_name = "nbd",
189 188 };
... ...
block-parallels.c
... ... @@ -164,11 +164,10 @@ static void parallels_close(BlockDriverState *bs)
164 164 }
165 165  
166 166 BlockDriver bdrv_parallels = {
167   - "parallels",
168   - sizeof(BDRVParallelsState),
169   - parallels_probe,
170   - parallels_open,
171   - parallels_read,
172   - NULL,
173   - parallels_close,
  167 + .format_name = "parallels",
  168 + .instance_size = sizeof(BDRVParallelsState),
  169 + .bdrv_probe = parallels_probe,
  170 + .bdrv_open = parallels_open,
  171 + .bdrv_read = parallels_read,
  172 + .bdrv_close = parallels_close,
174 173 };
... ...
block-qcow.c
... ... @@ -887,23 +887,20 @@ static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
887 887 }
888 888  
889 889 BlockDriver bdrv_qcow = {
890   - "qcow",
891   - sizeof(BDRVQcowState),
892   - qcow_probe,
893   - qcow_open,
894   - NULL,
895   - NULL,
896   - qcow_close,
897   - qcow_create,
898   - qcow_flush,
899   - qcow_is_allocated,
900   - qcow_set_key,
901   - qcow_make_empty,
902   -
903   - .bdrv_aio_read = qcow_aio_read,
904   - .bdrv_aio_write = qcow_aio_write,
905   - .bdrv_aio_cancel = qcow_aio_cancel,
906   - .aiocb_size = sizeof(QCowAIOCB),
  890 + .format_name = "qcow",
  891 + .instance_size = sizeof(BDRVQcowState),
  892 + .bdrv_probe = qcow_probe,
  893 + .bdrv_open = qcow_open,
  894 + .bdrv_close = qcow_close,
  895 + .bdrv_create = qcow_create,
  896 + .bdrv_flush = qcow_flush,
  897 + .bdrv_is_allocated = qcow_is_allocated,
  898 + .bdrv_set_key = qcow_set_key,
  899 + .bdrv_make_empty = qcow_make_empty,
  900 + .bdrv_aio_read = qcow_aio_read,
  901 + .bdrv_aio_write = qcow_aio_write,
  902 + .bdrv_aio_cancel = qcow_aio_cancel,
  903 + .aiocb_size = sizeof(QCowAIOCB),
907 904 .bdrv_write_compressed = qcow_write_compressed,
908   - .bdrv_get_info = qcow_get_info,
  905 + .bdrv_get_info = qcow_get_info,
909 906 };
... ...
block-qcow2.c
... ... @@ -2646,28 +2646,26 @@ static void dump_refcounts(BlockDriverState *bs)
2646 2646 #endif
2647 2647  
2648 2648 BlockDriver bdrv_qcow2 = {
2649   - "qcow2",
2650   - sizeof(BDRVQcowState),
2651   - qcow_probe,
2652   - qcow_open,
2653   - NULL,
2654   - NULL,
2655   - qcow_close,
2656   - qcow_create,
2657   - qcow_flush,
2658   - qcow_is_allocated,
2659   - qcow_set_key,
2660   - qcow_make_empty,
2661   -
2662   - .bdrv_aio_read = qcow_aio_read,
2663   - .bdrv_aio_write = qcow_aio_write,
2664   - .bdrv_aio_cancel = qcow_aio_cancel,
2665   - .aiocb_size = sizeof(QCowAIOCB),
  2649 + .format_name = "qcow2",
  2650 + .instance_size = sizeof(BDRVQcowState),
  2651 + .bdrv_probe = qcow_probe,
  2652 + .bdrv_open = qcow_open,
  2653 + .bdrv_close = qcow_close,
  2654 + .bdrv_create = qcow_create,
  2655 + .bdrv_flush = qcow_flush,
  2656 + .bdrv_is_allocated = qcow_is_allocated,
  2657 + .bdrv_set_key = qcow_set_key,
  2658 + .bdrv_make_empty = qcow_make_empty,
  2659 +
  2660 + .bdrv_aio_read = qcow_aio_read,
  2661 + .bdrv_aio_write = qcow_aio_write,
  2662 + .bdrv_aio_cancel = qcow_aio_cancel,
  2663 + .aiocb_size = sizeof(QCowAIOCB),
2666 2664 .bdrv_write_compressed = qcow_write_compressed,
2667 2665  
2668 2666 .bdrv_snapshot_create = qcow_snapshot_create,
2669   - .bdrv_snapshot_goto = qcow_snapshot_goto,
  2667 + .bdrv_snapshot_goto = qcow_snapshot_goto,
2670 2668 .bdrv_snapshot_delete = qcow_snapshot_delete,
2671   - .bdrv_snapshot_list = qcow_snapshot_list,
2672   - .bdrv_get_info = qcow_get_info,
  2669 + .bdrv_snapshot_list = qcow_snapshot_list,
  2670 + .bdrv_get_info = qcow_get_info,
2673 2671 };
... ...
block-raw-posix.c
... ... @@ -1180,32 +1180,28 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
1180 1180 #endif /* !linux */
1181 1181  
1182 1182 BlockDriver bdrv_host_device = {
1183   - "host_device",
1184   - sizeof(BDRVRawState),
1185   - NULL, /* no probe for protocols */
1186   - hdev_open,
1187   - NULL,
1188   - NULL,
1189   - raw_close,
1190   - NULL,
1191   - raw_flush,
  1183 + .format_name = "host_device",
  1184 + .instance_size = sizeof(BDRVRawState),
  1185 + .bdrv_open = hdev_open,
  1186 + .bdrv_close = raw_close,
  1187 + .bdrv_flush = raw_flush,
1192 1188  
1193 1189 #ifdef CONFIG_AIO
1194   - .bdrv_aio_read = raw_aio_read,
1195   - .bdrv_aio_write = raw_aio_write,
1196   - .bdrv_aio_cancel = raw_aio_cancel,
1197   - .aiocb_size = sizeof(RawAIOCB),
  1190 + .bdrv_aio_read = raw_aio_read,
  1191 + .bdrv_aio_write = raw_aio_write,
  1192 + .bdrv_aio_cancel = raw_aio_cancel,
  1193 + .aiocb_size = sizeof(RawAIOCB),
1198 1194 #endif
1199 1195  
1200   - .bdrv_pread = raw_pread,
1201   - .bdrv_pwrite = raw_pwrite,
1202   - .bdrv_getlength = raw_getlength,
  1196 + .bdrv_pread = raw_pread,
  1197 + .bdrv_pwrite = raw_pwrite,
  1198 + .bdrv_getlength = raw_getlength,
1203 1199  
1204 1200 /* removable device support */
1205   - .bdrv_is_inserted = raw_is_inserted,
1206   - .bdrv_media_changed = raw_media_changed,
1207   - .bdrv_eject = raw_eject,
1208   - .bdrv_set_locked = raw_set_locked,
  1201 + .bdrv_is_inserted = raw_is_inserted,
  1202 + .bdrv_media_changed = raw_media_changed,
  1203 + .bdrv_eject = raw_eject,
  1204 + .bdrv_set_locked = raw_set_locked,
1209 1205 /* generic scsi device */
1210   - .bdrv_ioctl = raw_ioctl,
  1206 + .bdrv_ioctl = raw_ioctl,
1211 1207 };
... ...
block-raw-win32.c
... ... @@ -495,23 +495,19 @@ static int raw_set_locked(BlockDriverState *bs, int locked)
495 495 #endif
496 496  
497 497 BlockDriver bdrv_host_device = {
498   - "host_device",
499   - sizeof(BDRVRawState),
500   - NULL, /* no probe for protocols */
501   - hdev_open,
502   - NULL,
503   - NULL,
504   - raw_close,
505   - NULL,
506   - raw_flush,
  498 + .format_name = "host_device",
  499 + .instance_size = sizeof(BDRVRawState),
  500 + .bdrv_open = hdev_open,
  501 + .bdrv_close = raw_close,
  502 + .bdrv_flush = raw_flush,
507 503  
508 504 #ifdef WIN32_AIO
509   - .bdrv_aio_read = raw_aio_read,
510   - .bdrv_aio_write = raw_aio_write,
511   - .bdrv_aio_cancel = raw_aio_cancel,
512   - .aiocb_size = sizeof(RawAIOCB);
  505 + .bdrv_aio_read = raw_aio_read,
  506 + .bdrv_aio_write = raw_aio_write,
  507 + .bdrv_aio_cancel = raw_aio_cancel,
  508 + .aiocb_size = sizeof(RawAIOCB);
513 509 #endif
514   - .bdrv_pread = raw_pread,
515   - .bdrv_pwrite = raw_pwrite,
516   - .bdrv_getlength = raw_getlength,
  510 + .bdrv_pread = raw_pread,
  511 + .bdrv_pwrite = raw_pwrite,
  512 + .bdrv_getlength = raw_getlength,
517 513 };
... ...
block-vmdk.c
... ... @@ -812,14 +812,14 @@ static void vmdk_flush(BlockDriverState *bs)
812 812 }
813 813  
814 814 BlockDriver bdrv_vmdk = {
815   - "vmdk",
816   - sizeof(BDRVVmdkState),
817   - vmdk_probe,
818   - vmdk_open,
819   - vmdk_read,
820   - vmdk_write,
821   - vmdk_close,
822   - vmdk_create,
823   - vmdk_flush,
824   - vmdk_is_allocated,
  815 + .format_name = "vmdk",
  816 + .instance_size = sizeof(BDRVVmdkState),
  817 + .bdrv_probe = vmdk_probe,
  818 + .bdrv_open = vmdk_open,
  819 + .bdrv_read = vmdk_read,
  820 + .bdrv_write = vmdk_write,
  821 + .bdrv_close = vmdk_close,
  822 + .bdrv_create = vmdk_create,
  823 + .bdrv_flush = vmdk_flush,
  824 + .bdrv_is_allocated = vmdk_is_allocated,
825 825 };
... ...
block-vpc.c
... ... @@ -582,12 +582,12 @@ static void vpc_close(BlockDriverState *bs)
582 582 }
583 583  
584 584 BlockDriver bdrv_vpc = {
585   - "vpc",
586   - sizeof(BDRVVPCState),
587   - vpc_probe,
588   - vpc_open,
589   - vpc_read,
590   - vpc_write,
591   - vpc_close,
592   - vpc_create,
  585 + .format_name = "vpc",
  586 + .instance_size = sizeof(BDRVVPCState),
  587 + .bdrv_probe = vpc_probe,
  588 + .bdrv_open = vpc_open,
  589 + .bdrv_read = vpc_read,
  590 + .bdrv_write = vpc_write,
  591 + .bdrv_close = vpc_close,
  592 + .bdrv_create = vpc_create,
593 593 };
... ...
block-vvfat.c
... ... @@ -2805,17 +2805,14 @@ static void vvfat_close(BlockDriverState *bs)
2805 2805 }
2806 2806  
2807 2807 BlockDriver bdrv_vvfat = {
2808   - "vvfat",
2809   - sizeof(BDRVVVFATState),
2810   - NULL, /* no probe for protocols */
2811   - vvfat_open,
2812   - vvfat_read,
2813   - vvfat_write,
2814   - vvfat_close,
2815   - NULL, /* ??? Not sure if we can do any meaningful flushing. */
2816   - NULL,
2817   - vvfat_is_allocated,
2818   - .protocol_name = "fat",
  2808 + .format_name = "vvfat",
  2809 + .instance_size = sizeof(BDRVVVFATState),
  2810 + .bdrv_open = vvfat_open,
  2811 + .bdrv_read = vvfat_read,
  2812 + .bdrv_write = vvfat_write,
  2813 + .bdrv_close = vvfat_close,
  2814 + .bdrv_is_allocated = vvfat_is_allocated,
  2815 + .protocol_name = "fat",
2819 2816 };
2820 2817  
2821 2818 #ifdef DEBUG
... ...