Merge io/ 2017-01-23
The following changes since commit 598cf1c805271564686f2d732b36f50c3c40dcdd:
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-01-20 16:42:07 +0000)
are available in the git repository at:
git://github.com/berrange/qemu tags/pull-qio-2017-01-23-1
for you to fetch changes up to 19f3cc22d364b57315e171090ee2e499b58775b4:
io: introduce a DNS resolver API (2017-01-23 11:28:09 +0000)
----------------------------------------------------------------
Merge io/ 2017-01-23
Daniel P. Berrange (8):
sockets: add ability to disable DNS resolution for InetSocketAddress
io: stop incrementing reference in qio_task_get_source
io: fix typo in docs for QIOTask
io: add ability to associate an opaque "result" with with a task
io: add ability to associate an error with a task
io: change the QIOTask callback signature
io: remove Error parameter from QIOTask thread worker
io: introduce a DNS resolver API
include/io/dns-resolver.h | 228 ++++++++++++++++++++++++++++++++++ include/io/task.h | 154 ++++++++++++++++------- include/qemu/sockets.h | 2 + io/Makefile.objs | 1 + io/channel-socket.c | 44 +++---- io/channel-tls.c | 16 +-- io/channel-websock.c | 8 +- io/dns-resolver.c | 272 +++++++++++++++++++++++++++++++++++++++++ io/task.c | 62 +++++++--- io/trace-events | 1 - migration/socket.c | 11 +- migration/tls.c | 19 +-- nbd/common.c | 8 +- nbd/nbd-internal.h | 3 +- qapi-schema.json | 5 + qemu-char.c | 18 +-- tests/test-io-channel-socket.c | 5 +- tests/test-io-channel-tls.c | 5 +- tests/test-io-task.c | 31 ++--- ui/vnc-auth-vencrypt.c | 7 +- ui/vnc-ws.c | 14 ++- util/qemu-sockets.c | 7 +- 22 files changed, 752 insertions(+), 169 deletions(-) create mode 100644 include/io/dns-resolver.h create mode 100644 io/dns-resolver.c
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 1/8] sockets: add ability to disable DNS resolution for InetSocketAddress
Add a 'numeric' flag to the InetSocketAddress struct to allow the caller to indicate that DNS should be skipped for the host/port fields. This is useful if the caller knows the address is already numeric and wants to guarantee no (potentially blocking) DNS lookups are attempted.
--- qapi-schema.json | 5 +++++ util/qemu-sockets.c | 3 +++ 2 files changed, 8 insertions(+)
qapi-schema.json +5 -0
@@ -3983,6 +3983,10 @@ # # @port: port part of the address, or lowest port if @to is present # +# @numeric: #optional true if the host/port are guaranteed to be numeric, +# false if name resolution should be attempted. Defaults to false. +# (Since 2.9) +# # @to: highest port to try # # @ipv4: whether to accept IPv4 addresses, default try both IPv4 and IPv6
@@ -3997,6 +4001,7 @@ 'data': { 'host': 'str', 'port': 'str', + '*numeric': 'bool', '*to': 'uint16', '*ipv4': 'bool', '*ipv6': 'bool' } }
util/qemu-sockets.c +3 -0
@@ -141,6 +141,9 @@ static int inet_listen_saddr(InetSocketAddress *saddr,memset (&ai,0 ,sizeof (ai)); ai.ai_flags =AI_PASSIVE ; +if (saddr->has_numeric && saddr->numeric) { + ai.ai_flags |=AI_NUMERICHOST |AI_NUMERICSERV ; + } ai.ai_family =inet_ai_family_from_address (saddr, &err); ai.ai_socktype =SOCK_STREAM ;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 2/8] io: stop incrementing reference in qio_task_get_source
In reply to Daniel P. BerrangeIncrementing the reference in qio_task_get_source is not necessary, since we're not running concurrently with any other code touching the QIOTask. This minimizes chances of further memory leaks.
--- include/io/task.h | 7 ++++--- io/channel-socket.c | 3 --- io/channel-tls.c | 2 -- io/task.c | 1 - tests/test-io-task.c | 1 - 5 files changed, 4 insertions(+), 10 deletions(-)
include/io/task.h +4 -3
@@ -244,9 +244,10 @@ void qio_task_abort(QIOTask *task,* @task: the task struct * * Get the source object associated with the background -* task. This returns a new reference to the object, -* which the caller must released with object_unref() -* when no longer required. +* task. The caller does not own a reference on the +* returned Object, and so should call object_ref() +* if it wants to keep the object pointer outside the +* lifetime of the QIOTask object. * * Returns: the source object */
io/channel-socket.c +0 -3
@@ -168,7 +168,6 @@ static int qio_channel_socket_connect_worker(QIOTask *task, addr, errp); -object_unref (OBJECT (ioc));return ret; }
@@ -231,7 +230,6 @@ static int qio_channel_socket_listen_worker(QIOTask *task, addr, errp); -object_unref (OBJECT (ioc));return ret; }
@@ -309,7 +307,6 @@ static int qio_channel_socket_dgram_worker(QIOTask *task, data->remoteAddr, errp); -object_unref (OBJECT (ioc));return ret; }
io/channel-tls.c +0 -2
@@ -200,8 +200,6 @@ static gboolean qio_channel_tls_handshake_io(QIOChannel *ioc,qio_channel_tls_handshake_task ( tioc, task); -object_unref (OBJECT (tioc)); -return FALSE; }
io/task.c +0 -1
@@ -156,6 +156,5 @@ void qio_task_abort(QIOTask *task,Object *qio_task_get_source (QIOTask *task) { -object_ref (task->source);return task->source; }
tests/test-io-task.c +0 -1
@@ -76,7 +76,6 @@ static void test_task_complete(void)g_assert (obj == src);object_unref (obj); -object_unref (src);g_assert (data.source == obj);g_assert (data.err ==NULL );
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 3/8] io: fix typo in docs for QIOTask
In reply to Daniel P. BerrangeThe GDestroyNotify parameter is already a pointer, so does not need a '*' suffix on the type.
--- include/io/task.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/io/task.h +3 -3
@@ -49,7 +49,7 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* void myobject_operation(QMyObject *obj, * QIOTaskFunc *func, * gpointer opaque, -* GDestroyNotify *notify); +* GDestroyNotify notify); * </programlisting> * </example> *
@@ -67,7 +67,7 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* void myobject_operation(QMyObject *obj, * QIOTaskFunc *func, * gpointer opaque, -* GDestroyNotify *notify) +* GDestroyNotify notify) * { * QIOTask *task; *
@@ -154,7 +154,7 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* SocketAddress *addr, * QIOTaskFunc *func, * gpointer opaque, -* GDestroyNotify *notify) +* GDestroyNotify notify) * { * QIOTask *task; * SocketAddress *addrCopy;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 4/8] io: add ability to associate an opaque "result" with with a task
In reply to Daniel P. BerrangeCurrently there is no data associated with a successful task completion. This adds an opaque pointer to the task to store an arbitrary result.
--- include/io/task.h | 27 +++++++++++++++++++++++++++ io/task.c | 20 ++++++++++++++++++++ 2 files changed, 47 insertions(+)
include/io/task.h +27 -0
@@ -240,6 +240,33 @@ void qio_task_abort(QIOTask *task,/** +* qio_task_set_result_pointer: +* @task: the task struct +* @result: pointer to the result data +* +* Associate an opaque result with the task, +* which can later be retrieved with the +* qio_task_get_result_pointer() method +* +*/ +void qio_task_set_result_pointer (QIOTask *task, +gpointer result, +GDestroyNotify notify); + + +/** +* qio_task_get_result_pointer: +* @task: the task struct +* +* Retrieve the opaque result data associated +* with the task, if any. +* +* Returns: the task result, or NULL +*/ +gpointer qio_task_get_result_pointer (QIOTask *task); + + +/** * qio_task_get_source: * @task: the task struct *
io/task.c +20 -0
@@ -29,6 +29,8 @@ struct QIOTask {QIOTaskFunc func;gpointer opaque;GDestroyNotify destroy; +gpointer result; +GDestroyNotify destroyResult; };
@@ -57,6 +59,9 @@ static void qio_task_free(QIOTask *task)if (task->destroy) { task->destroy (task->opaque); } +if (task->destroyResult) { + task->destroyResult (task->result); + }object_unref (task->source);g_free (task);
@@ -154,6 +159,21 @@ void qio_task_abort(QIOTask *task, } +void qio_task_set_result_pointer (QIOTask *task, +gpointer result, +GDestroyNotify destroy) +{ + task->result = result; + task->destroyResult = destroy; +} + + +gpointer qio_task_get_result_pointer (QIOTask *task) +{ +return task->result; +} + +Object *qio_task_get_source (QIOTask *task) {return task->source;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 5/8] io: add ability to associate an error with a task
In reply to Daniel P. BerrangeCurrently when a task fails, the error is never explicitly associated with the task object, it is just passed along through the completion callback. This adds the ability to explicitly associate an error with the task.
--- include/io/task.h | 32 ++++++++++++++++++++++++++++++++ io/task.c | 23 +++++++++++++++++++++++ 2 files changed, 55 insertions(+)
include/io/task.h +32 -0
@@ -240,6 +240,38 @@ void qio_task_abort(QIOTask *task,/** +* qio_task_set_error: +* @task: the task struct +* @err: pointer to the error, or NULL +* +* Associate an error with the task, which can later +* be retrieved with the qio_task_propagate_error() +* method. This method takes ownership of @err, so +* it is not valid to access it after this call +* completes. If @err is NULL this is a no-op. If +* this is call multiple times, only the first +* provided @err will be recorded, later ones will +* be discarded and freed. +*/ +void qio_task_set_error (QIOTask *task, +Error *err); + + +/** +* qio_task_propagate_error: +* @task: the task struct +* @errp: pointer to a NULL-initialized error object +* +* Propagate the error associated with @task +* into @errp. +* +* Returns: true if an error was propagated, false otherwise +*/ +bool qio_task_propagate_error (QIOTask *task, +Error **errp); + + +/** * qio_task_set_result_pointer: * @task: the task struct * @result: pointer to the result data
io/task.c +23 -0
@@ -29,6 +29,7 @@ struct QIOTask {QIOTaskFunc func;gpointer opaque;GDestroyNotify destroy; +Error *err;gpointer result;GDestroyNotify destroyResult; };
@@ -62,6 +63,9 @@ static void qio_task_free(QIOTask *task)if (task->destroyResult) { task->destroyResult (task->result); } +if (task->err) { +error_free (task->err); + }object_unref (task->source);g_free (task);
@@ -159,6 +163,25 @@ void qio_task_abort(QIOTask *task, } +void qio_task_set_error (QIOTask *task, +Error *err) +{ +error_propagate (&task->err, err); +} + + +bool qio_task_propagate_error (QIOTask *task, +Error **errp) +{ +if (task->err) { +error_propagate (errp, task->err); +return true; + } + +return false; +} + +void qio_task_set_result_pointer (QIOTask *task,gpointer result,GDestroyNotify destroy)
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 7/8] io: remove Error parameter from QIOTask thread worker
In reply to Daniel P. BerrangeNow that task objects have a directly associated error, there's no need for an an Error **errp parameter to the QIOTask thread worker function. It already has a QIOTask object, so can directly set the error on it.
--- include/io/task.h | 19 ++++++++----------- io/channel-socket.c | 41 ++++++++++++++++------------------------- io/task.c | 10 +--------- tests/test-io-task.c | 12 +++++------- 4 files changed, 30 insertions(+), 52 deletions(-)
include/io/task.h +8 -11
@@ -29,9 +29,8 @@ typedef struct QIOTask QIOTask;typedef void (*QIOTaskFunc )(QIOTask *task,gpointer opaque); -typedef int (*QIOTaskWorker )(QIOTask *task, -Error **errp, -gpointer opaque); +typedef void (*QIOTaskWorker )(QIOTask *task, +gpointer opaque);/** * QIOTask:
@@ -163,18 +162,16 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* socket listen using QIOTask would require: * * <example> -* static int myobject_listen_worker(QIOTask *task, -* Error **errp, -* gpointer opaque) +* static void myobject_listen_worker(QIOTask *task, +* gpointer opaque) * { * QMyObject obj = QMY_OBJECT(qio_task_get_source(task)); * SocketAddress *addr = opaque; +* Error *err = NULL; * -* obj->fd = socket_listen(addr, errp); -* if (obj->fd < 0) { -* return -1; -* } -* return 0; +* obj->fd = socket_listen(addr, &err); +* +qio_task_set_error(task, err); * } * * void myobject_listen_async(QMyObject *obj,
io/channel-socket.c +16 -25
75 lines not on this page · raw message
io/task.c +1 -9
@@ -77,8 +77,6 @@ struct QIOTaskThreadData {QIOTaskWorker worker;gpointer opaque;GDestroyNotify destroy; -Error *err; -int ret; };
@@ -87,9 +85,6 @@ static gboolean gio_task_thread_result(gpointer opaque)struct QIOTaskThreadData *data = opaque;trace_qio_task_thread_result (data->task); -if (data->err) { -qio_task_set_error (data->task, data->err); - }qio_task_complete (data->task);if (data->destroy) {
@@ -107,10 +102,7 @@ static gpointer qio_task_thread_worker(gpointer opaque)struct QIOTaskThreadData *data = opaque;trace_qio_task_thread_run (data->task); - data->ret = data->worker (data->task, &data->err, data->opaque); -if (data->ret <0 && data->err ==NULL ) { -error_setg (&data->err,"Task worker failed but did not set an error" ); - } + data->worker (data->task, data->opaque);/* We're running in the background thread, and must only * ever report the task results in the main event loop
tests/test-io-task.c +5 -7
@@ -140,20 +140,18 @@ struct TestThreadWorkerData {GMainLoop *loop; }; -static int test_task_thread_worker (QIOTask *task, -Error **errp, -gpointer opaque) +static void test_task_thread_worker (QIOTask *task, +gpointer opaque) {struct TestThreadWorkerData *data = opaque; data->worker =g_thread_self ();if (data->fail) { -error_setg (errp,"Testing fail" ); -return -1 ; +Error *err =NULL ; +error_setg (&err,"Testing fail" ); +qio_task_set_error (task, err); } - -return 0 ; }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 6/8] io: change the QIOTask callback signature
In reply to Daniel P. BerrangeCurrently the QIOTaskFunc signature takes an Object * for the source, and an Error * for any error. We also need to be able to provide a result pointer. Rather than continue to add parameters to QIOTaskFunc, remove the existing ones and simply pass the QIOTask object instead. This has methods to access all the other data items required in the callback impl.
--- include/io/task.h | 73 ++++++++++++++++++++++++------------------ io/channel-tls.c | 14 ++++---- io/channel-websock.c | 8 ++--- io/task.c | 18 +++-------- io/trace-events | 1 - migration/socket.c | 11 ++++--- migration/tls.c | 19 +++++------ nbd/common.c | 8 ++--- nbd/nbd-internal.h | 3 +- qemu-char.c | 18 ++++++----- tests/test-io-channel-socket.c | 5 ++- tests/test-io-channel-tls.c | 5 ++- tests/test-io-task.c | 18 +++++------ ui/vnc-auth-vencrypt.c | 7 ++-- ui/vnc-ws.c | 14 ++++---- 15 files changed, 110 insertions(+), 112 deletions(-)
include/io/task.h +42 -31
@@ -26,8 +26,7 @@typedef struct QIOTask QIOTask ; -typedef void (*QIOTaskFunc )(Object *source, -Error *err, +typedef void (*QIOTaskFunc )(QIOTask *task,gpointer opaque); typedef int (*QIOTaskWorker)(QIOTask *task,
@@ -44,7 +43,7 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* a public API which accepts a task callback: * * <example> -* <title>Task callback function signature</title> +* <title>Task function signature</title> * <programlisting> * void myobject_operation(QMyObject *obj, * QIOTaskFunc *func,
@@ -57,12 +56,36 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* is data to pass to it. The optional 'notify' function is used * to free 'opaque' when no longer needed. * -* Now, lets say the implementation of this method wants to set -* a timer to run once a second checking for completion of some -* activity. It would do something like +* When the operation completes, the 'func' callback will be +* invoked, allowing the calling code to determine the result +* of the operation. An example QIOTaskFunc implementation may +* look like * * <example> -* <title>Task callback function implementation</title> +* <title>Task callback implementation</title> +* <programlisting> +* static void myobject_operation_notify(QIOTask *task, +* gpointer opaque) +* { +* Error *err = NULL; +* if (qio_task_propagate_error(task, &err)) { +* ...deal with the failure... +* error_free(err); +* } else { +* QMyObject *src = QMY_OBJECT(qio_task_get_source(task)); +* ...deal with the completion... +* } +* } +* </programlisting> +* </example> +* +* Now, lets say the implementation of the method using the +* task wants to set a timer to run once a second checking +* for completion of some activity. It would do something +* like +* +* <example> +* <title>Task function implementation</title> * <programlisting> * void myobject_operation(QMyObject *obj, * QIOTaskFunc *func,
@@ -102,8 +125,8 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* * ...check something important... * if (err) { -* qio_task_abort(task, err); -* error_free(task); +* qio_task_set_error(task, err); +* qio_task_complete(task); * return FALSE; * } else if (...work is completed ...) { * qio_task_complete(task);
@@ -115,6 +138,10 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* </programlisting> * </example> * +* The 'qio_task_complete' call in this method will trigger +* the callback func 'myobject_operation_notify' shown +* earlier to deal with the results. +* * Once this function returns false, object_unref will be called * automatically on the task causing it to be released and the * ref on QMyObject dropped too.
@@ -187,8 +214,8 @@ typedef int (*QIOTaskWorker)(QIOTask *task,* 'err' attribute in the task object to determine if * the operation was successful or not. * -* The returned task will be released when one of -* qio_task_abort() or qio_task_complete() are invoked. +* The returned task will be released when qio_task_complete() +* is invoked. * * Returns: the task struct */
@@ -204,10 +231,8 @@ QIOTask *qio_task_new(Object *source,* @opaque: opaque data to pass to @worker * @destroy: function to free @opaque * -* Run a task in a background thread. If @worker -* returns 0 it will call qio_task_complete() in -* the main event thread context. If @worker -* returns -1 it will call qio_task_abort() in +* Run a task in a background thread. When @worker +* returns it will call qio_task_complete() in * the main event thread context. */ void qio_task_run_in_thread(QIOTask *task,
@@ -219,25 +244,11 @@ void qio_task_run_in_thread(QIOTask *task,* qio_task_complete: * @task: the task struct * -* Mark the operation as successfully completed -* and free the memory for @task. +* Invoke the completion callback for @task and +* then free its memory. */ void qio_task_complete (QIOTask *task); -/** -* qio_task_abort: -* @task: the task struct -* @err: the error to record for the operation -* -* Mark the operation as failed, with @err providing -* details about the failure. The @err may be freed -* afer the function returns, as the notification -* callback is invoked synchronously. The @task will -* be freed when this call completes. -*/ -void qio_task_abort (QIOTask *task, -Error *err); -/** * qio_task_set_error:
io/channel-tls.c +6 -8
@@ -153,8 +153,9 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,if (qcrypto_tls_session_handshake (ioc->session, &err) <0 ) {trace_qio_channel_tls_handshake_fail (ioc); -qio_task_abort (task, err); - goto cleanup; +qio_task_set_error (task, err); +qio_task_complete (task); +return ; } status =qcrypto_tls_session_get_handshake_status (ioc->session);
@@ -163,10 +164,10 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,if (qcrypto_tls_session_check_credentials (ioc->session, &err) <0 ) {trace_qio_channel_tls_credentials_deny (ioc); -qio_task_abort (task, err); - goto cleanup; +qio_task_set_error (task, err); + }else { +trace_qio_channel_tls_credentials_allow (ioc); } -trace_qio_channel_tls_credentials_allow (ioc);qio_task_complete (task); }else {GIOCondition condition;
@@ -183,9 +184,6 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc, task, NULL); } - - cleanup: -error_free (err); }
io/channel-websock.c +4 -4
@@ -279,8 +279,8 @@ static gboolean qio_channel_websock_handshake_send(QIOChannel *ioc,if (ret <0 ) {trace_qio_channel_websock_handshake_fail (ioc); -qio_task_abort (task, err); -error_free (err); +qio_task_set_error (task, err); +qio_task_complete (task);return FALSE; }
@@ -307,8 +307,8 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc, ret =qio_channel_websock_handshake_read (wioc, &err);if (ret <0 ) {trace_qio_channel_websock_handshake_fail (ioc); -qio_task_abort (task, err); -error_free (err); +qio_task_set_error (task, err); +qio_task_complete (task);return FALSE; }if (ret ==0 ) {
io/task.c +4 -14
@@ -87,13 +87,11 @@ static gboolean gio_task_thread_result(gpointer opaque)struct QIOTaskThreadData *data = opaque;trace_qio_task_thread_result (data->task); -if (data->ret ==0 ) { -qio_task_complete (data->task); - }else { -qio_task_abort (data->task, data->err); +if (data->err) { +qio_task_set_error (data->task, data->err); } +qio_task_complete (data->task); -error_free (data->err);if (data->destroy) { data->destroy (data->opaque); }
@@ -149,19 +147,11 @@ void qio_task_run_in_thread(QIOTask *task,void qio_task_complete (QIOTask *task) { - task->func (task->source,NULL , task->opaque); + task->func (task, task->opaque);trace_qio_task_complete (task);qio_task_free (task); } -void qio_task_abort (QIOTask *task, -Error *err) -{ - task->func (task->source, err, task->opaque); -trace_qio_task_abort (task); -qio_task_free (task); -} -void qio_task_set_error (QIOTask *task,Error *err)
io/trace-events +0 -1
@@ -3,7 +3,6 @@ # io/task.c qio_task_new(void *task, void *source, void *func, void *opaque) "Task new task=%p source=%p func=%p opaque=%p" qio_task_complete(void *task) "Task complete task=%p" -qio_task_abort(void *task) "Task abort task=%p" qio_task_thread_start(void *task, void *worker, void *opaque) "Task thread start task=%p worker=%p opaque=%p" qio_task_thread_run(void *task) "Task thread run task=%p" qio_task_thread_exit(void *task) "Task thread exit task=%p"
migration/socket.c +6 -5
@@ -70,22 +70,23 @@ static void socket_connect_data_free(void *opaque)g_free (data); } -static void socket_outgoing_migration (Object *src, -Error *err, +static void socket_outgoing_migration (QIOTask *task,gpointer opaque) {struct SocketConnectData *data = opaque; -QIOChannel *sioc =QIO_CHANNEL (src); +QIOChannel *sioc =QIO_CHANNEL (qio_task_get_source (task)); +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {trace_migration_socket_outgoing_error (error_get_pretty (err)); data->s->to_dst_file =NULL ;migrate_fd_error (data->s, err); +error_free (err); }else {trace_migration_socket_outgoing_connected (data->hostname);migration_channel_connect (data->s, sioc, data->hostname); } -object_unref (src); +object_unref (OBJECT (sioc)); } static void socket_start_outgoing_migration(MigrationState *s,
migration/tls.c +10 -9
@@ -61,15 +61,15 @@ migration_tls_get_creds(MigrationState *s, } -static void migration_tls_incoming_handshake (Object *src, -Error *err, +static void migration_tls_incoming_handshake (QIOTask *task,gpointer opaque) { -QIOChannel *ioc =QIO_CHANNEL (src); +QIOChannel *ioc =QIO_CHANNEL (qio_task_get_source (task)); +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {trace_migration_tls_incoming_handshake_error (error_get_pretty (err)); -error_report ("%s" ,error_get_pretty (err)); +error_report_err (err); }else {trace_migration_tls_incoming_handshake_complete ();migration_channel_process_incoming (migrate_get_current (), ioc);
@@ -107,17 +107,18 @@ void migration_tls_channel_process_incoming(MigrationState *s, } -static void migration_tls_outgoing_handshake (Object *src, -Error *err, +static void migration_tls_outgoing_handshake (QIOTask *task,gpointer opaque) {MigrationState *s = opaque; -QIOChannel *ioc =QIO_CHANNEL (src); +QIOChannel *ioc =QIO_CHANNEL (qio_task_get_source (task)); +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {trace_migration_tls_outgoing_handshake_error (error_get_pretty (err)); s->to_dst_file =NULL ;migrate_fd_error (s, err); +error_free (err); }else {trace_migration_tls_outgoing_handshake_complete ();migration_channel_connect (s, ioc,NULL );
nbd/common.c +3 -5
@@ -78,15 +78,13 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc, } -void nbd_tls_handshake (Object *src, -Error *err, +void nbd_tls_handshake (QIOTask *task,void *opaque) {struct NBDTLSHandshakeData *data = opaque; -if (err) { -TRACE ("TLS failed %s" ,error_get_pretty (err)); - data->error =error_copy (err); +if (qio_task_propagate_error (task, &data->error)) { +TRACE ("TLS failed %s" ,error_get_pretty (data->error)); } data->complete = true;g_main_loop_quit (data->loop);
nbd/nbd-internal.h +1 -2
@@ -120,8 +120,7 @@ struct NBDTLSHandshakeData { }; -void nbd_tls_handshake (Object *src, -Error *err, +void nbd_tls_handshake (QIOTask *task,void *opaque);#endif
qemu-char.c +10 -8
@@ -3277,14 +3277,13 @@ static void tcp_chr_telnet_init(CharDriverState *chr) } -static void tcp_chr_tls_handshake (Object *source, -Error *err, +static void tcp_chr_tls_handshake (QIOTask *task,gpointer user_data) {CharDriverState *chr = user_data;TCPCharDriver *s = chr->opaque; -if (err) { +if (qio_task_propagate_error (task,NULL )) {tcp_chr_disconnect (chr); }else {if (s->do_telnetopt) {
@@ -3492,20 +3491,23 @@ static void tcp_chr_free(CharDriverState *chr) } -static void qemu_chr_socket_connected (Object *src,Error *err,void *opaque) +static void qemu_chr_socket_connected (QIOTask *task,void *opaque) { -QIOChannelSocket *sioc =QIO_CHANNEL_SOCKET (src); +QIOChannelSocket *sioc =QIO_CHANNEL_SOCKET (qio_task_get_source (task));CharDriverState *chr = opaque;TCPCharDriver *s = chr->opaque; +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {check_report_connect_error (chr, err); -object_unref (src); -return ; +error_free (err); + goto cleanup; } s->connect_err_reported = false;tcp_chr_new_client (chr, sioc); + + cleanup:object_unref (OBJECT (sioc)); }
tests/test-io-channel-socket.c +2 -3
@@ -156,12 +156,11 @@ struct TestIOChannelData { }; -static void test_io_channel_complete (Object *src, -Error *err, +static void test_io_channel_complete (QIOTask *task,gpointer opaque) {struct TestIOChannelData *data = opaque; - data->err = err !=NULL ; + data->err =qio_task_propagate_error (task,NULL );g_main_loop_quit (data->loop); }
tests/test-io-channel-tls.c +2 -3
@@ -53,14 +53,13 @@ struct QIOChannelTLSHandshakeData {bool failed; }; -static void test_tls_handshake_done (Object *source, -Error *err, +static void test_tls_handshake_done (QIOTask *task,gpointer opaque) {struct QIOChannelTLSHandshakeData *data = opaque; data->finished = true; - data->failed = err !=NULL ; + data->failed =qio_task_propagate_error (task,NULL ); }
tests/test-io-task.c +8 -10
@@ -50,14 +50,13 @@ struct TestTaskData { }; -static void task_callback (Object *source, -Error *err, +static void task_callback (QIOTask *task,gpointer opaque) {struct TestTaskData *data = opaque; - data->source = source; - data->err = err; + data->source =qio_task_get_source (task); +qio_task_propagate_error (task, &data->err); }
@@ -120,9 +119,9 @@ static void test_task_failure(void)error_setg (&err,"Some error" ); -qio_task_abort (task, err); +qio_task_set_error (task, err); +qio_task_complete (task); -error_free (err);object_unref (obj);g_assert (data.source == obj);
@@ -158,14 +157,13 @@ static int test_task_thread_worker(QIOTask *task, } -static void test_task_thread_callback (Object *source, -Error *err, +static void test_task_thread_callback (QIOTask *task,gpointer opaque) {struct TestThreadWorkerData *data = opaque; - data->source = source; - data->err = err; + data->source =qio_task_get_source (task); +qio_task_propagate_error (task, &data->err); data->complete =g_thread_self ();
ui/vnc-auth-vencrypt.c +4 -3
@@ -65,16 +65,17 @@ static void start_auth_vencrypt_subauth(VncState *vs) } } -static void vnc_tls_handshake_done (Object *source, -Error *err, +static void vnc_tls_handshake_done (QIOTask *task,gpointer user_data) {VncState *vs = user_data; +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {VNC_DEBUG ("Handshake failed %s\n" ,error_get_pretty (err));vnc_client_error (vs); +error_free (err); }else { vs->ioc_tag =qio_channel_add_watch ( vs->ioc,G_IO_IN |G_IO_OUT , vnc_client_io, vs,NULL );
ui/vnc-ws.c +8 -6
@@ -24,15 +24,16 @@#include "io/channel-websock.h" #include "qemu/bswap.h" -static void vncws_tls_handshake_done (Object *source, -Error *err, +static void vncws_tls_handshake_done (QIOTask *task,gpointer user_data) {VncState *vs = user_data; +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {VNC_DEBUG ("Handshake failed %s\n" ,error_get_pretty (err));vnc_client_error (vs); +error_free (err); }else {VNC_DEBUG ("TLS handshake complete, starting websocket handshake\n" ); vs->ioc_tag = qio_channel_add_watch(
@@ -83,15 +84,16 @@ gboolean vncws_tls_handshake_io(QIOChannel *ioc G_GNUC_UNUSED, } -static void vncws_handshake_done (Object *source, -Error *err, +static void vncws_handshake_done (QIOTask *task,gpointer user_data) {VncState *vs = user_data; +Error *err =NULL ; -if (err) { +if (qio_task_propagate_error (task, &err)) {VNC_DEBUG ("Websock handshake failed %s\n" ,error_get_pretty (err));vnc_client_error (vs); +error_free (err); }else {VNC_DEBUG ("Websock handshake complete, starting VNC protocol\n" );vnc_start_protocol (vs);
Signature · 1 line
2.9.3
[Qemu-devel] [PULL v1 8/8] io: introduce a DNS resolver API
In reply to Daniel P. BerrangeCurrently DNS resolution is done automatically as part of the creation of a QIOChannelSocket object instance. This works ok for network clients where you just end up a single network socket, but for servers, the results of DNS resolution may require creation of multiple sockets.
Introducing a DNS resolver API allows DNS resolution to be separated from the socket object creation. This will make it practical to create multiple QIOChannelSocket instances for servers.
--- include/io/dns-resolver.h | 228 ++++++++++++++++++++++++++++++++++++++ include/qemu/sockets.h | 2 + io/Makefile.objs | 1 + io/dns-resolver.c | 272 ++++++++++++++++++++++++++++++++++++++++++++++ util/qemu-sockets.c | 4 +- 5 files changed, 505 insertions(+), 2 deletions(-) create mode 100644 include/io/dns-resolver.h create mode 100644 io/dns-resolver.c
include/io/dns-resolver.h new file +228 -0
@@ -0,0 +1,228 @@ +/* +* QEMU DNS resolver +* +* Copyright (c) 2016-2017 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 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 <http://www.gnu.org/licenses/>. +* +*/ + +#ifndef QIO_DNS_RESOLVER_H +#define QIO_DNS_RESOLVER_H + +#include "qemu-common.h" +#include "qom/object.h" +#include "io/task.h" + +#define TYPE_QIO_DNS_RESOLVER "qio-dns-resolver" +#define QIO_DNS_RESOLVER (obj) \ + OBJECT_CHECK(QIODNSResolver, (obj), TYPE_QIO_DNS_RESOLVER) +#define QIO_DNS_RESOLVER_CLASS (klass) \ + OBJECT_CLASS_CHECK(QIODNSResolverClass, klass, TYPE_QIO_DNS_RESOLVER) +#define QIO_DNS_RESOLVER_GET_CLASS (obj) \ + OBJECT_GET_CLASS(QIODNSResolverClass, obj, TYPE_QIO_DNS_RESOLVER) + +typedef struct QIODNSResolver QIODNSResolver ; +typedef struct QIODNSResolverClass QIODNSResolverClass ; + +/** +* QIODNSResolver: +* +* The QIODNSResolver class provides a framework for doing +* DNS resolution on SocketAddress objects, independently +* of socket creation. +* +* <example> +* <title>Resolving addresses synchronously</title> +* <programlisting> +* int mylisten(SocketAddress *addr, Error **errp) { +* QIODNSResolver *resolver = qio_dns_resolver_get_instance(); +* SocketAddress **rawaddrs = NULL; +* size_t nrawaddrs = 0; +* Error *err = NULL; +* QIOChannel **socks = NULL; +* size_t nsocks = 0; +* +* if (qio_dns_resolver_lookup_sync(dns, addr, &nrawaddrs, +* &rawaddrs, errp) < 0) { +* return -1; +* } +* +* for (i = 0; i < nrawaddrs; i++) { +* QIOChannel *sock = qio_channel_new(); +* Error *local_err = NULL; +* qio_channel_listen_sync(sock, rawaddrs[i], &local_err); +* if (local_err) { +* error_propagate(&err, local_err); +* } else { +* socks = g_renew(QIOChannelSocket *, socks, nsocks + 1); +* socks[nsocks++] = sock; +* } +* qapi_free_SocketAddress(rawaddrs[i]); +* } +* g_free(rawaddrs); +* +* if (nsocks == 0) { +* error_propagate(errp, err); +* } else { +* error_free(err); +* } +* } +* </programlisting> +* </example> +* +* <example> +* <title>Resolving addresses asynchronously</title> +* <programlisting> +* typedef struct MyListenData { +* Error *err; +* QIOChannelSocket **socks; +* size_t nsocks; +* } MyListenData; +* +* void mylistenresult(QIOTask *task, void *opaque) { +* MyListenData *data = opaque; +* QIODNSResolver *resolver = +* QIO_DNS_RESOLVER(qio_task_get_source(task); +* SocketAddress **rawaddrs = NULL; +* size_t nrawaddrs = 0; +* Error *err = NULL; +* +* if (qio_task_propagate_error(task, &data->err)) { +* return; +* } +* +* qio_dns_resolver_lookup_result(resolver, task, +* &nrawaddrs, &rawaddrs); +* +* for (i = 0; i < nrawaddrs; i++) { +* QIOChannel *sock = qio_channel_new(); +* Error *local_err = NULL; +* qio_channel_listen_sync(sock, rawaddrs[i], &local_err); +* if (local_err) { +* error_propagate(&err, local_err); +* } else { +* socks = g_renew(QIOChannelSocket *, socks, nsocks + 1); +* socks[nsocks++] = sock; +* } +* qapi_free_SocketAddress(rawaddrs[i]); +* } +* g_free(rawaddrs); +* +* if (nsocks == 0) { +* error_propagate(&data->err, err); +* } else { +* error_free(err); +* } +* } +* +* void mylisten(SocketAddress *addr, MyListenData *data) { +* QIODNSResolver *resolver = qio_dns_resolver_get_instance(); +* qio_dns_resolver_lookup_async(dns, addr, +* mylistenresult, data, NULL); +* } +* </programlisting> +* </example> +*/ +struct QIODNSResolver { +Object parent; +}; + +struct QIODNSResolverClass { +ObjectClass parent; +}; + + +/** +* qio_dns_resolver_get_instance: +* +* Get the singleton dns resolver instance. The caller +* does not own a reference on the returned object. +* +* Returns: the single dns resolver instance +*/ +QIODNSResolver *qio_dns_resolver_get_instance (void ); + +/** +* qio_dns_resolver_lookup_sync: +* @resolver: the DNS resolver instance +* @addr: the address to resolve +* @naddr: pointer to hold number of resolved addresses +* @addrs: pointer to hold resolved addresses +* @errp: pointer to NULL initialized error object +* +* This will attempt to resolve the address provided +* in @addr. If resolution succeeds, @addrs will be filled +* with all the resolved addresses. @naddrs will specify +* the number of entries allocated in @addrs. The caller +* is responsible for freeing each entry in @addrs, as +* well as @addrs itself. @naddrs is guaranteed to be +* greater than zero on success. +* +* DNS resolution will be done synchronously so execution +* of the caller may be blocked for an arbitrary length +* of time. +* +* Returns: 0 if resolution was successful, -1 on error +*/ +int qio_dns_resolver_lookup_sync (QIODNSResolver *resolver, +SocketAddress *addr, +size_t *naddrs, +SocketAddress ***addrs, +Error **errp); + +/** +* qio_dns_resolver_lookup_async: +* @resolver: the DNS resolver instance +* @addr: the address to resolve +* @func: the callback to invoke on lookup completion +* @opaque: data blob to pass to @func +* @notify: the callback to free @opaque, or NULL +* +* This will attempt to resolve the address provided +* in @addr. The callback @func will be invoked when +* resolution has either completed or failed. On +* success, the @func should call the method +* qio_dns_resolver_lookup_result() to obtain the +* results. +* +* DNS resolution will be done asynchronously so execution +* of the caller will not be blocked. +*/ +void qio_dns_resolver_lookup_async (QIODNSResolver *resolver, +SocketAddress *addr, +QIOTaskFunc func, +gpointer opaque, +GDestroyNotify notify); + +/** +* qio_dns_resolver_lookup_result: +* @resolver: the DNS resolver instance +* @task: the task object to get results for +* @naddr: pointer to hold number of resolved addresses +* @addrs: pointer to hold resolved addresses +* +* This method should be called from the callback passed +* to qio_dns_resolver_lookup_async() in order to obtain +* results. @addrs will be filled with all the resolved +* addresses. @naddrs will specify the number of entries +* allocated in @addrs. The caller is responsible for +* freeing each entry in @addrs, as well as @addrs itself. +*/ +void qio_dns_resolver_lookup_result (QIODNSResolver *resolver, +QIOTask *task, +size_t *naddrs, +SocketAddress ***addrs); + +#endif /* QIO_DNS_RESOLVER_H */
include/qemu/sockets.h +2 -0
@@ -32,6 +32,8 @@ int socket_set_fast_reuse(int fd);*/ typedef void NonBlockingConnectHandler (int fd,Error *err,void *opaque); +int inet_ai_family_from_address (InetSocketAddress *addr, +Error **errp);InetSocketAddress *inet_parse (const char *str,Error **errp);int inet_connect (const char *str,Error **errp); int inet_connect_saddr(InetSocketAddress *saddr, Error **errp,
io/Makefile.objs +1 -0
@@ -7,4 +7,5 @@ io-obj-y += channel-tls.o io-obj-y += channel-watch.o io-obj-y += channel-websock.o io-obj-y += channel-util.o +io-obj-y += dns-resolver.o io-obj-y += task.o
io/dns-resolver.c new file +272 -0
272 lines not on this page · raw message
util/qemu-sockets.c +2 -2
@@ -110,8 +110,8 @@ NetworkAddressFamily inet_netfamily(int family)* outside scope of this method and not currently handled by * callers at all. */ -static int inet_ai_family_from_address (InetSocketAddress *addr, -Error **errp) +int inet_ai_family_from_address (InetSocketAddress *addr, +Error **errp) {if (addr->has_ipv6 && addr->has_ipv4 && !addr->ipv6 && !addr->ipv4) {
Signature · 1 line
2.9.3
Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.
Hi,
Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.
Type: series
Subject: [Qemu-devel] [PULL v1 0/8] Merge io/ 2017-01-23
Message-id: [email protected]
=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=16
make docker-test-quick@centos6
make docker-test-mingw@fedora
make docker-test-build@min-glib
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
2507f92 io: introduce a DNS resolver API
a9041b1 io: remove Error parameter from QIOTask thread worker b153035 io: change the QIOTask callback signature
47fb88c io: add ability to associate an error with a task 18cafca io: add ability to associate an opaque "result" with with a task cd796ca io: fix typo in docs for QIOTask
5bd5c07 io: stop incrementing reference in qio_task_get_source dcfe0d8 sockets: add ability to disable DNS resolution for InetSocketAddress
=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
BUILD centos6
make[1]: Entering directory `/var/tmp/patchew-tester-tmp-4hvaqwpc/src'
ARCHIVE qemu.tgz
ARCHIVE dtc.tgz
COPY RUNNER
RUN test-quick in qemu:centos6
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
ccache-3.1.6-2.el6.x86_64
epel-release-6-8.noarch
gcc-4.4.7-17.el6.x86_64
git-1.7.1-4.el6_7.1.x86_64
glib2-devel-2.28.8-5.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
make-3.81-23.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
tar-1.23-15.el6_8.x86_64
zlib-devel-1.2.3-29.el6.x86_64
Environment variables:
PACKAGES=libfdt-devel ccache tar git make gcc g++ zlib-devel glib2-devel SDL-devel pixman-devel epel-release
HOSTNAME=c16d637ed4ae
TERM=xterm
MAKEFLAGS= -j16
HISTSIZE=1000
J=16
USER=root
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env
Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/var/tmp/qemu-build/install No C++ compiler available; disabling C++ specific optional code
Install prefix /var/tmp/qemu-build/install BIOS directory /var/tmp/qemu-build/install/share/qemu binary directory /var/tmp/qemu-build/install/bin
library directory /var/tmp/qemu-build/install/lib module directory /var/tmp/qemu-build/install/lib/qemu libexec directory /var/tmp/qemu-build/install/libexec include directory /var/tmp/qemu-build/install/include config directory /var/tmp/qemu-build/install/etc
local state directory /var/tmp/qemu-build/install/var
Manual directory /var/tmp/qemu-build/install/share/man ELF interp prefix /usr/gnemul/qemu-%M
Source path /tmp/qemu-test/src C compiler cc Host C compiler cc C++ compiler Objective-C compiler cc ARFLAGS rv CFLAGS -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g QEMU_CFLAGS -I/usr/include/pixman-1 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all LDFLAGS -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g make make install install python python -B smbd /usr/sbin/smbd module support no host CPU x86_64 host big endian no target list x86_64-softmmu aarch64-softmmu tcg debug enabled no gprof enabled no sparse enabled no strip binaries yes profiler no static build no pixman system SDL support yes (1.2.14) GTK support no GTK GL support no VTE support no TLS priority NORMAL GNUTLS support no GNUTLS rnd no libgcrypt no libgcrypt kdf no nettle no nettle kdf no libtasn1 no curses support no virgl support no curl support no mingw32 support no Audio drivers oss Block whitelist (rw) Block whitelist (ro) VirtFS support no VNC support yes VNC SASL support no VNC JPEG support no VNC PNG support no xen support no brlapi support no bluez support no Documentation no PIE yes vde support no netmap support no Linux AIO support no ATTR/XATTR support yes Install blobs yes KVM support yes HAX support no RDMA support no TCG interpreter no fdt support yes preadv support yes fdatasync yes madvise yes posix_madvise yes
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
vhost-vsock support yes
Trace backends log spice support no rbd support no xfsctl support no smartcard support no libusb no usb net redir no OpenGL support no OpenGL dmabufs no libiscsi support no libnfs support no
build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
debug stack usage no
GlusterFS support no
Archipelago support no
gcov gcov gcov enabled no TPM support yes libssh2 support no TPM passthrough yes QOM debugging yes lzo support no snappy support no bzip2 support no
NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization no
replication support yes
GEN x86_64-softmmu/config-devices.mak.tmp GEN aarch64-softmmu/config-devices.mak.tmp GEN config-host.h GEN qemu-options.def GEN qmp-commands.h GEN qapi-types.h GEN qapi-visit.h GEN qapi-event.h GEN qmp-introspect.h GEN module_block.h GEN tests/test-qapi-types.h GEN tests/test-qmp-commands.h GEN tests/test-qapi-visit.h GEN tests/test-qapi-event.h GEN tests/test-qmp-introspect.h GEN trace/generated-tracers.h GEN x86_64-softmmu/config-devices.mak GEN aarch64-softmmu/config-devices.mak GEN trace/generated-tcg-tracers.h GEN trace/generated-helpers-wrappers.h GEN trace/generated-helpers.h GEN config-all-devices.mak CC tests/qemu-iotests/socket_scm_helper.o GEN qga/qapi-generated/qga-qapi-types.h GEN qga/qapi-generated/qga-qapi-visit.h GEN qga/qapi-generated/qga-qmp-commands.h GEN qga/qapi-generated/qga-qapi-types.c GEN qga/qapi-generated/qga-qapi-visit.c GEN qapi-visit.c GEN qga/qapi-generated/qga-qmp-marshal.c GEN qmp-introspect.c GEN qapi-types.c GEN qapi-event.c CC qapi/qapi-visit-core.o CC qapi/qapi-dealloc-visitor.o CC qapi/qobject-input-visitor.o CC qapi/qobject-output-visitor.o CC qapi/qmp-registry.o CC qapi/qmp-dispatch.o CC qapi/string-input-visitor.o CC qapi/string-output-visitor.o CC qapi/qmp-event.o CC qapi/opts-visitor.o CC qapi/qapi-util.o CC qapi/qapi-clone-visitor.o CC qobject/qnull.o CC qobject/qint.o CC qobject/qstring.o CC qobject/qdict.o CC qobject/qlist.o CC qobject/qfloat.o CC qobject/qbool.o CC qobject/qjson.o CC qobject/qobject.o CC qobject/json-lexer.o CC qobject/json-streamer.o CC qobject/json-parser.o GEN trace/generated-tracers.c CC trace/control.o CC trace/qmp.o CC util/osdep.o CC util/cutils.o CC util/unicode.o CC util/qemu-timer-common.o CC util/bufferiszero.o CC util/lockcnt.o CC util/compatfd.o CC util/event_notifier-posix.o CC util/mmap-alloc.o CC util/oslib-posix.o CC util/qemu-openpty.o CC util/qemu-thread-posix.o CC util/memfd.o CC util/envlist.o CC util/path.o CC util/module.o CC util/bitmap.o CC util/bitops.o CC util/fifo8.o CC util/hbitmap.o CC util/acl.o CC util/error.o CC util/qemu-error.o CC util/id.o CC util/iov.o CC util/qemu-config.o CC util/qemu-sockets.o CC util/uri.o CC util/notify.o CC util/qemu-option.o CC util/qemu-progress.o CC util/hexdump.o CC util/crc32c.o CC util/uuid.o CC util/throttle.o CC util/getauxval.o CC util/readline.o CC util/rcu.o CC util/qemu-coroutine.o CC util/qemu-coroutine-lock.o CC util/qemu-coroutine-io.o CC util/qemu-coroutine-sleep.o CC util/coroutine-ucontext.o CC util/buffer.o CC util/timed-average.o CC util/base64.o CC util/log.o CC util/qdist.o CC util/qht.o CC util/range.o CC crypto/pbkdf-stub.o CC stubs/arch-query-cpu-def.o CC stubs/arch-query-cpu-model-expansion.o CC stubs/arch-query-cpu-model-comparison.o CC stubs/arch-query-cpu-model-baseline.o CC stubs/bdrv-next-monitor-owned.o CC stubs/blk-commit-all.o CC stubs/blockdev-close-all-bdrv-states.o CC stubs/clock-warp.o CC stubs/cpu-get-clock.o CC stubs/cpu-get-icount.o CC stubs/dump.o CC stubs/error-printf.o CC stubs/fdset.o CC stubs/gdbstub.o CC stubs/iothread.o CC stubs/get-vm-name.o CC stubs/iothread-lock.o CC stubs/is-daemonized.o CC stubs/machine-init-done.o CC stubs/migr-blocker.o CC stubs/monitor.o CC stubs/notify-event.o CC stubs/qtest.o CC stubs/replay.o CC stubs/runstate-check.o CC stubs/set-fd-handler.o CC stubs/slirp.o CC stubs/sysbus.o CC stubs/trace-control.o CC stubs/uuid.o CC stubs/vm-stop.o CC stubs/vmstate.o CC stubs/qmp_pc_dimm_device_list.o CC stubs/target-monitor-defs.o CC stubs/target-get-monitor-def.o CC stubs/pc_madt_cpu_entry.o CC contrib/ivshmem-client/ivshmem-client.o CC contrib/ivshmem-client/main.o CC contrib/ivshmem-server/ivshmem-server.o CC contrib/ivshmem-server/main.o CC qemu-nbd.o CC async.o CC thread-pool.o CC block.o CC blockjob.o CC main-loop.o CC iohandler.o CC qemu-timer.o CC aio-posix.o CC qemu-io-cmds.o CC replication.o CC block/raw-format.o CC block/qcow.o CC block/vdi.o CC block/vmdk.o CC block/cloop.o CC block/bochs.o CC block/vpc.o CC block/vvfat.o CC block/dmg.o CC block/qcow2.o CC block/qcow2-refcount.o CC block/qcow2-cluster.o CC block/qcow2-snapshot.o CC block/qcow2-cache.o CC block/qed.o CC block/qed-gencb.o CC block/qed-l2-cache.o CC block/qed-table.o CC block/qed-cluster.o CC block/qed-check.o CC block/vhdx.o CC block/vhdx-endian.o CC block/vhdx-log.o CC block/quorum.o CC block/parallels.o CC block/blkdebug.o CC block/blkverify.o CC block/blkreplay.o CC block/block-backend.o CC block/snapshot.o CC block/qapi.o CC block/file-posix.o CC block/null.o CC block/mirror.o CC block/commit.o CC block/io.o CC block/throttle-groups.o CC block/nbd.o CC block/nbd-client.o CC block/sheepdog.o CC block/accounting.o CC block/dirty-bitmap.o CC block/write-threshold.o CC block/backup.o CC block/replication.o CC block/crypto.o CC nbd/server.o CC nbd/client.o CC nbd/common.o CC crypto/init.o CC crypto/hash.o CC crypto/hash-glib.o CC crypto/hmac.o CC crypto/hmac-glib.o CC crypto/aes.o CC crypto/desrfb.o CC crypto/cipher.o CC crypto/tlscreds.o CC crypto/tlscredsanon.o CC crypto/tlscredsx509.o CC crypto/tlssession.o CC crypto/secret.o CC crypto/random-platform.o CC crypto/pbkdf.o CC crypto/ivgen.o CC crypto/ivgen-essiv.o CC crypto/ivgen-plain.o CC crypto/ivgen-plain64.o CC crypto/afsplit.o CC crypto/xts.o CC crypto/block.o CC crypto/block-qcow.o CC crypto/block-luks.o CC io/channel.o CC io/channel-buffer.o CC io/channel-command.o CC io/channel-file.o CC io/channel-socket.o CC io/channel-tls.o CC io/channel-watch.o CC io/channel-websock.o CC io/channel-util.o CC io/dns-resolver.o CC io/task.o CC qom/object.o CC qom/container.o CC qom/qom-qobject.o CC qom/object_interfaces.o GEN qemu-img-cmds.h CC qemu-io.o CC qemu-bridge-helper.o CC blockdev.o CC blockdev-nbd.o
/tmp/qemu-test/src/io/dns-resolver.c:30: error: ‘PTHREAD_ONCE_INIT’ undeclared here (not in a function) /tmp/qemu-test/src/io/dns-resolver.c: In function ‘qio_dns_resolver_get_instance’:/tmp/qemu-test/src/io/dns-resolver.c:39: warning: implicit declaration of function ‘pthread_once’ /tmp/qemu-test/src/io/dns-resolver.c:39: warning: nested extern declaration of ‘pthread_once’
make: *** [io/dns-resolver.o] Error 1
make: *** Waiting for unfinished jobs....
make[1]: *** [docker-run] Error 2
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-4hvaqwpc/src'
make: *** [docker-run-test-quick@centos6] Error 2
=== OUTPUT END ===
Test command exited with code: 2
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]
Quoted 15 lines · Daniel P. Berrange
The following changes since commit
598cf1c805271564686f2d732b36f50c3c40dcdd:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-01-20 16:42:07 +0000)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-qio-2017-01-23-1for you to fetch changes up to
19f3cc22d364b57315e171090ee2e499b58775b4:io: introduce a DNS resolver API (2017-01-23 11:28:09 +0000)
----------------------------------------------------------------
Merge io/ 2017-01-23
Quoted 9 lines
Daniel P. Berrange (8):
sockets: add ability to disable DNS resolution for InetSocketAddress
io: stop incrementing reference inqio_task_get_source
io: fix typo in docs for QIOTask
io: add ability to associate an opaque "result" with with a task
io: add ability to associate an error with a task
io: change the QIOTask callback signature
io: remove Error parameter from QIOTask thread worker
io: introduce a DNS resolver API
Fails to build, OSX:
/Users/pm215/src/qemu-for-merges/io/dns-resolver.c:30:39: error: use of undeclared identifier 'PTHREAD_ONCE_INIT'
static pthread_once_t instance_init = PTHREAD_ONCE_INIT;
^
/Users/pm215/src/qemu-for-merges/io/dns-resolver.c:39:5: error:
implicit declaration of function 'pthread_once' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
pthread_once(&instance_init, qio_dns_resolve_init_instance);
^/Users/pm215/src/qemu-for-merges/io/dns-resolver.c:39:5: note: did you
mean 'pthread_kill'? /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/signal.h:82:5:
note: 'pthread_kill' declared here
int pthread_kill(pthread_t, int);
^2 errors generated.
OSX does have pthread_once(), but you need to actually include pthread.h (either directly or more likely via qemu/thread.h) to get it.
thanks
-- PMM
Quoted 26 lines · Peter Maydell
Quoted 15 lines · Daniel P. Berrange
The following changes since commit
598cf1c805271564686f2d732b36f50c3c40dcdd:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-01-20 16:42:07 +0000)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-qio-2017-01-23-1for you to fetch changes up to
19f3cc22d364b57315e171090ee2e499b58775b4:io: introduce a DNS resolver API (2017-01-23 11:28:09 +0000)
----------------------------------------------------------------
Merge io/ 2017-01-23Quoted 9 lines
Daniel P. Berrange (8):
sockets: add ability to disable DNS resolution for InetSocketAddress
io: stop incrementing reference inqio_task_get_source
io: fix typo in docs for QIOTask
io: add ability to associate an opaque "result" with with a task
io: add ability to associate an error with a task
io: change the QIOTask callback signature
io: remove Error parameter from QIOTask thread worker
io: introduce a DNS resolver API
Quoted 1 line
Fails to build, OSX:
Also w32:/home/petmay01/linaro/qemu-for-merges/util/qemu-sockets.c: In function ‘inet_listen_saddr’:/home/petmay01/linaro/qemu-for-merges/util/qemu-sockets.c:145:41:
error: ‘AI_NUMERICSERV’ undeclared (first use in this function)
ai.ai_flags |= AI_NUMERICHOST | AI_NUMERICSERV;
^/home/petmay01/linaro/qemu-for-merges/util/qemu-sockets.c:145:41:
note: each undeclared identifier is reported only once for each function it appears in
thanks
-- PMM
Quoted 34 lines · Peter Maydell
Quoted 26 lines · Peter Maydell
Quoted 15 lines · Daniel P. Berrange
The following changes since commit
598cf1c805271564686f2d732b36f50c3c40dcdd:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-01-20 16:42:07 +0000)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-qio-2017-01-23-1for you to fetch changes up to
19f3cc22d364b57315e171090ee2e499b58775b4:io: introduce a DNS resolver API (2017-01-23 11:28:09 +0000)
----------------------------------------------------------------
Merge io/ 2017-01-23Quoted 9 lines
Daniel P. Berrange (8):
sockets: add ability to disable DNS resolution for InetSocketAddress
io: stop incrementing reference inqio_task_get_source
io: fix typo in docs for QIOTask
io: add ability to associate an opaque "result" with with a task
io: add ability to associate an error with a task
io: change the QIOTask callback signature
io: remove Error parameter from QIOTask thread worker
io: introduce a DNS resolver APIQuoted 1 line
Fails to build, OSX:
Also w32:
/home/petmay01/linaro/qemu-for-merges/util/qemu-sockets.c: In function ‘inet_listen_saddr’:/home/petmay01/linaro/qemu-for-merges/util/qemu-sockets.c:145:41:
error: ‘AI_NUMERICSERV’ undeclared (first use in this function)
Quoted 5 lines
ai.ai_flags |= AI_NUMERICHOST | AI_NUMERICSERV; ^
/home/petmay01/linaro/qemu-for-merges/util/qemu-sockets.c:145:41:
note: each undeclared identifier is reported only once for each function it appears in
Ok, that's fairly harmless if missing, so I'll defined it to 0 if not found.
Regards,
Daniel
Signature · 3 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
Quoted 41 lines · Peter Maydell
Quoted 15 lines · Daniel P. Berrange
The following changes since commit
598cf1c805271564686f2d732b36f50c3c40dcdd:Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-01-20 16:42:07 +0000)
are available in the git repository at:
git://github.com/berrange/qemutags/pull-qio-2017-01-23-1for you to fetch changes up to
19f3cc22d364b57315e171090ee2e499b58775b4:io: introduce a DNS resolver API (2017-01-23 11:28:09 +0000)
----------------------------------------------------------------
Merge io/ 2017-01-23Quoted 9 lines
Daniel P. Berrange (8):
sockets: add ability to disable DNS resolution for InetSocketAddress
io: stop incrementing reference inqio_task_get_source
io: fix typo in docs for QIOTask
io: add ability to associate an opaque "result" with with a task
io: add ability to associate an error with a task
io: change the QIOTask callback signature
io: remove Error parameter from QIOTask thread worker
io: introduce a DNS resolver APIFails to build, OSX:
/Users/pm215/src/qemu-for-merges/io/dns-resolver.c:30:39: error: use of undeclared identifier '
PTHREAD_ONCE_INIT'static pthread_once_t instance_init = PTHREAD_ONCE_INIT; ^ /Users/pm215/src/qemu-for-merges/io/dns-resolver.c:39:5: error: implicit declaration of function 'pthread_once' is invalid in C99 [-Werror,-Wimplicit-function-declaration] pthread_once(&instance_init, qio_dns_resolve_init_instance); ^/Users/pm215/src/qemu-for-merges/io/dns-resolver.c:39:5: note: did you
mean 'pthread_kill'? /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/signal.h:82:5:
note: 'pthread_kill' declared here
Quoted 7 lines
int pthread_kill(pthread_t, int); ^2 errors generated.
OSX does have
pthread_once(), but you need to actually includepthread.h(either directly or more likely viaqemu/thread.h) to get it.
Of course pthread_once Is not available on Win32 at all. What I should have used was GOnce which is portable from glib, since QEMU's thread APIs don't provide any once-control wrappers.
Regards,
Daniel
Signature · 3 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|