mirror of
https://github.com/qemu/qemu.git
synced 2024-12-04 17:23:39 +08:00
* Fix the "tsan-build" CI job on the shared gitlab CI runners
* Bump minimum glib version and use URI code from the newer glib * Fix error message from "configure" when C compiler is not working -----BEGIN PGP SIGNATURE----- iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmZDXcYRHHRodXRoQHJl ZGhhdC5jb20ACgkQLtnXdP5wLbVPJw//bK/NuMKOHlnwgowkQ/x41t8nc0jAR38+ aMhJBTSB+9EOlPd+/y7+IeFlD9lS2JzoX/CWeBrNlKc6juWQahABJYcvscmdGiYr a/dUy9iZoqJyY220TMjCWYwORRtNqPDXaiUIR8hBZZBmW51xs1hRc3aazxPm6dOD cj1yFKwWGY5g72SkRNTMWi3qWX1tXNOh7sbuhWKkZ3eiRCllHb0RwrhA341ze4TI ckmlSA6stMjls4XNAIAKVdRKLPE1BsJ/UKxpnOEO3F640cbe69B0+z13wIBNfTOY Mk3zSjrdLY6thSY+2iOb2FLt3wC5QCBjyRluv+0kwdSnz6xsafEDWNx5VneZH+Iu ZQWLGvN4qUUBBqHKY8eWnrsij3ABXioHLK8eHj2JuHidcG15tku/1cwAJvy/8P/O iup0elZ3MXaAk6ce3dwYY4t6QecuzqX9cdJkTuRNlzysK1xKQdBiYTdeZikfUAoM InuFUh732yPXDSiZcG+uMXUTAJXHWASr7bvPydDx/gL1tYGYBqYepfPF2uWYfNwg VZRgsN6WVDBGPyXv8Z7eQ9lye5JoAGYrSDxZE87q8RwRV5holiYDxtf10zeLz3Wf RI5L/bb2eFSHzi3quzOC1uLflLqNKwq+9UZEjdLv2z8zuhwVwxbcDV9+ox6zA8zi dnVC3Yp/3ik= =VRHz -----END PGP SIGNATURE----- Merge tag 'pull-request-2024-05-14' of https://gitlab.com/thuth/qemu into staging * Fix the "tsan-build" CI job on the shared gitlab CI runners * Bump minimum glib version and use URI code from the newer glib * Fix error message from "configure" when C compiler is not working # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmZDXcYRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbVPJw//bK/NuMKOHlnwgowkQ/x41t8nc0jAR38+ # aMhJBTSB+9EOlPd+/y7+IeFlD9lS2JzoX/CWeBrNlKc6juWQahABJYcvscmdGiYr # a/dUy9iZoqJyY220TMjCWYwORRtNqPDXaiUIR8hBZZBmW51xs1hRc3aazxPm6dOD # cj1yFKwWGY5g72SkRNTMWi3qWX1tXNOh7sbuhWKkZ3eiRCllHb0RwrhA341ze4TI # ckmlSA6stMjls4XNAIAKVdRKLPE1BsJ/UKxpnOEO3F640cbe69B0+z13wIBNfTOY # Mk3zSjrdLY6thSY+2iOb2FLt3wC5QCBjyRluv+0kwdSnz6xsafEDWNx5VneZH+Iu # ZQWLGvN4qUUBBqHKY8eWnrsij3ABXioHLK8eHj2JuHidcG15tku/1cwAJvy/8P/O # iup0elZ3MXaAk6ce3dwYY4t6QecuzqX9cdJkTuRNlzysK1xKQdBiYTdeZikfUAoM # InuFUh732yPXDSiZcG+uMXUTAJXHWASr7bvPydDx/gL1tYGYBqYepfPF2uWYfNwg # VZRgsN6WVDBGPyXv8Z7eQ9lye5JoAGYrSDxZE87q8RwRV5holiYDxtf10zeLz3Wf # RI5L/bb2eFSHzi3quzOC1uLflLqNKwq+9UZEjdLv2z8zuhwVwxbcDV9+ox6zA8zi # dnVC3Yp/3ik= # =VRHz # -----END PGP SIGNATURE----- # gpg: Signature made Tue 14 May 2024 02:49:10 PM CEST # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] * tag 'pull-request-2024-05-14' of https://gitlab.com/thuth/qemu: util/uri: Remove the old URI parsing code block/ssh: Use URI parsing code from glib block/nfs: Use URI parsing code from glib block/nbd: Use URI parsing code from glib block/gluster: Use URI parsing code from glib Remove glib compatibility code that is not required anymore Bump minimum glib version to v2.66 gitlab: use 'setarch -R' to workaround tsan bug gitlab: use $MAKE instead of 'make' dockerfiles: add 'MAKE' env variable to remaining containers configure: Fix error message when C compiler is not working Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
3d48b6b687
@ -26,10 +26,10 @@
|
||||
then
|
||||
pyvenv/bin/meson configure . -Dbackend_max_links="$LD_JOBS" ;
|
||||
fi || exit 1;
|
||||
- make -j"$JOBS"
|
||||
- $MAKE -j"$JOBS"
|
||||
- if test -n "$MAKE_CHECK_ARGS";
|
||||
then
|
||||
make -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
$MAKE -j"$JOBS" $MAKE_CHECK_ARGS ;
|
||||
fi
|
||||
- ccache --show-stats
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
- cd build
|
||||
- find . -type f -exec touch {} +
|
||||
# Avoid recompiling by hiding ninja with NINJA=":"
|
||||
- make NINJA=":" $MAKE_CHECK_ARGS
|
||||
- $MAKE NINJA=":" $MAKE_CHECK_ARGS
|
||||
|
||||
.native_test_job_template:
|
||||
extends: .common_test_job_template
|
||||
|
@ -575,6 +575,9 @@ tsan-build:
|
||||
CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++
|
||||
--enable-trace-backends=ust --disable-slirp
|
||||
TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
|
||||
# Remove when we switch to a distro with clang >= 18
|
||||
# https://github.com/google/sanitizers/issues/1716
|
||||
MAKE: setarch -R make
|
||||
|
||||
# gcov is a GCC features
|
||||
gcov:
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qemu/uri.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
@ -289,9 +288,9 @@ static void glfs_clear_preopened(glfs_t *fs)
|
||||
}
|
||||
}
|
||||
|
||||
static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path)
|
||||
static int parse_volume_options(BlockdevOptionsGluster *gconf, const char *path)
|
||||
{
|
||||
char *p, *q;
|
||||
const char *p, *q;
|
||||
|
||||
if (!path) {
|
||||
return -EINVAL;
|
||||
@ -349,13 +348,13 @@ static int parse_volume_options(BlockdevOptionsGluster *gconf, char *path)
|
||||
static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
|
||||
const char *filename)
|
||||
{
|
||||
g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL);
|
||||
g_autoptr(GHashTable) qp = NULL;
|
||||
SocketAddress *gsconf;
|
||||
URI *uri;
|
||||
QueryParams *qp = NULL;
|
||||
bool is_unix = false;
|
||||
int ret = 0;
|
||||
const char *uri_scheme, *uri_query, *uri_server;
|
||||
int uri_port, ret;
|
||||
|
||||
uri = uri_parse(filename);
|
||||
if (!uri) {
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -364,54 +363,54 @@ static int qemu_gluster_parse_uri(BlockdevOptionsGluster *gconf,
|
||||
QAPI_LIST_PREPEND(gconf->server, gsconf);
|
||||
|
||||
/* transport */
|
||||
if (!uri->scheme || !strcmp(uri->scheme, "gluster")) {
|
||||
uri_scheme = g_uri_get_scheme(uri);
|
||||
if (!uri_scheme || !strcmp(uri_scheme, "gluster")) {
|
||||
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
|
||||
} else if (!strcmp(uri->scheme, "gluster+tcp")) {
|
||||
} else if (!strcmp(uri_scheme, "gluster+tcp")) {
|
||||
gsconf->type = SOCKET_ADDRESS_TYPE_INET;
|
||||
} else if (!strcmp(uri->scheme, "gluster+unix")) {
|
||||
} else if (!strcmp(uri_scheme, "gluster+unix")) {
|
||||
gsconf->type = SOCKET_ADDRESS_TYPE_UNIX;
|
||||
is_unix = true;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = parse_volume_options(gconf, uri->path);
|
||||
ret = parse_volume_options(gconf, g_uri_get_path(uri));
|
||||
if (ret < 0) {
|
||||
goto out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
qp = query_params_parse(uri->query);
|
||||
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
uri_query = g_uri_get_query(uri);
|
||||
if (uri_query) {
|
||||
qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL);
|
||||
if (!qp) {
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = g_hash_table_size(qp);
|
||||
if (ret > 1 || (is_unix && !ret) || (!is_unix && ret)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
uri_server = g_uri_get_host(uri);
|
||||
uri_port = g_uri_get_port(uri);
|
||||
|
||||
if (is_unix) {
|
||||
if (uri->server || uri->port) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
char *uri_socket = g_hash_table_lookup(qp, "socket");
|
||||
if (uri_server || uri_port != -1 || !uri_socket) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (strcmp(qp->p[0].name, "socket")) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
gsconf->u.q_unix.path = g_strdup(qp->p[0].value);
|
||||
gsconf->u.q_unix.path = g_strdup(uri_socket);
|
||||
} else {
|
||||
gsconf->u.inet.host = g_strdup(uri->server ? uri->server : "localhost");
|
||||
if (uri->port) {
|
||||
gsconf->u.inet.port = g_strdup_printf("%d", uri->port);
|
||||
gsconf->u.inet.host = g_strdup(uri_server ? uri_server : "localhost");
|
||||
if (uri_port > 0) {
|
||||
gsconf->u.inet.port = g_strdup_printf("%d", uri_port);
|
||||
} else {
|
||||
gsconf->u.inet.port = g_strdup_printf("%d", GLUSTER_DEFAULT_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (qp) {
|
||||
query_params_free(qp);
|
||||
}
|
||||
uri_free(uri);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
|
||||
|
76
block/nbd.c
76
block/nbd.c
@ -31,7 +31,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include "trace.h"
|
||||
#include "qemu/uri.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/main-loop.h"
|
||||
@ -1514,30 +1513,31 @@ static void nbd_client_close(BlockDriverState *bs)
|
||||
|
||||
static int nbd_parse_uri(const char *filename, QDict *options)
|
||||
{
|
||||
URI *uri;
|
||||
g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL);
|
||||
g_autoptr(GHashTable) qp = NULL;
|
||||
const char *p;
|
||||
QueryParams *qp = NULL;
|
||||
int ret = 0;
|
||||
int qp_n;
|
||||
bool is_unix;
|
||||
const char *uri_scheme, *uri_query, *uri_server;
|
||||
int uri_port;
|
||||
|
||||
uri = uri_parse(filename);
|
||||
if (!uri) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* transport */
|
||||
if (!g_strcmp0(uri->scheme, "nbd")) {
|
||||
uri_scheme = g_uri_get_scheme(uri);
|
||||
if (!g_strcmp0(uri_scheme, "nbd")) {
|
||||
is_unix = false;
|
||||
} else if (!g_strcmp0(uri->scheme, "nbd+tcp")) {
|
||||
} else if (!g_strcmp0(uri_scheme, "nbd+tcp")) {
|
||||
is_unix = false;
|
||||
} else if (!g_strcmp0(uri->scheme, "nbd+unix")) {
|
||||
} else if (!g_strcmp0(uri_scheme, "nbd+unix")) {
|
||||
is_unix = true;
|
||||
} else {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
p = uri->path ? uri->path : "";
|
||||
p = g_uri_get_path(uri) ?: "";
|
||||
if (p[0] == '/') {
|
||||
p++;
|
||||
}
|
||||
@ -1545,52 +1545,50 @@ static int nbd_parse_uri(const char *filename, QDict *options)
|
||||
qdict_put_str(options, "export", p);
|
||||
}
|
||||
|
||||
qp = query_params_parse(uri->query);
|
||||
if (qp->n > 1 || (is_unix && !qp->n) || (!is_unix && qp->n)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
uri_query = g_uri_get_query(uri);
|
||||
if (uri_query) {
|
||||
qp = g_uri_parse_params(uri_query, -1, "&", G_URI_PARAMS_NONE, NULL);
|
||||
if (!qp) {
|
||||
return -EINVAL;
|
||||
}
|
||||
qp_n = g_hash_table_size(qp);
|
||||
if (qp_n > 1 || (is_unix && !qp_n) || (!is_unix && qp_n)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
uri_server = g_uri_get_host(uri);
|
||||
if (uri_server && !uri_server[0]) {
|
||||
uri_server = NULL;
|
||||
}
|
||||
uri_port = g_uri_get_port(uri);
|
||||
|
||||
if (is_unix) {
|
||||
/* nbd+unix:///export?socket=path */
|
||||
if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
const char *uri_socket = g_hash_table_lookup(qp, "socket");
|
||||
if (uri_server || uri_port != -1 || !uri_socket) {
|
||||
return -EINVAL;
|
||||
}
|
||||
qdict_put_str(options, "server.type", "unix");
|
||||
qdict_put_str(options, "server.path", qp->p[0].value);
|
||||
qdict_put_str(options, "server.path", uri_socket);
|
||||
} else {
|
||||
QString *host;
|
||||
char *port_str;
|
||||
|
||||
/* nbd[+tcp]://host[:port]/export */
|
||||
if (!uri->server) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* strip braces from literal IPv6 address */
|
||||
if (uri->server[0] == '[') {
|
||||
host = qstring_from_substr(uri->server, 1,
|
||||
strlen(uri->server) - 1);
|
||||
} else {
|
||||
host = qstring_from_str(uri->server);
|
||||
if (!uri_server) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
qdict_put_str(options, "server.type", "inet");
|
||||
qdict_put(options, "server.host", host);
|
||||
qdict_put_str(options, "server.host", uri_server);
|
||||
|
||||
port_str = g_strdup_printf("%d", uri->port ?: NBD_DEFAULT_PORT);
|
||||
port_str = g_strdup_printf("%d", uri_port > 0 ? uri_port
|
||||
: NBD_DEFAULT_PORT);
|
||||
qdict_put_str(options, "server.port", port_str);
|
||||
g_free(port_str);
|
||||
}
|
||||
|
||||
out:
|
||||
if (qp) {
|
||||
query_params_free(qp);
|
||||
}
|
||||
uri_free(uri);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool nbd_has_filename_options_conflict(QDict *options, Error **errp)
|
||||
|
108
block/nfs.c
108
block/nfs.c
@ -38,7 +38,6 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/uri.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "sysemu/replay.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
@ -79,77 +78,76 @@ typedef struct NFSRPC {
|
||||
|
||||
static int nfs_parse_uri(const char *filename, QDict *options, Error **errp)
|
||||
{
|
||||
URI *uri = NULL;
|
||||
QueryParams *qp = NULL;
|
||||
int ret = -EINVAL, i;
|
||||
g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL);
|
||||
GUriParamsIter qp;
|
||||
const char *uri_server, *uri_path, *uri_query;
|
||||
char *qp_name, *qp_value;
|
||||
GError *gerror = NULL;
|
||||
|
||||
uri = uri_parse(filename);
|
||||
if (!uri) {
|
||||
error_setg(errp, "Invalid URI specified");
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
if (g_strcmp0(uri->scheme, "nfs") != 0) {
|
||||
if (!g_str_equal(g_uri_get_scheme(uri), "nfs")) {
|
||||
error_setg(errp, "URI scheme must be 'nfs'");
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!uri->server) {
|
||||
uri_server = g_uri_get_host(uri);
|
||||
if (!uri_server || !uri_server[0]) {
|
||||
error_setg(errp, "missing hostname in URI");
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!uri->path) {
|
||||
uri_path = g_uri_get_path(uri);
|
||||
if (!uri_path || !uri_path[0]) {
|
||||
error_setg(errp, "missing file path in URI");
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
qp = query_params_parse(uri->query);
|
||||
if (!qp) {
|
||||
error_setg(errp, "could not parse query parameters");
|
||||
goto out;
|
||||
}
|
||||
|
||||
qdict_put_str(options, "server.host", uri->server);
|
||||
qdict_put_str(options, "server.host", uri_server);
|
||||
qdict_put_str(options, "server.type", "inet");
|
||||
qdict_put_str(options, "path", uri->path);
|
||||
qdict_put_str(options, "path", uri_path);
|
||||
|
||||
for (i = 0; i < qp->n; i++) {
|
||||
uint64_t val;
|
||||
if (!qp->p[i].value) {
|
||||
error_setg(errp, "Value for NFS parameter expected: %s",
|
||||
qp->p[i].name);
|
||||
goto out;
|
||||
}
|
||||
if (parse_uint_full(qp->p[i].value, 0, &val)) {
|
||||
error_setg(errp, "Illegal value for NFS parameter: %s",
|
||||
qp->p[i].name);
|
||||
goto out;
|
||||
}
|
||||
if (!strcmp(qp->p[i].name, "uid")) {
|
||||
qdict_put_str(options, "user", qp->p[i].value);
|
||||
} else if (!strcmp(qp->p[i].name, "gid")) {
|
||||
qdict_put_str(options, "group", qp->p[i].value);
|
||||
} else if (!strcmp(qp->p[i].name, "tcp-syncnt")) {
|
||||
qdict_put_str(options, "tcp-syn-count", qp->p[i].value);
|
||||
} else if (!strcmp(qp->p[i].name, "readahead")) {
|
||||
qdict_put_str(options, "readahead-size", qp->p[i].value);
|
||||
} else if (!strcmp(qp->p[i].name, "pagecache")) {
|
||||
qdict_put_str(options, "page-cache-size", qp->p[i].value);
|
||||
} else if (!strcmp(qp->p[i].name, "debug")) {
|
||||
qdict_put_str(options, "debug", qp->p[i].value);
|
||||
} else {
|
||||
error_setg(errp, "Unknown NFS parameter name: %s",
|
||||
qp->p[i].name);
|
||||
goto out;
|
||||
uri_query = g_uri_get_query(uri);
|
||||
if (uri_query) {
|
||||
g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE);
|
||||
while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) {
|
||||
uint64_t val;
|
||||
if (!qp_name || gerror) {
|
||||
error_setg(errp, "Failed to parse NFS parameter");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!qp_value) {
|
||||
error_setg(errp, "Value for NFS parameter expected: %s",
|
||||
qp_name);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (parse_uint_full(qp_value, 0, &val)) {
|
||||
error_setg(errp, "Invalid value for NFS parameter: %s",
|
||||
qp_name);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (g_str_equal(qp_name, "uid")) {
|
||||
qdict_put_str(options, "user", qp_value);
|
||||
} else if (g_str_equal(qp_name, "gid")) {
|
||||
qdict_put_str(options, "group", qp_value);
|
||||
} else if (g_str_equal(qp_name, "tcp-syncnt")) {
|
||||
qdict_put_str(options, "tcp-syn-count", qp_value);
|
||||
} else if (g_str_equal(qp_name, "readahead")) {
|
||||
qdict_put_str(options, "readahead-size", qp_value);
|
||||
} else if (g_str_equal(qp_name, "pagecache")) {
|
||||
qdict_put_str(options, "page-cache-size", qp_value);
|
||||
} else if (g_str_equal(qp_name, "debug")) {
|
||||
qdict_put_str(options, "debug", qp_value);
|
||||
} else {
|
||||
error_setg(errp, "Unknown NFS parameter name: %s", qp_name);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
out:
|
||||
if (qp) {
|
||||
query_params_free(qp);
|
||||
}
|
||||
uri_free(uri);
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool nfs_has_filename_options_conflict(QDict *options, Error **errp)
|
||||
|
73
block/ssh.c
73
block/ssh.c
@ -37,7 +37,6 @@
|
||||
#include "qemu/ctype.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/uri.h"
|
||||
#include "qapi/qapi-visit-sockets.h"
|
||||
#include "qapi/qapi-visit-block-core.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
@ -181,65 +180,71 @@ static void sftp_error_trace(BDRVSSHState *s, const char *op)
|
||||
|
||||
static int parse_uri(const char *filename, QDict *options, Error **errp)
|
||||
{
|
||||
URI *uri = NULL;
|
||||
QueryParams *qp;
|
||||
g_autoptr(GUri) uri = g_uri_parse(filename, G_URI_FLAGS_NONE, NULL);
|
||||
const char *uri_host, *uri_path, *uri_user, *uri_query;
|
||||
char *port_str;
|
||||
int i;
|
||||
int port;
|
||||
g_autoptr(GError) gerror = NULL;
|
||||
char *qp_name, *qp_value;
|
||||
GUriParamsIter qp;
|
||||
|
||||
uri = uri_parse(filename);
|
||||
if (!uri) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (g_strcmp0(uri->scheme, "ssh") != 0) {
|
||||
if (g_strcmp0(g_uri_get_scheme(uri), "ssh") != 0) {
|
||||
error_setg(errp, "URI scheme must be 'ssh'");
|
||||
goto err;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!uri->server || strcmp(uri->server, "") == 0) {
|
||||
uri_host = g_uri_get_host(uri);
|
||||
if (!uri_host || g_str_equal(uri_host, "")) {
|
||||
error_setg(errp, "missing hostname in URI");
|
||||
goto err;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!uri->path || strcmp(uri->path, "") == 0) {
|
||||
uri_path = g_uri_get_path(uri);
|
||||
if (!uri_path || g_str_equal(uri_path, "")) {
|
||||
error_setg(errp, "missing remote path in URI");
|
||||
goto err;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
qp = query_params_parse(uri->query);
|
||||
if (!qp) {
|
||||
error_setg(errp, "could not parse query parameters");
|
||||
goto err;
|
||||
uri_user = g_uri_get_user(uri);
|
||||
if (uri_user && !g_str_equal(uri_user, "")) {
|
||||
qdict_put_str(options, "user", uri_user);
|
||||
}
|
||||
|
||||
if(uri->user && strcmp(uri->user, "") != 0) {
|
||||
qdict_put_str(options, "user", uri->user);
|
||||
}
|
||||
qdict_put_str(options, "server.host", uri_host);
|
||||
|
||||
qdict_put_str(options, "server.host", uri->server);
|
||||
|
||||
port_str = g_strdup_printf("%d", uri->port ?: 22);
|
||||
port = g_uri_get_port(uri);
|
||||
port_str = g_strdup_printf("%d", port > 0 ? port : 22);
|
||||
qdict_put_str(options, "server.port", port_str);
|
||||
g_free(port_str);
|
||||
|
||||
qdict_put_str(options, "path", uri->path);
|
||||
qdict_put_str(options, "path", uri_path);
|
||||
|
||||
/* Pick out any query parameters that we understand, and ignore
|
||||
* the rest.
|
||||
*/
|
||||
for (i = 0; i < qp->n; ++i) {
|
||||
if (strcmp(qp->p[i].name, "host_key_check") == 0) {
|
||||
qdict_put_str(options, "host_key_check", qp->p[i].value);
|
||||
uri_query = g_uri_get_query(uri);
|
||||
if (uri_query) {
|
||||
g_uri_params_iter_init(&qp, uri_query, -1, "&", G_URI_PARAMS_NONE);
|
||||
while (g_uri_params_iter_next(&qp, &qp_name, &qp_value, &gerror)) {
|
||||
if (!qp_name || !qp_value || gerror) {
|
||||
warn_report("Failed to parse SSH URI parameters '%s'",
|
||||
uri_query);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Pick out the query parameters that we understand, and ignore
|
||||
* (or rather warn about) the rest.
|
||||
*/
|
||||
if (g_str_equal(qp_name, "host_key_check")) {
|
||||
qdict_put_str(options, "host_key_check", qp_value);
|
||||
} else {
|
||||
warn_report("Unsupported parameter '%s' in URI", qp_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query_params_free(qp);
|
||||
uri_free(uri);
|
||||
return 0;
|
||||
|
||||
err:
|
||||
uri_free(uri);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static bool ssh_has_filename_options_conflict(QDict *options, Error **errp)
|
||||
|
11
configure
vendored
11
configure
vendored
@ -411,7 +411,9 @@ else
|
||||
# Using uname is really broken, but it is just a fallback for architectures
|
||||
# that are going to use TCI anyway
|
||||
cpu=$(uname -m)
|
||||
echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
|
||||
if test "$host_os" != "bogus"; then
|
||||
echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Normalise host CPU name to the values used by Meson cross files and in source
|
||||
@ -894,6 +896,13 @@ EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Now that we are sure that the user did not only want to print the --help
|
||||
# information, we should double-check that the C compiler really works:
|
||||
write_c_skeleton
|
||||
if ! compile_object ; then
|
||||
error_exit "C compiler \"$cc\" either does not exist or does not work."
|
||||
fi
|
||||
|
||||
# Remove old dependency files to make sure that they get properly regenerated
|
||||
rm -f ./*/config-devices.mak.d
|
||||
|
||||
|
@ -19,12 +19,12 @@
|
||||
/* Ask for warnings for anything that was marked deprecated in
|
||||
* the defined version, or before. It is a candidate for rewrite.
|
||||
*/
|
||||
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_56
|
||||
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_66
|
||||
|
||||
/* Ask for warnings if code tries to use function that did not
|
||||
* exist in the defined version. These risk breaking builds
|
||||
*/
|
||||
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_56
|
||||
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_66
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
@ -105,29 +105,6 @@ static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size)
|
||||
}
|
||||
#define g_memdup2(m, s) g_memdup2_qemu(m, s)
|
||||
|
||||
#if defined(G_OS_UNIX)
|
||||
/*
|
||||
* Note: The fallback implementation is not MT-safe, and it returns a copy of
|
||||
* the libc passwd (must be g_free() after use) but not the content. Because of
|
||||
* these important differences the caller must be aware of, it's not #define for
|
||||
* GLib API substitution.
|
||||
*/
|
||||
static inline struct passwd *
|
||||
g_unix_get_passwd_entry_qemu(const gchar *user_name, GError **error)
|
||||
{
|
||||
#if GLIB_CHECK_VERSION(2, 64, 0)
|
||||
return g_unix_get_passwd_entry(user_name, error);
|
||||
#else
|
||||
struct passwd *p = getpwnam(user_name);
|
||||
if (!p) {
|
||||
g_set_error_literal(error, G_UNIX_ERROR, 0, g_strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
return (struct passwd *)g_memdup(p, sizeof(*p));
|
||||
#endif
|
||||
}
|
||||
#endif /* G_OS_UNIX */
|
||||
|
||||
static inline bool
|
||||
qemu_g_test_slow(void)
|
||||
{
|
||||
|
@ -1,99 +0,0 @@
|
||||
/**
|
||||
* Summary: library of generic URI related routines
|
||||
* Description: library of generic URI related routines
|
||||
* Implements RFC 2396
|
||||
*
|
||||
* Copyright (C) 1998-2003 Daniel Veillard. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name of Daniel Veillard shall not
|
||||
* be used in advertising or otherwise to promote the sale, use or other
|
||||
* dealings in this Software without prior written authorization from him.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
**
|
||||
* Copyright (C) 2007 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors:
|
||||
* Richard W.M. Jones <rjones@redhat.com>
|
||||
*
|
||||
* Utility functions to help parse and assemble query strings.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_URI_H
|
||||
#define QEMU_URI_H
|
||||
|
||||
/**
|
||||
* URI:
|
||||
*
|
||||
* A parsed URI reference. This is a struct containing the various fields
|
||||
* as described in RFC 2396 but separated for further processing.
|
||||
*/
|
||||
typedef struct URI {
|
||||
char *scheme; /* the URI scheme */
|
||||
char *opaque; /* opaque part */
|
||||
char *authority; /* the authority part */
|
||||
char *server; /* the server part */
|
||||
char *user; /* the user part */
|
||||
int port; /* the port number */
|
||||
char *path; /* the path string */
|
||||
char *fragment; /* the fragment identifier */
|
||||
int cleanup; /* parsing potentially unclean URI */
|
||||
char *query; /* the query string (as it appears in the URI) */
|
||||
} URI;
|
||||
|
||||
URI *uri_new(void);
|
||||
URI *uri_parse(const char *str);
|
||||
URI *uri_parse_raw(const char *str, int raw);
|
||||
int uri_parse_into(URI *uri, const char *str);
|
||||
char *uri_to_string(URI *uri);
|
||||
void uri_free(URI *uri);
|
||||
|
||||
/* Single web service query parameter 'name=value'. */
|
||||
typedef struct QueryParam {
|
||||
char *name; /* Name (unescaped). */
|
||||
char *value; /* Value (unescaped). */
|
||||
int ignore; /* Ignore this field in qparam_get_query */
|
||||
} QueryParam;
|
||||
|
||||
/* Set of parameters. */
|
||||
typedef struct QueryParams {
|
||||
int n; /* number of parameters used */
|
||||
int alloc; /* allocated space */
|
||||
QueryParam *p; /* array of parameters */
|
||||
} QueryParams;
|
||||
|
||||
QueryParams *query_params_new(int init_alloc);
|
||||
QueryParams *query_params_parse(const char *query);
|
||||
void query_params_free(QueryParams *ps);
|
||||
|
||||
#endif /* QEMU_URI_H */
|
16
meson.build
16
meson.build
@ -869,7 +869,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \
|
||||
|
||||
# When bumping glib minimum version, please check also whether to increase
|
||||
# the _WIN32_WINNT setting in osdep.h according to the value from glib
|
||||
glib_req_ver = '>=2.56.0'
|
||||
glib_req_ver = '>=2.66.0'
|
||||
glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
|
||||
method: 'pkg-config')
|
||||
glib_cflags = []
|
||||
@ -910,20 +910,6 @@ if not cc.compiles('''
|
||||
to the right pkg-config files for your build target.''')
|
||||
endif
|
||||
|
||||
# Silence clang warnings triggered by glib < 2.57.2
|
||||
if not cc.compiles('''
|
||||
#include <glib.h>
|
||||
typedef struct Foo {
|
||||
int i;
|
||||
} Foo;
|
||||
static void foo_free(Foo *f)
|
||||
{
|
||||
g_free(f);
|
||||
}
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free)
|
||||
int main(void) { return 0; }''', dependencies: glib_pc, args: ['-Wunused-function', '-Werror'])
|
||||
glib_cflags += cc.get_supported_arguments('-Wno-unused-function')
|
||||
endif
|
||||
glib = declare_dependency(dependencies: [glib_pc, gmodule],
|
||||
compile_args: glib_cflags,
|
||||
version: glib_pc.version())
|
||||
|
@ -36,7 +36,7 @@ test_get_passwd_entry(const gchar *user_name, GError **error)
|
||||
return p;
|
||||
}
|
||||
|
||||
#define g_unix_get_passwd_entry_qemu(username, err) \
|
||||
#define g_unix_get_passwd_entry(username, err) \
|
||||
test_get_passwd_entry(username, err)
|
||||
#endif
|
||||
|
||||
@ -46,7 +46,7 @@ get_passwd_entry(const char *username, Error **errp)
|
||||
g_autoptr(GError) err = NULL;
|
||||
struct passwd *p;
|
||||
|
||||
p = g_unix_get_passwd_entry_qemu(username, &err);
|
||||
p = g_unix_get_passwd_entry(username, &err);
|
||||
if (p == NULL) {
|
||||
error_setg(errp, "failed to lookup user '%s': %s",
|
||||
username, err->message);
|
||||
@ -243,7 +243,6 @@ qmp_guest_ssh_get_authorized_keys(const char *username, Error **errp)
|
||||
}
|
||||
|
||||
#ifdef QGA_BUILD_UNIT_TEST
|
||||
#if GLIB_CHECK_VERSION(2, 60, 0)
|
||||
static const strList test_key2 = {
|
||||
.value = (char *)"algo key2 comments"
|
||||
};
|
||||
@ -439,11 +438,4 @@ int main(int argc, char *argv[])
|
||||
|
||||
return g_test_run();
|
||||
}
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_test_message("test skipped, needs glib >= 2.60");
|
||||
return 0;
|
||||
}
|
||||
#endif /* GLIB_2_60 */
|
||||
#endif /* BUILD_UNIT_TEST */
|
||||
|
@ -68,6 +68,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools
|
||||
ENV DEF_TARGET_LIST aarch64-linux-user,arm-linux-user,hppa-linux-user,i386-linux-user,m68k-linux-user,mips-linux-user,mips64-linux-user,mips64el-linux-user,mipsel-linux-user,ppc-linux-user,ppc64-linux-user,ppc64le-linux-user,riscv64-linux-user,s390x-linux-user,sparc64-linux-user
|
||||
# As a final step configure the user (if env is defined)
|
||||
ENV MAKE /usr/bin/make
|
||||
ARG USER
|
||||
ARG UID
|
||||
RUN if [ "${USER}" ]; then \
|
||||
|
@ -45,6 +45,7 @@ ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
|
||||
|
||||
RUN curl -#SL "$TOOLCHAIN_URL" | tar -xJC "$TOOLCHAIN_INSTALL"
|
||||
ENV PATH $PATH:${TOOLCHAIN_INSTALL}/${TOOLCHAIN_BASENAME}/x86_64-linux-gnu/bin
|
||||
ENV MAKE /usr/bin/make
|
||||
# As a final step configure the user (if env is defined)
|
||||
ARG USER
|
||||
ARG UID
|
||||
|
@ -42,6 +42,7 @@ RUN /usr/bin/pip3 install tomli
|
||||
|
||||
ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools
|
||||
ENV DEF_TARGET_LIST alpha-linux-user,sh4-linux-user
|
||||
ENV MAKE /usr/bin/make
|
||||
# As a final step configure the user (if env is defined)
|
||||
ARG USER
|
||||
ARG UID
|
||||
|
@ -44,6 +44,7 @@ ENV LD_LIBRARY_PATH /opt/cross-tools/lib:/opt/cross-tools/loongarch64-unknown-li
|
||||
|
||||
ENV QEMU_CONFIGURE_OPTS --disable-system --disable-docs --disable-tools
|
||||
ENV DEF_TARGET_LIST loongarch64-linux-user,loongarch-softmmu
|
||||
ENV MAKE /usr/bin/make
|
||||
|
||||
# As a final step configure the user (if env is defined)
|
||||
ARG USER
|
||||
|
@ -44,6 +44,7 @@ RUN curl -#SL https://github.com/bkoppelmann/package_940/releases/download/trico
|
||||
# This image can only build a very minimal QEMU as well as the tests
|
||||
ENV DEF_TARGET_LIST tricore-softmmu
|
||||
ENV QEMU_CONFIGURE_OPTS --disable-user --disable-tools --disable-fdt
|
||||
ENV MAKE /usr/bin/make
|
||||
# As a final step configure the user (if env is defined)
|
||||
ARG USER
|
||||
ARG UID
|
||||
|
@ -27,6 +27,7 @@ RUN for cpu in $CPU_LIST; do \
|
||||
done
|
||||
|
||||
ENV PATH $PATH:/opt/$TOOLCHAIN_RELEASE/xtensa-dc232b-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dc233c-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-de233_fpu-elf/bin:/opt/$TOOLCHAIN_RELEASE/xtensa-dsp3400-elf/bin
|
||||
ENV MAKE /usr/bin/make
|
||||
# As a final step configure the user (if env is defined)
|
||||
ARG USER
|
||||
ARG UID
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
FROM registry.fedoraproject.org/fedora:33
|
||||
ENV PACKAGES gcc-cris-linux-gnu
|
||||
ENV MAKE /usr/bin/make
|
||||
RUN dnf install -y $PACKAGES
|
||||
RUN rpm -q $PACKAGES | sort > /packages.txt
|
||||
# As a final step configure the user (if env is defined)
|
||||
|
@ -172,18 +172,8 @@ static void print_loc(void)
|
||||
static char *
|
||||
real_time_iso8601(void)
|
||||
{
|
||||
#if GLIB_CHECK_VERSION(2,62,0)
|
||||
g_autoptr(GDateTime) dt = g_date_time_new_now_utc();
|
||||
/* ignore deprecation warning, since GLIB_VERSION_MAX_ALLOWED is 2.56 */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
return g_date_time_format_iso8601(dt);
|
||||
#pragma GCC diagnostic pop
|
||||
#else
|
||||
GTimeVal tv;
|
||||
g_get_current_time(&tv);
|
||||
return g_time_val_to_iso8601(&tv);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -93,7 +93,7 @@ if have_block
|
||||
util_ss.add(files('hbitmap.c'))
|
||||
util_ss.add(files('hexdump.c'))
|
||||
util_ss.add(files('iova-tree.c'))
|
||||
util_ss.add(files('iov.c', 'uri.c'))
|
||||
util_ss.add(files('iov.c'))
|
||||
util_ss.add(files('nvdimm-utils.c'))
|
||||
util_ss.add(files('block-helpers.c'))
|
||||
util_ss.add(files('qemu-coroutine-sleep.c'))
|
||||
|
1466
util/uri.c
1466
util/uri.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user