Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Kevin Wolf (12) and Peter Lieven (2)
# Via Kevin Wolf
* kwolf/for-anthony:
  nbd: Check against invalid option combinations
  nbd: Use default port if only host is specified
  block: Allow omitting the file name when using driver-specific options
  block: Make find_image_format safe with NULL filename
  block: Rename variable to avoid shadowing
  block: Introduce .bdrv_parse_filename callback
  nbd: Accept -drive options for the network connection
  nbd: Remove unused functions
  nbd: Keep hostname and port separate
  qemu-socket: Make socket_optslist public
  block: Pass bdrv_file_open() options to block drivers
  block: Add options QDict to bdrv_file_open() prototypes
  block: complete all IOs before resizing a device
  Revert "block: complete all IOs before .bdrv_truncate"
This commit is contained in:
Anthony Liguori 2013-03-22 13:08:01 -05:00
commit 3f08ffb4a4
24 changed files with 310 additions and 115 deletions

View file

@ -33,10 +33,10 @@
static const int on=1, off=0;
/* used temporarely until all users are converted to QemuOpts */
static QemuOptsList dummy_opts = {
.name = "dummy",
.head = QTAILQ_HEAD_INITIALIZER(dummy_opts.head),
/* used temporarily until all users are converted to QemuOpts */
QemuOptsList socket_optslist = {
.name = "socket",
.head = QTAILQ_HEAD_INITIALIZER(socket_optslist.head),
.desc = {
{
.name = "path",
@ -485,7 +485,7 @@ err:
}
/* compatibility wrapper */
static InetSocketAddress *inet_parse(const char *str, Error **errp)
InetSocketAddress *inet_parse(const char *str, Error **errp)
{
InetSocketAddress *addr;
const char *optstr, *h;
@ -555,7 +555,7 @@ fail:
return NULL;
}
static void inet_addr_to_opts(QemuOpts *opts, InetSocketAddress *addr)
static void inet_addr_to_opts(QemuOpts *opts, const InetSocketAddress *addr)
{
bool ipv4 = addr->ipv4 || !addr->has_ipv4;
bool ipv6 = addr->ipv6 || !addr->has_ipv6;
@ -583,7 +583,7 @@ int inet_listen(const char *str, char *ostr, int olen,
addr = inet_parse(str, errp);
if (addr != NULL) {
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
inet_addr_to_opts(opts, addr);
qapi_free_InetSocketAddress(addr);
sock = inet_listen_opts(opts, port_offset, errp);
@ -622,7 +622,7 @@ int inet_connect(const char *str, Error **errp)
addr = inet_parse(str, errp);
if (addr != NULL) {
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
inet_addr_to_opts(opts, addr);
qapi_free_InetSocketAddress(addr);
sock = inet_connect_opts(opts, errp, NULL, NULL);
@ -656,7 +656,7 @@ int inet_nonblocking_connect(const char *str,
addr = inet_parse(str, errp);
if (addr != NULL) {
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
inet_addr_to_opts(opts, addr);
qapi_free_InetSocketAddress(addr);
sock = inet_connect_opts(opts, errp, callback, opaque);
@ -799,7 +799,7 @@ int unix_listen(const char *str, char *ostr, int olen, Error **errp)
char *path, *optstr;
int sock, len;
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
optstr = strchr(str, ',');
if (optstr) {
@ -827,7 +827,7 @@ int unix_connect(const char *path, Error **errp)
QemuOpts *opts;
int sock;
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
qemu_opt_set(opts, "path", path);
sock = unix_connect_opts(opts, errp, NULL, NULL);
qemu_opts_del(opts);
@ -844,7 +844,7 @@ int unix_nonblocking_connect(const char *path,
g_assert(callback != NULL);
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
qemu_opt_set(opts, "path", path);
sock = unix_connect_opts(opts, errp, callback, opaque);
qemu_opts_del(opts);
@ -895,7 +895,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
QemuOpts *opts;
int fd;
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
switch (addr->kind) {
case SOCKET_ADDRESS_KIND_INET:
inet_addr_to_opts(opts, addr->inet);
@ -926,7 +926,7 @@ int socket_listen(SocketAddress *addr, Error **errp)
QemuOpts *opts;
int fd;
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
switch (addr->kind) {
case SOCKET_ADDRESS_KIND_INET:
inet_addr_to_opts(opts, addr->inet);
@ -954,7 +954,7 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp)
QemuOpts *opts;
int fd;
opts = qemu_opts_create_nofail(&dummy_opts);
opts = qemu_opts_create_nofail(&socket_optslist);
switch (remote->kind) {
case SOCKET_ADDRESS_KIND_INET:
qemu_opt_set(opts, "host", remote->inet->host);