mirror of https://github.com/xemu-project/xemu.git
Merge remote-tracking branch 'stefanha/block' into staging
* stefanha/block: ide: Fix status register after short PRDs ide: Fix crash with too long PRD use int64_t for return values from rbd instead of int vdi: don't override libuuid symbols block: add bdrv_reopen() support for raw hdev, floppy, and cdrom Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
commit
0a87470116
|
@ -333,6 +333,10 @@ static int raw_reopen_prepare(BDRVReopenState *state,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (s->type == FTYPE_FD || s->type == FTYPE_CD) {
|
||||
raw_s->open_flags |= O_NONBLOCK;
|
||||
}
|
||||
|
||||
raw_parse_flags(state->flags, &raw_s->open_flags);
|
||||
|
||||
raw_s->fd = -1;
|
||||
|
@ -1409,6 +1413,9 @@ static BlockDriver bdrv_host_device = {
|
|||
.bdrv_probe_device = hdev_probe_device,
|
||||
.bdrv_file_open = hdev_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
.bdrv_create = hdev_create,
|
||||
.create_options = raw_create_options,
|
||||
.bdrv_has_zero_init = hdev_has_zero_init,
|
||||
|
@ -1530,6 +1537,9 @@ static BlockDriver bdrv_host_floppy = {
|
|||
.bdrv_probe_device = floppy_probe_device,
|
||||
.bdrv_file_open = floppy_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
.bdrv_create = hdev_create,
|
||||
.create_options = raw_create_options,
|
||||
.bdrv_has_zero_init = hdev_has_zero_init,
|
||||
|
@ -1629,6 +1639,9 @@ static BlockDriver bdrv_host_cdrom = {
|
|||
.bdrv_probe_device = cdrom_probe_device,
|
||||
.bdrv_file_open = cdrom_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
.bdrv_create = hdev_create,
|
||||
.create_options = raw_create_options,
|
||||
.bdrv_has_zero_init = hdev_has_zero_init,
|
||||
|
@ -1748,6 +1761,9 @@ static BlockDriver bdrv_host_cdrom = {
|
|||
.bdrv_probe_device = cdrom_probe_device,
|
||||
.bdrv_file_open = cdrom_open,
|
||||
.bdrv_close = raw_close,
|
||||
.bdrv_reopen_prepare = raw_reopen_prepare,
|
||||
.bdrv_reopen_commit = raw_reopen_commit,
|
||||
.bdrv_reopen_abort = raw_reopen_abort,
|
||||
.bdrv_create = hdev_create,
|
||||
.create_options = raw_create_options,
|
||||
.bdrv_has_zero_init = hdev_has_zero_init,
|
||||
|
|
|
@ -69,7 +69,7 @@ typedef enum {
|
|||
typedef struct RBDAIOCB {
|
||||
BlockDriverAIOCB common;
|
||||
QEMUBH *bh;
|
||||
int ret;
|
||||
int64_t ret;
|
||||
QEMUIOVector *qiov;
|
||||
char *bounce;
|
||||
RBDAIOCmd cmd;
|
||||
|
@ -86,7 +86,7 @@ typedef struct RADOSCB {
|
|||
int done;
|
||||
int64_t size;
|
||||
char *buf;
|
||||
int ret;
|
||||
int64_t ret;
|
||||
} RADOSCB;
|
||||
|
||||
#define RBD_FD_READ 0
|
||||
|
|
|
@ -60,9 +60,6 @@
|
|||
/* TODO: move uuid emulation to some central place in QEMU. */
|
||||
#include "sysemu.h" /* UUID_FMT */
|
||||
typedef unsigned char uuid_t[16];
|
||||
void uuid_generate(uuid_t out);
|
||||
int uuid_is_null(const uuid_t uu);
|
||||
void uuid_unparse(const uuid_t uu, char *out);
|
||||
#endif
|
||||
|
||||
/* Code configuration options. */
|
||||
|
@ -124,18 +121,18 @@ void uuid_unparse(const uuid_t uu, char *out);
|
|||
#define VDI_IS_ALLOCATED(X) ((X) < VDI_DISCARDED)
|
||||
|
||||
#if !defined(CONFIG_UUID)
|
||||
void uuid_generate(uuid_t out)
|
||||
static inline void uuid_generate(uuid_t out)
|
||||
{
|
||||
memset(out, 0, sizeof(uuid_t));
|
||||
}
|
||||
|
||||
int uuid_is_null(const uuid_t uu)
|
||||
static inline int uuid_is_null(const uuid_t uu)
|
||||
{
|
||||
uuid_t null_uuid = { 0 };
|
||||
return memcmp(uu, null_uuid, sizeof(uuid_t)) == 0;
|
||||
}
|
||||
|
||||
void uuid_unparse(const uuid_t uu, char *out)
|
||||
static inline void uuid_unparse(const uuid_t uu, char *out)
|
||||
{
|
||||
snprintf(out, 37, UUID_FMT,
|
||||
uu[0], uu[1], uu[2], uu[3], uu[4], uu[5], uu[6], uu[7],
|
||||
|
|
|
@ -579,6 +579,7 @@ void ide_dma_cb(void *opaque, int ret)
|
|||
IDEState *s = opaque;
|
||||
int n;
|
||||
int64_t sector_num;
|
||||
bool stay_active = false;
|
||||
|
||||
if (ret < 0) {
|
||||
int op = BM_STATUS_DMA_RETRY;
|
||||
|
@ -594,6 +595,14 @@ void ide_dma_cb(void *opaque, int ret)
|
|||
}
|
||||
|
||||
n = s->io_buffer_size >> 9;
|
||||
if (n > s->nsector) {
|
||||
/* The PRDs were longer than needed for this request. Shorten them so
|
||||
* we don't get a negative remainder. The Active bit must remain set
|
||||
* after the request completes. */
|
||||
n = s->nsector;
|
||||
stay_active = true;
|
||||
}
|
||||
|
||||
sector_num = ide_get_sector(s);
|
||||
if (n > 0) {
|
||||
dma_buf_commit(s);
|
||||
|
@ -616,6 +625,7 @@ void ide_dma_cb(void *opaque, int ret)
|
|||
if (s->bus->dma->ops->prepare_buf(s->bus->dma, ide_cmd_is_read(s)) == 0) {
|
||||
/* The PRDs were too short. Reset the Active bit, but don't raise an
|
||||
* interrupt. */
|
||||
s->status = READY_STAT | SEEK_STAT;
|
||||
goto eot;
|
||||
}
|
||||
|
||||
|
@ -646,6 +656,9 @@ eot:
|
|||
bdrv_acct_done(s->bs, &s->acct);
|
||||
}
|
||||
ide_set_inactive(s);
|
||||
if (stay_active) {
|
||||
s->bus->dma->ops->add_status(s->bus->dma, BM_STATUS_DMAING);
|
||||
}
|
||||
}
|
||||
|
||||
static void ide_sector_start_dma(IDEState *s, enum ide_dma_cmd dma_cmd)
|
||||
|
|
Loading…
Reference in New Issue