nbd.c (62a35aaa310807fa161ca041ddb0f308faeb582b) nbd.c (af175e85f92c870386ad74f466e29537b79611d3)
1/*
2 * QEMU Block driver for NBD
3 *
4 * Copyright (c) 2019 Virtuozzo International GmbH.
5 * Copyright (C) 2016 Red Hat, Inc.
6 * Copyright (C) 2008 Bull S.A.S.
7 * Author: Laurent Vivier <Laurent.Vivier@bull.net>
8 *

--- 1712 unchanged lines hidden (view full) ---

1721}
1722
1723static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
1724 Error **errp)
1725{
1726 SocketAddress *saddr = NULL;
1727 QDict *addr = NULL;
1728 Visitor *iv = NULL;
1/*
2 * QEMU Block driver for NBD
3 *
4 * Copyright (c) 2019 Virtuozzo International GmbH.
5 * Copyright (C) 2016 Red Hat, Inc.
6 * Copyright (C) 2008 Bull S.A.S.
7 * Author: Laurent Vivier <Laurent.Vivier@bull.net>
8 *

--- 1712 unchanged lines hidden (view full) ---

1721}
1722
1723static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
1724 Error **errp)
1725{
1726 SocketAddress *saddr = NULL;
1727 QDict *addr = NULL;
1728 Visitor *iv = NULL;
1729 Error *local_err = NULL;
1730
1731 qdict_extract_subqdict(options, &addr, "server.");
1732 if (!qdict_size(addr)) {
1733 error_setg(errp, "NBD server address missing");
1734 goto done;
1735 }
1736
1737 iv = qobject_input_visitor_new_flat_confused(addr, errp);
1738 if (!iv) {
1739 goto done;
1740 }
1741
1729
1730 qdict_extract_subqdict(options, &addr, "server.");
1731 if (!qdict_size(addr)) {
1732 error_setg(errp, "NBD server address missing");
1733 goto done;
1734 }
1735
1736 iv = qobject_input_visitor_new_flat_confused(addr, errp);
1737 if (!iv) {
1738 goto done;
1739 }
1740
1742 if (!visit_type_SocketAddress(iv, NULL, &saddr, &local_err)) {
1743 error_propagate(errp, local_err);
1741 if (!visit_type_SocketAddress(iv, NULL, &saddr, errp)) {
1744 goto done;
1745 }
1746
1747done:
1748 qobject_unref(addr);
1749 visit_free(iv);
1750 return saddr;
1751}

--- 78 unchanged lines hidden (view full) ---

1830 },
1831};
1832
1833static int nbd_process_options(BlockDriverState *bs, QDict *options,
1834 Error **errp)
1835{
1836 BDRVNBDState *s = bs->opaque;
1837 QemuOpts *opts;
1742 goto done;
1743 }
1744
1745done:
1746 qobject_unref(addr);
1747 visit_free(iv);
1748 return saddr;
1749}

--- 78 unchanged lines hidden (view full) ---

1828 },
1829};
1830
1831static int nbd_process_options(BlockDriverState *bs, QDict *options,
1832 Error **errp)
1833{
1834 BDRVNBDState *s = bs->opaque;
1835 QemuOpts *opts;
1838 Error *local_err = NULL;
1839 int ret = -EINVAL;
1840
1841 opts = qemu_opts_create(&nbd_runtime_opts, NULL, 0, &error_abort);
1836 int ret = -EINVAL;
1837
1838 opts = qemu_opts_create(&nbd_runtime_opts, NULL, 0, &error_abort);
1842 if (!qemu_opts_absorb_qdict(opts, options, &local_err)) {
1843 error_propagate(errp, local_err);
1839 if (!qemu_opts_absorb_qdict(opts, options, errp)) {
1844 goto error;
1845 }
1846
1847 /* Translate @host, @port, and @path to a SocketAddress */
1848 if (!nbd_process_legacy_socket_options(options, opts, errp)) {
1849 goto error;
1850 }
1851

--- 274 unchanged lines hidden ---
1840 goto error;
1841 }
1842
1843 /* Translate @host, @port, and @path to a SocketAddress */
1844 if (!nbd_process_legacy_socket_options(options, opts, errp)) {
1845 goto error;
1846 }
1847

--- 274 unchanged lines hidden ---