|
@@ -189,7 +189,7 @@ static int fd_open(BlockDriverState *bs)
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
|
-static int64_t raw_getlength(BlockDriverState *bs);
|
|
|
+static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs);
|
|
|
|
|
|
typedef struct RawPosixAIOData {
|
|
|
BlockDriverState *bs;
|
|
@@ -2280,7 +2280,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
|
|
}
|
|
|
|
|
|
if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) {
|
|
|
- int64_t cur_length = raw_getlength(bs);
|
|
|
+ int64_t cur_length = raw_co_getlength(bs);
|
|
|
|
|
|
if (offset != cur_length && exact) {
|
|
|
error_setg(errp, "Cannot resize device files");
|
|
@@ -2298,7 +2298,7 @@ static int coroutine_fn raw_co_truncate(BlockDriverState *bs, int64_t offset,
|
|
|
}
|
|
|
|
|
|
#ifdef __OpenBSD__
|
|
|
-static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
+static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
|
|
|
{
|
|
|
BDRVRawState *s = bs->opaque;
|
|
|
int fd = s->fd;
|
|
@@ -2317,7 +2317,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
return st.st_size;
|
|
|
}
|
|
|
#elif defined(__NetBSD__)
|
|
|
-static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
+static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
|
|
|
{
|
|
|
BDRVRawState *s = bs->opaque;
|
|
|
int fd = s->fd;
|
|
@@ -2342,7 +2342,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
return st.st_size;
|
|
|
}
|
|
|
#elif defined(__sun__)
|
|
|
-static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
+static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
|
|
|
{
|
|
|
BDRVRawState *s = bs->opaque;
|
|
|
struct dk_minfo minfo;
|
|
@@ -2373,7 +2373,7 @@ static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
return size;
|
|
|
}
|
|
|
#elif defined(CONFIG_BSD)
|
|
|
-static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
+static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
|
|
|
{
|
|
|
BDRVRawState *s = bs->opaque;
|
|
|
int fd = s->fd;
|
|
@@ -2445,7 +2445,7 @@ again:
|
|
|
return size;
|
|
|
}
|
|
|
#else
|
|
|
-static int64_t raw_getlength(BlockDriverState *bs)
|
|
|
+static int64_t coroutine_fn raw_co_getlength(BlockDriverState *bs)
|
|
|
{
|
|
|
BDRVRawState *s = bs->opaque;
|
|
|
int ret;
|
|
@@ -2830,7 +2830,7 @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs,
|
|
|
* round up if necessary.
|
|
|
*/
|
|
|
if (!QEMU_IS_ALIGNED(*pnum, bs->bl.request_alignment)) {
|
|
|
- int64_t file_length = raw_getlength(bs);
|
|
|
+ int64_t file_length = raw_co_getlength(bs);
|
|
|
if (file_length > 0) {
|
|
|
/* Ignore errors, this is just a safeguard */
|
|
|
assert(hole == file_length);
|
|
@@ -2852,7 +2852,7 @@ static int coroutine_fn raw_co_block_status(BlockDriverState *bs,
|
|
|
|
|
|
#if defined(__linux__)
|
|
|
/* Verify that the file is not in the page cache */
|
|
|
-static void check_cache_dropped(BlockDriverState *bs, Error **errp)
|
|
|
+static void coroutine_fn check_cache_dropped(BlockDriverState *bs, Error **errp)
|
|
|
{
|
|
|
const size_t window_size = 128 * 1024 * 1024;
|
|
|
BDRVRawState *s = bs->opaque;
|
|
@@ -2867,7 +2867,7 @@ static void check_cache_dropped(BlockDriverState *bs, Error **errp)
|
|
|
page_size = sysconf(_SC_PAGESIZE);
|
|
|
vec = g_malloc(DIV_ROUND_UP(window_size, page_size));
|
|
|
|
|
|
- end = raw_getlength(bs);
|
|
|
+ end = raw_co_getlength(bs);
|
|
|
|
|
|
for (offset = 0; offset < end; offset += window_size) {
|
|
|
void *new_window;
|
|
@@ -3321,8 +3321,8 @@ BlockDriver bdrv_file = {
|
|
|
.bdrv_co_io_unplug = raw_co_io_unplug,
|
|
|
.bdrv_attach_aio_context = raw_aio_attach_aio_context,
|
|
|
|
|
|
- .bdrv_co_truncate = raw_co_truncate,
|
|
|
- .bdrv_getlength = raw_getlength,
|
|
|
+ .bdrv_co_truncate = raw_co_truncate,
|
|
|
+ .bdrv_co_getlength = raw_co_getlength,
|
|
|
.bdrv_get_info = raw_get_info,
|
|
|
.bdrv_get_allocated_file_size
|
|
|
= raw_get_allocated_file_size,
|
|
@@ -3693,8 +3693,8 @@ static BlockDriver bdrv_host_device = {
|
|
|
.bdrv_co_io_unplug = raw_co_io_unplug,
|
|
|
.bdrv_attach_aio_context = raw_aio_attach_aio_context,
|
|
|
|
|
|
- .bdrv_co_truncate = raw_co_truncate,
|
|
|
- .bdrv_getlength = raw_getlength,
|
|
|
+ .bdrv_co_truncate = raw_co_truncate,
|
|
|
+ .bdrv_co_getlength = raw_co_getlength,
|
|
|
.bdrv_get_info = raw_get_info,
|
|
|
.bdrv_get_allocated_file_size
|
|
|
= raw_get_allocated_file_size,
|
|
@@ -3817,9 +3817,9 @@ static BlockDriver bdrv_host_cdrom = {
|
|
|
.bdrv_co_io_unplug = raw_co_io_unplug,
|
|
|
.bdrv_attach_aio_context = raw_aio_attach_aio_context,
|
|
|
|
|
|
- .bdrv_co_truncate = raw_co_truncate,
|
|
|
- .bdrv_getlength = raw_getlength,
|
|
|
- .has_variable_length = true,
|
|
|
+ .bdrv_co_truncate = raw_co_truncate,
|
|
|
+ .bdrv_co_getlength = raw_co_getlength,
|
|
|
+ .has_variable_length = true,
|
|
|
.bdrv_get_allocated_file_size
|
|
|
= raw_get_allocated_file_size,
|
|
|
|
|
@@ -3885,7 +3885,7 @@ static int cdrom_reopen(BlockDriverState *bs)
|
|
|
|
|
|
static bool coroutine_fn cdrom_co_is_inserted(BlockDriverState *bs)
|
|
|
{
|
|
|
- return raw_getlength(bs) > 0;
|
|
|
+ return raw_co_getlength(bs) > 0;
|
|
|
}
|
|
|
|
|
|
static void cdrom_eject(BlockDriverState *bs, bool eject_flag)
|
|
@@ -3947,9 +3947,9 @@ static BlockDriver bdrv_host_cdrom = {
|
|
|
.bdrv_co_io_unplug = raw_co_io_unplug,
|
|
|
.bdrv_attach_aio_context = raw_aio_attach_aio_context,
|
|
|
|
|
|
- .bdrv_co_truncate = raw_co_truncate,
|
|
|
- .bdrv_getlength = raw_getlength,
|
|
|
- .has_variable_length = true,
|
|
|
+ .bdrv_co_truncate = raw_co_truncate,
|
|
|
+ .bdrv_co_getlength = raw_co_getlength,
|
|
|
+ .has_variable_length = true,
|
|
|
.bdrv_get_allocated_file_size
|
|
|
= raw_get_allocated_file_size,
|
|
|
|