mirror of https://github.com/xemu-project/xemu.git
block: Remove filename parameter from .bdrv_file_open()
It is unused now in all block drivers. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
7ad9be64e8
commit
56d1b4d21d
8
block.c
8
block.c
|
@ -722,7 +722,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
||||||
if (drv->bdrv_file_open) {
|
if (drv->bdrv_file_open) {
|
||||||
assert(file == NULL);
|
assert(file == NULL);
|
||||||
assert(drv->bdrv_parse_filename || filename != NULL);
|
assert(drv->bdrv_parse_filename || filename != NULL);
|
||||||
ret = drv->bdrv_file_open(bs, filename, options, open_flags);
|
ret = drv->bdrv_file_open(bs, options, open_flags);
|
||||||
} else {
|
} else {
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a "
|
qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a "
|
||||||
|
@ -826,6 +826,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
qdict_del(options, "filename");
|
||||||
} else if (!drv->bdrv_parse_filename && !filename) {
|
} else if (!drv->bdrv_parse_filename && !filename) {
|
||||||
qerror_report(ERROR_CLASS_GENERIC_ERROR,
|
qerror_report(ERROR_CLASS_GENERIC_ERROR,
|
||||||
"The '%s' block driver requires a file name",
|
"The '%s' block driver requires a file name",
|
||||||
|
@ -839,11 +840,6 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO Remove once all protocols know the filename option */
|
|
||||||
if (qdict_haskey(options, "filename")) {
|
|
||||||
qdict_del(options, "filename");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if any unknown options were used */
|
/* Check if any unknown options were used */
|
||||||
if (qdict_size(options) != 0) {
|
if (qdict_size(options) != 0) {
|
||||||
const QDictEntry *entry = qdict_first(options);
|
const QDictEntry *entry = qdict_first(options);
|
||||||
|
|
|
@ -346,8 +346,7 @@ static QemuOptsList runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int blkdebug_open(BlockDriverState *bs, const char *dummy,
|
static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVBlkdebugState *s = bs->opaque;
|
BDRVBlkdebugState *s = bs->opaque;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
|
|
@ -116,8 +116,7 @@ static QemuOptsList runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int blkverify_open(BlockDriverState *bs, const char *dummy,
|
static int blkverify_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVBlkverifyState *s = bs->opaque;
|
BDRVBlkverifyState *s = bs->opaque;
|
||||||
QemuOpts *opts;
|
QemuOpts *opts;
|
||||||
|
|
|
@ -395,8 +395,7 @@ static QemuOptsList runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int curl_open(BlockDriverState *bs, const char *dummy,
|
static int curl_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVCURLState *s = bs->opaque;
|
BDRVCURLState *s = bs->opaque;
|
||||||
CURLState *state = NULL;
|
CURLState *state = NULL;
|
||||||
|
|
|
@ -296,8 +296,8 @@ static QemuOptsList runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int qemu_gluster_open(BlockDriverState *bs, const char *dummy,
|
static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
|
||||||
QDict *options, int bdrv_flags)
|
int bdrv_flags)
|
||||||
{
|
{
|
||||||
BDRVGlusterState *s = bs->opaque;
|
BDRVGlusterState *s = bs->opaque;
|
||||||
int open_flags = O_BINARY;
|
int open_flags = O_BINARY;
|
||||||
|
|
|
@ -1021,8 +1021,7 @@ static QemuOptsList runtime_opts = {
|
||||||
* We support iscsi url's on the form
|
* We support iscsi url's on the form
|
||||||
* iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
|
* iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
|
||||||
*/
|
*/
|
||||||
static int iscsi_open(BlockDriverState *bs, const char *dummy,
|
static int iscsi_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
IscsiLun *iscsilun = bs->opaque;
|
IscsiLun *iscsilun = bs->opaque;
|
||||||
struct iscsi_context *iscsi = NULL;
|
struct iscsi_context *iscsi = NULL;
|
||||||
|
@ -1237,7 +1236,7 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options)
|
||||||
|
|
||||||
bs_options = qdict_new();
|
bs_options = qdict_new();
|
||||||
qdict_put(bs_options, "filename", qstring_from_str(filename));
|
qdict_put(bs_options, "filename", qstring_from_str(filename));
|
||||||
ret = iscsi_open(&bs, NULL, bs_options, 0);
|
ret = iscsi_open(&bs, bs_options, 0);
|
||||||
QDECREF(bs_options);
|
QDECREF(bs_options);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
|
|
@ -441,8 +441,7 @@ static void nbd_teardown_connection(BlockDriverState *bs)
|
||||||
closesocket(s->sock);
|
closesocket(s->sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nbd_open(BlockDriverState *bs, const char* filename,
|
static int nbd_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVNBDState *s = bs->opaque;
|
BDRVNBDState *s = bs->opaque;
|
||||||
int result;
|
int result;
|
||||||
|
|
|
@ -335,8 +335,7 @@ fail:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int raw_open(BlockDriverState *bs, const char *filename,
|
static int raw_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
|
|
||||||
|
@ -1325,8 +1324,7 @@ static int check_hdev_writable(BDRVRawState *s)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hdev_open(BlockDriverState *bs, const char *dummy,
|
static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1565,8 +1563,7 @@ static BlockDriver bdrv_host_device = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
static int floppy_open(BlockDriverState *bs, const char *filename,
|
static int floppy_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1688,8 +1685,7 @@ static BlockDriver bdrv_host_floppy = {
|
||||||
.bdrv_eject = floppy_eject,
|
.bdrv_eject = floppy_eject,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cdrom_open(BlockDriverState *bs, const char *filename,
|
static int cdrom_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
|
|
||||||
|
@ -1797,8 +1793,7 @@ static BlockDriver bdrv_host_cdrom = {
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||||
static int cdrom_open(BlockDriverState *bs, const char *filename,
|
static int cdrom_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -234,8 +234,7 @@ static QemuOptsList raw_runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int raw_open(BlockDriverState *bs, const char *unused,
|
static int raw_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
int access_flags;
|
int access_flags;
|
||||||
|
@ -531,8 +530,7 @@ static int hdev_probe_device(const char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hdev_open(BlockDriverState *bs, const char *dummy,
|
static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRawState *s = bs->opaque;
|
BDRVRawState *s = bs->opaque;
|
||||||
int access_flags, create_flags;
|
int access_flags, create_flags;
|
||||||
|
|
|
@ -455,8 +455,7 @@ static QemuOptsList runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int qemu_rbd_open(BlockDriverState *bs, const char *dummy,
|
static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVRBDState *s = bs->opaque;
|
BDRVRBDState *s = bs->opaque;
|
||||||
char pool[RBD_MAX_POOL_NAME_SIZE];
|
char pool[RBD_MAX_POOL_NAME_SIZE];
|
||||||
|
|
|
@ -1140,8 +1140,7 @@ static QemuOptsList runtime_opts = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int sd_open(BlockDriverState *bs, const char *dummy,
|
static int sd_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
int ret, fd;
|
int ret, fd;
|
||||||
uint32_t vid = 0;
|
uint32_t vid = 0;
|
||||||
|
|
|
@ -608,8 +608,7 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssh_file_open(BlockDriverState *bs, const char *filename,
|
static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags)
|
||||||
QDict *options, int bdrv_flags)
|
|
||||||
{
|
{
|
||||||
BDRVSSHState *s = bs->opaque;
|
BDRVSSHState *s = bs->opaque;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
@ -1065,8 +1065,7 @@ static void vvfat_parse_filename(const char *filename, QDict *options,
|
||||||
qdict_put(options, "rw", qbool_from_int(rw));
|
qdict_put(options, "rw", qbool_from_int(rw));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vvfat_open(BlockDriverState *bs, const char* dummy,
|
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags)
|
||||||
QDict *options, int flags)
|
|
||||||
{
|
{
|
||||||
BDRVVVFATState *s = bs->opaque;
|
BDRVVVFATState *s = bs->opaque;
|
||||||
int cyls, heads, secs;
|
int cyls, heads, secs;
|
||||||
|
|
|
@ -87,8 +87,7 @@ struct BlockDriver {
|
||||||
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
|
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
|
||||||
|
|
||||||
int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags);
|
int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags);
|
||||||
int (*bdrv_file_open)(BlockDriverState *bs, const char *filename,
|
int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags);
|
||||||
QDict *options, int flags);
|
|
||||||
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
|
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
|
||||||
uint8_t *buf, int nb_sectors);
|
uint8_t *buf, int nb_sectors);
|
||||||
int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
|
int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
|
||||||
|
|
Loading…
Reference in New Issue