Commit 787e4a85 authored by Kevin Wolf's avatar Kevin Wolf
Browse files

block: Add options QDict to bdrv_file_open() prototypes



The new parameter is unused yet.

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
parent 92b7a08d
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -708,7 +708,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
            bdrv_swap(file, bs);
            ret = 0;
        } else {
            ret = drv->bdrv_file_open(bs, filename, open_flags);
            ret = drv->bdrv_file_open(bs, filename, options, open_flags);
        }
    } else {
        assert(file != NULL);
@@ -742,13 +742,21 @@ free_and_fail:

/*
 * Opens a file using a protocol (file, host_device, nbd, ...)
 *
 * options is a QDict of options to pass to the block drivers, or NULL for an
 * empty set of options. The reference to the QDict belongs to the block layer
 * after the call (even on failure), so if the caller intends to reuse the
 * dictionary, it needs to use QINCREF() before calling bdrv_file_open.
 */
int bdrv_file_open(BlockDriverState **pbs, const char *filename, int flags)
int bdrv_file_open(BlockDriverState **pbs, const char *filename,
                   QDict *options, int flags)
{
    BlockDriverState *bs;
    BlockDriver *drv;
    int ret;

    QDECREF(options);

    drv = bdrv_find_protocol(filename);
    if (!drv) {
        return -ENOENT;
@@ -888,7 +896,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
        flags |= BDRV_O_ALLOW_RDWR;
    }

    ret = bdrv_file_open(&file, filename, bdrv_open_flags(bs, flags));
    ret = bdrv_file_open(&file, filename, NULL, bdrv_open_flags(bs, flags));
    if (ret < 0) {
        goto fail;
    }
+3 −2
Original line number Diff line number Diff line
@@ -304,7 +304,8 @@ fail:
}

/* Valid blkdebug filenames look like blkdebug:path/to/config:path/to/image */
static int blkdebug_open(BlockDriverState *bs, const char *filename, int flags)
static int blkdebug_open(BlockDriverState *bs, const char *filename,
                         QDict *options, int flags)
{
    BDRVBlkdebugState *s = bs->opaque;
    int ret;
@@ -335,7 +336,7 @@ static int blkdebug_open(BlockDriverState *bs, const char *filename, int flags)
    s->state = 1;

    /* Open the backing file */
    ret = bdrv_file_open(&bs->file, filename, flags);
    ret = bdrv_file_open(&bs->file, filename, NULL, flags);
    if (ret < 0) {
        return ret;
    }
+3 −2
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ static void GCC_FMT_ATTR(2, 3) blkverify_err(BlkverifyAIOCB *acb,
}

/* Valid blkverify filenames look like blkverify:path/to/raw_image:path/to/image */
static int blkverify_open(BlockDriverState *bs, const char *filename, int flags)
static int blkverify_open(BlockDriverState *bs, const char *filename,
                          QDict *options, int flags)
{
    BDRVBlkverifyState *s = bs->opaque;
    int ret;
@@ -89,7 +90,7 @@ static int blkverify_open(BlockDriverState *bs, const char *filename, int flags)

    raw = g_strdup(filename);
    raw[c - filename] = '\0';
    ret = bdrv_file_open(&bs->file, raw, flags);
    ret = bdrv_file_open(&bs->file, raw, NULL, flags);
    g_free(raw);
    if (ret < 0) {
        return ret;
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ static int cow_create(const char *filename, QEMUOptionParameter *options)
        return ret;
    }

    ret = bdrv_file_open(&cow_bs, filename, BDRV_O_RDWR);
    ret = bdrv_file_open(&cow_bs, filename, NULL, BDRV_O_RDWR);
    if (ret < 0) {
        return ret;
    }
+2 −1
Original line number Diff line number Diff line
@@ -335,7 +335,8 @@ static void curl_clean_state(CURLState *s)
    s->in_use = 0;
}

static int curl_open(BlockDriverState *bs, const char *filename, int flags)
static int curl_open(BlockDriverState *bs, const char *filename,
                     QDict *options, int flags)
{
    BDRVCURLState *s = bs->opaque;
    CURLState *state = NULL;
Loading