Revision e183ef75 block/nbd.c
b/block/nbd.c | ||
---|---|---|
251 | 251 |
return ret; |
252 | 252 |
} |
253 | 253 |
|
254 |
static coroutine_fn int nbd_co_write(BlockDriverState *bs, int64_t sector_num, |
|
255 |
const uint8_t *buf, int nb_sectors) |
|
256 |
{ |
|
257 |
int ret; |
|
258 |
BDRVNBDState *s = bs->opaque; |
|
259 |
qemu_co_mutex_lock(&s->lock); |
|
260 |
ret = nbd_write(bs, sector_num, buf, nb_sectors); |
|
261 |
qemu_co_mutex_unlock(&s->lock); |
|
262 |
return ret; |
|
263 |
} |
|
264 |
|
|
254 | 265 |
static void nbd_close(BlockDriverState *bs) |
255 | 266 |
{ |
256 | 267 |
BDRVNBDState *s = bs->opaque; |
... | ... | |
272 | 283 |
.instance_size = sizeof(BDRVNBDState), |
273 | 284 |
.bdrv_file_open = nbd_open, |
274 | 285 |
.bdrv_read = nbd_co_read, |
275 |
.bdrv_write = nbd_write,
|
|
286 |
.bdrv_write = nbd_co_write,
|
|
276 | 287 |
.bdrv_close = nbd_close, |
277 | 288 |
.bdrv_getlength = nbd_getlength, |
278 | 289 |
.protocol_name = "nbd", |
Also available in: Unified diff