aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 22:00:29 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-07 22:00:29 +0000
commite60f469ca80e0b39b7cf85aef0d3b1ff32a67cba (patch)
treebcdf18a2fbd141e692dd2bd3175ee2ae0d11eb2c
parentaaedd1f9f302c0f5fd4554c10e85ae63603e3cb5 (diff)
downloadqemu-e60f469ca80e0b39b7cf85aef0d3b1ff32a67cba.zip
qemu-e60f469ca80e0b39b7cf85aef0d3b1ff32a67cba.tar.gz
qemu-e60f469ca80e0b39b7cf85aef0d3b1ff32a67cba.tar.bz2
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
-rw-r--r--block-bochs.c13
-rw-r--r--block-cloop.c13
-rw-r--r--block-cow.c20
-rw-r--r--block-dmg.c13
-rw-r--r--block-nbd.c17
-rw-r--r--block-parallels.c13
-rw-r--r--block-qcow.c33
-rw-r--r--block-qcow2.c38
-rw-r--r--block-raw-posix.c38
-rw-r--r--block-raw-win32.c28
-rw-r--r--block-vmdk.c20
-rw-r--r--block-vpc.c16
-rw-r--r--block-vvfat.c19
13 files changed, 130 insertions, 151 deletions
diff --git a/block-bochs.c b/block-bochs.c
index 593cf69..7a75412 100644
--- a/block-bochs.c
+++ b/block-bochs.c
@@ -242,11 +242,10 @@ static void bochs_close(BlockDriverState *bs)
}
BlockDriver bdrv_bochs = {
- "bochs",
- sizeof(BDRVBochsState),
- bochs_probe,
- bochs_open,
- bochs_read,
- NULL,
- bochs_close,
+ .format_name = "bochs",
+ .instance_size = sizeof(BDRVBochsState),
+ .bdrv_probe = bochs_probe,
+ .bdrv_open = bochs_open,
+ .bdrv_read = bochs_read,
+ .bdrv_close = bochs_close,
};
diff --git a/block-cloop.c b/block-cloop.c
index 6985084..9414d10 100644
--- a/block-cloop.c
+++ b/block-cloop.c
@@ -154,11 +154,10 @@ static void cloop_close(BlockDriverState *bs)
}
BlockDriver bdrv_cloop = {
- "cloop",
- sizeof(BDRVCloopState),
- cloop_probe,
- cloop_open,
- cloop_read,
- NULL,
- cloop_close,
+ .format_name = "cloop",
+ .instance_size = sizeof(BDRVCloopState),
+ .bdrv_probe = cloop_probe,
+ .bdrv_open = cloop_open,
+ .bdrv_read = cloop_read,
+ .bdrv_close = cloop_close,
};
diff --git a/block-cow.c b/block-cow.c
index 9e7b646..b9a1971 100644
--- a/block-cow.c
+++ b/block-cow.c
@@ -253,15 +253,15 @@ static void cow_flush(BlockDriverState *bs)
}
BlockDriver bdrv_cow = {
- "cow",
- sizeof(BDRVCowState),
- cow_probe,
- cow_open,
- cow_read,
- cow_write,
- cow_close,
- cow_create,
- cow_flush,
- cow_is_allocated,
+ .format_name = "cow",
+ .instance_size = sizeof(BDRVCowState),
+ .bdrv_probe = cow_probe,
+ .bdrv_open = cow_open,
+ .bdrv_read = cow_read,
+ .bdrv_write = cow_write,
+ .bdrv_close = cow_close,
+ .bdrv_create = cow_create,
+ .bdrv_flush = cow_flush,
+ .bdrv_is_allocated = cow_is_allocated,
};
#endif
diff --git a/block-dmg.c b/block-dmg.c
index df32bfb..82f6de1 100644
--- a/block-dmg.c
+++ b/block-dmg.c
@@ -284,11 +284,10 @@ static void dmg_close(BlockDriverState *bs)
}
BlockDriver bdrv_dmg = {
- "dmg",
- sizeof(BDRVDMGState),
- dmg_probe,
- dmg_open,
- dmg_read,
- NULL,
- dmg_close,
+ .format_name = "dmg",
+ .instance_size = sizeof(BDRVDMGState),
+ .bdrv_probe = dmg_probe,
+ .bdrv_open = dmg_open,
+ .bdrv_read = dmg_read,
+ .bdrv_close = dmg_close,
};
diff --git a/block-nbd.c b/block-nbd.c
index 5b6cc4f..632cb2d 100644
--- a/block-nbd.c
+++ b/block-nbd.c
@@ -177,13 +177,12 @@ static int64_t nbd_getlength(BlockDriverState *bs)
}
BlockDriver bdrv_nbd = {
- "nbd",
- sizeof(BDRVNBDState),
- NULL, /* no probe for protocols */
- nbd_open,
- nbd_read,
- nbd_write,
- nbd_close,
- .bdrv_getlength = nbd_getlength,
- .protocol_name = "nbd",
+ .format_name = "nbd",
+ .instance_size = sizeof(BDRVNBDState),
+ .bdrv_open = nbd_open,
+ .bdrv_read = nbd_read,
+ .bdrv_write = nbd_write,
+ .bdrv_close = nbd_close,
+ .bdrv_getlength = nbd_getlength,
+ .protocol_name = "nbd",
};
diff --git a/block-parallels.c b/block-parallels.c
index 8a8ec63..18c3d83 100644
--- a/block-parallels.c
+++ b/block-parallels.c
@@ -164,11 +164,10 @@ static void parallels_close(BlockDriverState *bs)
}
BlockDriver bdrv_parallels = {
- "parallels",
- sizeof(BDRVParallelsState),
- parallels_probe,
- parallels_open,
- parallels_read,
- NULL,
- parallels_close,
+ .format_name = "parallels",
+ .instance_size = sizeof(BDRVParallelsState),
+ .bdrv_probe = parallels_probe,
+ .bdrv_open = parallels_open,
+ .bdrv_read = parallels_read,
+ .bdrv_close = parallels_close,
};
diff --git a/block-qcow.c b/block-qcow.c
index 91c53b1..1fabc49 100644
--- a/block-qcow.c
+++ b/block-qcow.c
@@ -887,23 +887,20 @@ static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
}
BlockDriver bdrv_qcow = {
- "qcow",
- sizeof(BDRVQcowState),
- qcow_probe,
- qcow_open,
- NULL,
- NULL,
- qcow_close,
- qcow_create,
- qcow_flush,
- qcow_is_allocated,
- qcow_set_key,
- qcow_make_empty,
-
- .bdrv_aio_read = qcow_aio_read,
- .bdrv_aio_write = qcow_aio_write,
- .bdrv_aio_cancel = qcow_aio_cancel,
- .aiocb_size = sizeof(QCowAIOCB),
+ .format_name = "qcow",
+ .instance_size = sizeof(BDRVQcowState),
+ .bdrv_probe = qcow_probe,
+ .bdrv_open = qcow_open,
+ .bdrv_close = qcow_close,
+ .bdrv_create = qcow_create,
+ .bdrv_flush = qcow_flush,
+ .bdrv_is_allocated = qcow_is_allocated,
+ .bdrv_set_key = qcow_set_key,
+ .bdrv_make_empty = qcow_make_empty,
+ .bdrv_aio_read = qcow_aio_read,
+ .bdrv_aio_write = qcow_aio_write,
+ .bdrv_aio_cancel = qcow_aio_cancel,
+ .aiocb_size = sizeof(QCowAIOCB),
.bdrv_write_compressed = qcow_write_compressed,
- .bdrv_get_info = qcow_get_info,
+ .bdrv_get_info = qcow_get_info,
};
diff --git a/block-qcow2.c b/block-qcow2.c
index 465dcd6..eec1255 100644
--- a/block-qcow2.c
+++ b/block-qcow2.c
@@ -2646,28 +2646,26 @@ static void dump_refcounts(BlockDriverState *bs)
#endif
BlockDriver bdrv_qcow2 = {
- "qcow2",
- sizeof(BDRVQcowState),
- qcow_probe,
- qcow_open,
- NULL,
- NULL,
- qcow_close,
- qcow_create,
- qcow_flush,
- qcow_is_allocated,
- qcow_set_key,
- qcow_make_empty,
-
- .bdrv_aio_read = qcow_aio_read,
- .bdrv_aio_write = qcow_aio_write,
- .bdrv_aio_cancel = qcow_aio_cancel,
- .aiocb_size = sizeof(QCowAIOCB),
+ .format_name = "qcow2",
+ .instance_size = sizeof(BDRVQcowState),
+ .bdrv_probe = qcow_probe,
+ .bdrv_open = qcow_open,
+ .bdrv_close = qcow_close,
+ .bdrv_create = qcow_create,
+ .bdrv_flush = qcow_flush,
+ .bdrv_is_allocated = qcow_is_allocated,
+ .bdrv_set_key = qcow_set_key,
+ .bdrv_make_empty = qcow_make_empty,
+
+ .bdrv_aio_read = qcow_aio_read,
+ .bdrv_aio_write = qcow_aio_write,
+ .bdrv_aio_cancel = qcow_aio_cancel,
+ .aiocb_size = sizeof(QCowAIOCB),
.bdrv_write_compressed = qcow_write_compressed,
.bdrv_snapshot_create = qcow_snapshot_create,
- .bdrv_snapshot_goto = qcow_snapshot_goto,
+ .bdrv_snapshot_goto = qcow_snapshot_goto,
.bdrv_snapshot_delete = qcow_snapshot_delete,
- .bdrv_snapshot_list = qcow_snapshot_list,
- .bdrv_get_info = qcow_get_info,
+ .bdrv_snapshot_list = qcow_snapshot_list,
+ .bdrv_get_info = qcow_get_info,
};
diff --git a/block-raw-posix.c b/block-raw-posix.c
index 8695368..57e3535 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -1180,32 +1180,28 @@ static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
#endif /* !linux */
BlockDriver bdrv_host_device = {
- "host_device",
- sizeof(BDRVRawState),
- NULL, /* no probe for protocols */
- hdev_open,
- NULL,
- NULL,
- raw_close,
- NULL,
- raw_flush,
+ .format_name = "host_device",
+ .instance_size = sizeof(BDRVRawState),
+ .bdrv_open = hdev_open,
+ .bdrv_close = raw_close,
+ .bdrv_flush = raw_flush,
#ifdef CONFIG_AIO
- .bdrv_aio_read = raw_aio_read,
- .bdrv_aio_write = raw_aio_write,
- .bdrv_aio_cancel = raw_aio_cancel,
- .aiocb_size = sizeof(RawAIOCB),
+ .bdrv_aio_read = raw_aio_read,
+ .bdrv_aio_write = raw_aio_write,
+ .bdrv_aio_cancel = raw_aio_cancel,
+ .aiocb_size = sizeof(RawAIOCB),
#endif
- .bdrv_pread = raw_pread,
- .bdrv_pwrite = raw_pwrite,
- .bdrv_getlength = raw_getlength,
+ .bdrv_pread = raw_pread,
+ .bdrv_pwrite = raw_pwrite,
+ .bdrv_getlength = raw_getlength,
/* removable device support */
- .bdrv_is_inserted = raw_is_inserted,
- .bdrv_media_changed = raw_media_changed,
- .bdrv_eject = raw_eject,
- .bdrv_set_locked = raw_set_locked,
+ .bdrv_is_inserted = raw_is_inserted,
+ .bdrv_media_changed = raw_media_changed,
+ .bdrv_eject = raw_eject,
+ .bdrv_set_locked = raw_set_locked,
/* generic scsi device */
- .bdrv_ioctl = raw_ioctl,
+ .bdrv_ioctl = raw_ioctl,
};
diff --git a/block-raw-win32.c b/block-raw-win32.c
index 892f2d1..19fa80d 100644
--- a/block-raw-win32.c
+++ b/block-raw-win32.c
@@ -495,23 +495,19 @@ static int raw_set_locked(BlockDriverState *bs, int locked)
#endif
BlockDriver bdrv_host_device = {
- "host_device",
- sizeof(BDRVRawState),
- NULL, /* no probe for protocols */
- hdev_open,
- NULL,
- NULL,
- raw_close,
- NULL,
- raw_flush,
+ .format_name = "host_device",
+ .instance_size = sizeof(BDRVRawState),
+ .bdrv_open = hdev_open,
+ .bdrv_close = raw_close,
+ .bdrv_flush = raw_flush,
#ifdef WIN32_AIO
- .bdrv_aio_read = raw_aio_read,
- .bdrv_aio_write = raw_aio_write,
- .bdrv_aio_cancel = raw_aio_cancel,
- .aiocb_size = sizeof(RawAIOCB);
+ .bdrv_aio_read = raw_aio_read,
+ .bdrv_aio_write = raw_aio_write,
+ .bdrv_aio_cancel = raw_aio_cancel,
+ .aiocb_size = sizeof(RawAIOCB);
#endif
- .bdrv_pread = raw_pread,
- .bdrv_pwrite = raw_pwrite,
- .bdrv_getlength = raw_getlength,
+ .bdrv_pread = raw_pread,
+ .bdrv_pwrite = raw_pwrite,
+ .bdrv_getlength = raw_getlength,
};
diff --git a/block-vmdk.c b/block-vmdk.c
index d9e76d7..d47d483 100644
--- a/block-vmdk.c
+++ b/block-vmdk.c
@@ -812,14 +812,14 @@ static void vmdk_flush(BlockDriverState *bs)
}
BlockDriver bdrv_vmdk = {
- "vmdk",
- sizeof(BDRVVmdkState),
- vmdk_probe,
- vmdk_open,
- vmdk_read,
- vmdk_write,
- vmdk_close,
- vmdk_create,
- vmdk_flush,
- vmdk_is_allocated,
+ .format_name = "vmdk",
+ .instance_size = sizeof(BDRVVmdkState),
+ .bdrv_probe = vmdk_probe,
+ .bdrv_open = vmdk_open,
+ .bdrv_read = vmdk_read,
+ .bdrv_write = vmdk_write,
+ .bdrv_close = vmdk_close,
+ .bdrv_create = vmdk_create,
+ .bdrv_flush = vmdk_flush,
+ .bdrv_is_allocated = vmdk_is_allocated,
};
diff --git a/block-vpc.c b/block-vpc.c
index e353e31..7ae5202 100644
--- a/block-vpc.c
+++ b/block-vpc.c
@@ -582,12 +582,12 @@ static void vpc_close(BlockDriverState *bs)
}
BlockDriver bdrv_vpc = {
- "vpc",
- sizeof(BDRVVPCState),
- vpc_probe,
- vpc_open,
- vpc_read,
- vpc_write,
- vpc_close,
- vpc_create,
+ .format_name = "vpc",
+ .instance_size = sizeof(BDRVVPCState),
+ .bdrv_probe = vpc_probe,
+ .bdrv_open = vpc_open,
+ .bdrv_read = vpc_read,
+ .bdrv_write = vpc_write,
+ .bdrv_close = vpc_close,
+ .bdrv_create = vpc_create,
};
diff --git a/block-vvfat.c b/block-vvfat.c
index a2d37b9..01e9c04 100644
--- a/block-vvfat.c
+++ b/block-vvfat.c
@@ -2805,17 +2805,14 @@ static void vvfat_close(BlockDriverState *bs)
}
BlockDriver bdrv_vvfat = {
- "vvfat",
- sizeof(BDRVVVFATState),
- NULL, /* no probe for protocols */
- vvfat_open,
- vvfat_read,
- vvfat_write,
- vvfat_close,
- NULL, /* ??? Not sure if we can do any meaningful flushing. */
- NULL,
- vvfat_is_allocated,
- .protocol_name = "fat",
+ .format_name = "vvfat",
+ .instance_size = sizeof(BDRVVVFATState),
+ .bdrv_open = vvfat_open,
+ .bdrv_read = vvfat_read,
+ .bdrv_write = vvfat_write,
+ .bdrv_close = vvfat_close,
+ .bdrv_is_allocated = vvfat_is_allocated,
+ .protocol_name = "fat",
};
#ifdef DEBUG