<div dir="ltr">Okay, guess thats right? Second opinion, lennart? Kay?</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/13 Tom Gundersen <span dir="ltr"><<a href="mailto:teg@jklm.no" target="_blank">teg@jklm.no</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sun, Jan 12, 2014 at 7:42 PM, Daniel Buch <<a href="mailto:boogiewasthere@gmail.com">boogiewasthere@gmail.com</a>> wrote:<br>
> ---<br>
> src/libsystemd-bus/dns-util.h | 12 ++---<br>
> src/libsystemd-bus/sd-dns.c | 100 +++++++++++++++++++++---------------------<br>
> src/libsystemd-bus/test-dns.c | 26 +++++------<br>
> src/systemd/sd-dns.h | 46 +++++++++----------<br>
> 4 files changed, 92 insertions(+), 92 deletions(-)<br>
><br>
> diff --git a/src/libsystemd-bus/dns-util.h b/src/libsystemd-bus/dns-util.h<br>
> index e0284c8..15ab28b 100644<br>
> --- a/src/libsystemd-bus/dns-util.h<br>
> +++ b/src/libsystemd-bus/dns-util.h<br>
> @@ -23,9 +23,9 @@<br>
><br>
> #include "util.h"<br>
><br>
> -DEFINE_TRIVIAL_CLEANUP_FUNC(asyncns_t*, asyncns_free);<br>
> -DEFINE_TRIVIAL_CLEANUP_FUNC(unsigned char *, asyncns_freeanswer);<br>
> -DEFINE_TRIVIAL_CLEANUP_FUNC(struct addrinfo*, asyncns_freeaddrinfo);<br>
> -#define _cleanup_asyncns_free_ _cleanup_(asyncns_freep)<br>
> -#define _cleanup_asyncns_answer_free_ _cleanup_(asyncns_freeanswerp)<br>
> -#define _cleanup_asyncns_addrinfo_free_ _cleanup_(asyncns_freeaddrinfop)<br>
> +DEFINE_TRIVIAL_CLEANUP_FUNC(sd_asyncns_t*, sd_asyncns_free);<br>
> +DEFINE_TRIVIAL_CLEANUP_FUNC(unsigned char *, sd_asyncns_freeanswer);<br>
> +DEFINE_TRIVIAL_CLEANUP_FUNC(struct addrinfo*, sd_asyncns_freeaddrinfo);<br>
> +#define _cleanup_asyncns_free_ _cleanup_(sd_asyncns_freep)<br>
> +#define _cleanup_asyncns_answer_free_ _cleanup_(sd_asyncns_freeanswerp)<br>
> +#define _cleanup_asyncns_addrinfo_free_ _cleanup_(sd_asyncns_freeaddrinfop)<br>
> diff --git a/src/libsystemd-bus/sd-dns.c b/src/libsystemd-bus/sd-dns.c<br>
> index 0f90d02..7062ee2 100644<br>
> --- a/src/libsystemd-bus/sd-dns.c<br>
> +++ b/src/libsystemd-bus/sd-dns.c<br>
> @@ -68,27 +68,27 @@ enum {<br>
> MESSAGE_FD_MAX = 4<br>
> };<br>
><br>
> -struct asyncns {<br>
> +struct sd_asyncns {<br>
> int fds[MESSAGE_FD_MAX];<br>
><br>
> pthread_t workers[MAX_WORKERS];<br>
> unsigned valid_workers;<br>
><br>
> unsigned current_id, current_index;<br>
> - asyncns_query_t* queries[MAX_QUERIES];<br>
> + sd_asyncns_query_t* queries[MAX_QUERIES];<br>
><br>
> - asyncns_query_t *done_head, *done_tail;<br>
> + sd_asyncns_query_t *done_head, *done_tail;<br>
><br>
> int n_queries;<br>
> int dead;<br>
> };<br>
><br>
> -struct asyncns_query {<br>
> - asyncns_t *asyncns;<br>
> +struct sd_asyncns_query {<br>
> + sd_asyncns_t *asyncns;<br>
> int done;<br>
> unsigned id;<br>
> query_type_t type;<br>
> - asyncns_query_t *done_next, *done_prev;<br>
> + sd_asyncns_query_t *done_next, *done_prev;<br>
> int ret;<br>
> int _errno;<br>
> int _h_errno;<br>
> @@ -383,7 +383,7 @@ static int handle_request(int out_fd, const packet_t *packet, size_t length) {<br>
> }<br>
><br>
> static void* thread_worker(void *p) {<br>
> - asyncns_t *asyncns = p;<br>
> + sd_asyncns_t *asyncns = p;<br>
> sigset_t fullset;<br>
><br>
> /* No signals in this thread please */<br>
> @@ -414,16 +414,16 @@ static void* thread_worker(void *p) {<br>
> return NULL;<br>
> }<br>
><br>
> -asyncns_t* asyncns_new(unsigned n_proc) {<br>
> +sd_asyncns_t* sd_asyncns_new(unsigned n_proc) {<br>
> int i;<br>
> - asyncns_t *asyncns = NULL;<br>
> + sd_asyncns_t *asyncns = NULL;<br>
><br>
> assert(n_proc >= 1);<br>
><br>
> if (n_proc > MAX_WORKERS)<br>
> n_proc = MAX_WORKERS;<br>
><br>
> - asyncns = malloc(sizeof(asyncns_t));<br>
> + asyncns = malloc(sizeof(sd_asyncns_t));<br>
> if (!asyncns) {<br>
> errno = ENOMEM;<br>
> goto fail;<br>
> @@ -475,12 +475,12 @@ asyncns_t* asyncns_new(unsigned n_proc) {<br>
><br>
> fail:<br>
> if (asyncns)<br>
> - asyncns_free(asyncns);<br>
> + sd_asyncns_free(asyncns);<br>
><br>
> return NULL;<br>
> }<br>
><br>
> -void asyncns_free(asyncns_t *asyncns) {<br>
> +void sd_asyncns_free(sd_asyncns_t *asyncns) {<br>
> int i;<br>
> int saved_errno = errno;<br>
> unsigned p;<br>
> @@ -516,21 +516,21 @@ void asyncns_free(asyncns_t *asyncns) {<br>
><br>
> for (p = 0; p < MAX_QUERIES; p++)<br>
> if (asyncns->queries[p])<br>
> - asyncns_cancel(asyncns, asyncns->queries[p]);<br>
> + sd_asyncns_cancel(asyncns, asyncns->queries[p]);<br>
><br>
> free(asyncns);<br>
><br>
> errno = saved_errno;<br>
> }<br>
><br>
> -int asyncns_fd(asyncns_t *asyncns) {<br>
> +int asyncns_fd(sd_asyncns_t *asyncns) {<br>
> assert(asyncns);<br>
><br>
> return asyncns->fds[RESPONSE_RECV_FD];<br>
> }<br>
><br>
> -static asyncns_query_t *lookup_query(asyncns_t *asyncns, unsigned id) {<br>
> - asyncns_query_t *q;<br>
> +static sd_asyncns_query_t *lookup_query(sd_asyncns_t *asyncns, unsigned id) {<br>
> + sd_asyncns_query_t *q;<br>
> assert(asyncns);<br>
><br>
> q = asyncns->queries[id % MAX_QUERIES];<br>
> @@ -541,7 +541,7 @@ static asyncns_query_t *lookup_query(asyncns_t *asyncns, unsigned id) {<br>
> return NULL;<br>
> }<br>
><br>
> -static void complete_query(asyncns_t *asyncns, asyncns_query_t *q) {<br>
> +static void complete_query(sd_asyncns_t *asyncns, sd_asyncns_query_t *q) {<br>
> assert(asyncns);<br>
> assert(q);<br>
> assert(!q->done);<br>
> @@ -608,14 +608,14 @@ static const void *unserialize_addrinfo(const void *p, struct addrinfo **ret_ai,<br>
><br>
> fail:<br>
> if (ai)<br>
> - asyncns_freeaddrinfo(ai);<br>
> + sd_asyncns_freeaddrinfo(ai);<br>
><br>
> return NULL;<br>
> }<br>
><br>
> -static int handle_response(asyncns_t *asyncns, const packet_t *packet, size_t length) {<br>
> +static int handle_response(sd_asyncns_t *asyncns, const packet_t *packet, size_t length) {<br>
> const rheader_t *resp;<br>
> - asyncns_query_t *q;<br>
> + sd_asyncns_query_t *q;<br>
><br>
> assert(asyncns);<br>
><br>
> @@ -721,7 +721,7 @@ static int handle_response(asyncns_t *asyncns, const packet_t *packet, size_t le<br>
> return 0;<br>
> }<br>
><br>
> -int asyncns_wait(asyncns_t *asyncns, int block) {<br>
> +int sd_asyncns_wait(sd_asyncns_t *asyncns, int block) {<br>
> int handled = 0;<br>
> assert(asyncns);<br>
><br>
> @@ -760,8 +760,8 @@ int asyncns_wait(asyncns_t *asyncns, int block) {<br>
> }<br>
> }<br>
><br>
> -static asyncns_query_t *alloc_query(asyncns_t *asyncns) {<br>
> - asyncns_query_t *q;<br>
> +static sd_asyncns_query_t *alloc_query(sd_asyncns_t *asyncns) {<br>
> + sd_asyncns_query_t *q;<br>
> assert(asyncns);<br>
><br>
> if (asyncns->n_queries >= MAX_QUERIES) {<br>
> @@ -777,7 +777,7 @@ static asyncns_query_t *alloc_query(asyncns_t *asyncns) {<br>
> asyncns->current_index -= MAX_QUERIES;<br>
> }<br>
><br>
> - q = asyncns->queries[asyncns->current_index] = malloc(sizeof(asyncns_query_t));<br>
> + q = asyncns->queries[asyncns->current_index] = malloc(sizeof(sd_asyncns_query_t));<br>
> if (!q) {<br>
> errno = ENOMEM;<br>
> return NULL;<br>
> @@ -799,10 +799,10 @@ static asyncns_query_t *alloc_query(asyncns_t *asyncns) {<br>
> return q;<br>
> }<br>
><br>
> -asyncns_query_t* asyncns_getaddrinfo(asyncns_t *asyncns, const char *node, const char *service, const struct addrinfo *hints) {<br>
> +sd_asyncns_query_t* sd_asyncns_getaddrinfo(sd_asyncns_t *asyncns, const char *node, const char *service, const struct addrinfo *hints) {<br>
> addrinfo_request_t data[BUFSIZE/sizeof(addrinfo_request_t) + 1] = {};<br>
> addrinfo_request_t *req = data;<br>
> - asyncns_query_t *q;<br>
> + sd_asyncns_query_t *q;<br>
> assert(asyncns);<br>
> assert(node || service);<br>
><br>
> @@ -847,12 +847,12 @@ asyncns_query_t* asyncns_getaddrinfo(asyncns_t *asyncns, const char *node, const<br>
><br>
> fail:<br>
> if (q)<br>
> - asyncns_cancel(asyncns, q);<br>
> + sd_asyncns_cancel(asyncns, q);<br>
><br>
> return NULL;<br>
> }<br>
><br>
> -int asyncns_getaddrinfo_done(asyncns_t *asyncns, asyncns_query_t* q, struct addrinfo **ret_res) {<br>
> +int sd_asyncns_getaddrinfo_done(sd_asyncns_t *asyncns, sd_asyncns_query_t* q, struct addrinfo **ret_res) {<br>
> int ret;<br>
> assert(asyncns);<br>
> assert(q);<br>
> @@ -878,15 +878,15 @@ int asyncns_getaddrinfo_done(asyncns_t *asyncns, asyncns_query_t* q, struct addr<br>
> if (ret != 0)<br>
> h_errno = q->_h_errno;<br>
><br>
> - asyncns_cancel(asyncns, q);<br>
> + sd_asyncns_cancel(asyncns, q);<br>
><br>
> return ret;<br>
> }<br>
><br>
> -asyncns_query_t* asyncns_getnameinfo(asyncns_t *asyncns, const struct sockaddr *sa, socklen_t salen, int flags, int gethost, int getserv) {<br>
> +sd_asyncns_query_t* sd_asyncns_getnameinfo(sd_asyncns_t *asyncns, const struct sockaddr *sa, socklen_t salen, int flags, int gethost, int getserv) {<br>
> nameinfo_request_t data[BUFSIZE/sizeof(nameinfo_request_t) + 1] = {};<br>
> nameinfo_request_t *req = data;<br>
> - asyncns_query_t *q;<br>
> + sd_asyncns_query_t *q;<br>
><br>
> assert(asyncns);<br>
> assert(sa);<br>
> @@ -924,12 +924,12 @@ asyncns_query_t* asyncns_getnameinfo(asyncns_t *asyncns, const struct sockaddr *<br>
><br>
> fail:<br>
> if (q)<br>
> - asyncns_cancel(asyncns, q);<br>
> + sd_asyncns_cancel(asyncns, q);<br>
><br>
> return NULL;<br>
> }<br>
><br>
> -int asyncns_getnameinfo_done(asyncns_t *asyncns, asyncns_query_t* q, char *ret_host, size_t hostlen, char *ret_serv, size_t servlen) {<br>
> +int sd_asyncns_getnameinfo_done(sd_asyncns_t *asyncns, sd_asyncns_query_t* q, char *ret_host, size_t hostlen, char *ret_serv, size_t servlen) {<br>
> int ret;<br>
> assert(asyncns);<br>
> assert(q);<br>
> @@ -964,15 +964,15 @@ int asyncns_getnameinfo_done(asyncns_t *asyncns, asyncns_query_t* q, char *ret_h<br>
> if (ret != 0)<br>
> h_errno = q->_h_errno;<br>
><br>
> - asyncns_cancel(asyncns, q);<br>
> + sd_asyncns_cancel(asyncns, q);<br>
><br>
> return ret;<br>
> }<br>
><br>
> -static asyncns_query_t * asyncns_res(asyncns_t *asyncns, query_type_t qtype, const char *dname, int class, int type) {<br>
> +static sd_asyncns_query_t * asyncns_res(sd_asyncns_t *asyncns, query_type_t qtype, const char *dname, int class, int type) {<br>
> res_request_t data[BUFSIZE/sizeof(res_request_t) + 1];<br>
> res_request_t *req = data;<br>
> - asyncns_query_t *q;<br>
> + sd_asyncns_query_t *q;<br>
><br>
> assert(asyncns);<br>
> assert(dname);<br>
> @@ -1009,20 +1009,20 @@ static asyncns_query_t * asyncns_res(asyncns_t *asyncns, query_type_t qtype, con<br>
><br>
> fail:<br>
> if (q)<br>
> - asyncns_cancel(asyncns, q);<br>
> + sd_asyncns_cancel(asyncns, q);<br>
><br>
> return NULL;<br>
> }<br>
><br>
> -asyncns_query_t* asyncns_res_query(asyncns_t *asyncns, const char *dname, int class, int type) {<br>
> +sd_asyncns_query_t* sd_asyncns_res_query(sd_asyncns_t *asyncns, const char *dname, int class, int type) {<br>
> return asyncns_res(asyncns, REQUEST_RES_QUERY, dname, class, type);<br>
> }<br>
><br>
> -asyncns_query_t* asyncns_res_search(asyncns_t *asyncns, const char *dname, int class, int type) {<br>
> +sd_asyncns_query_t* asyncns_res_search(sd_asyncns_t *asyncns, const char *dname, int class, int type) {<br>
> return asyncns_res(asyncns, REQUEST_RES_SEARCH, dname, class, type);<br>
> }<br>
><br>
> -int asyncns_res_done(asyncns_t *asyncns, asyncns_query_t* q, unsigned char **answer) {<br>
> +int sd_asyncns_res_done(sd_asyncns_t *asyncns, sd_asyncns_query_t* q, unsigned char **answer) {<br>
> int ret;<br>
> assert(asyncns);<br>
> assert(q);<br>
> @@ -1050,22 +1050,22 @@ int asyncns_res_done(asyncns_t *asyncns, asyncns_query_t* q, unsigned char **ans<br>
> h_errno = q->_h_errno;<br>
> }<br>
><br>
> - asyncns_cancel(asyncns, q);<br>
> + sd_asyncns_cancel(asyncns, q);<br>
><br>
> return ret < 0 ? -errno : ret;<br>
> }<br>
><br>
> -asyncns_query_t* asyncns_getnext(asyncns_t *asyncns) {<br>
> +sd_asyncns_query_t* asyncns_getnext(sd_asyncns_t *asyncns) {<br>
> assert(asyncns);<br>
> return asyncns->done_head;<br>
> }<br>
><br>
> -int asyncns_getnqueries(asyncns_t *asyncns) {<br>
> +int asyncns_getnqueries(sd_asyncns_t *asyncns) {<br>
> assert(asyncns);<br>
> return asyncns->n_queries;<br>
> }<br>
><br>
> -void asyncns_cancel(asyncns_t *asyncns, asyncns_query_t* q) {<br>
> +void sd_asyncns_cancel(sd_asyncns_t *asyncns, sd_asyncns_query_t* q) {<br>
> int i;<br>
> int saved_errno = errno;<br>
><br>
> @@ -1091,7 +1091,7 @@ void asyncns_cancel(asyncns_t *asyncns, asyncns_query_t* q) {<br>
> assert(asyncns->queries[i] == q);<br>
> asyncns->queries[i] = NULL;<br>
><br>
> - asyncns_freeaddrinfo(q->addrinfo);<br>
> + sd_asyncns_freeaddrinfo(q->addrinfo);<br>
> free(q->host);<br>
> free(q->serv);<br>
><br>
> @@ -1101,7 +1101,7 @@ void asyncns_cancel(asyncns_t *asyncns, asyncns_query_t* q) {<br>
> errno = saved_errno;<br>
> }<br>
><br>
> -void asyncns_freeaddrinfo(struct addrinfo *ai) {<br>
> +void sd_asyncns_freeaddrinfo(struct addrinfo *ai) {<br>
> int saved_errno = errno;<br>
><br>
> while (ai) {<br>
> @@ -1117,7 +1117,7 @@ void asyncns_freeaddrinfo(struct addrinfo *ai) {<br>
> errno = saved_errno;<br>
> }<br>
><br>
> -void asyncns_freeanswer(unsigned char *answer) {<br>
> +void sd_asyncns_freeanswer(unsigned char *answer) {<br>
> int saved_errno = errno;<br>
><br>
> if (!answer)<br>
> @@ -1133,7 +1133,7 @@ void asyncns_freeanswer(unsigned char *answer) {<br>
> errno = saved_errno;<br>
> }<br>
><br>
> -int asyncns_isdone(asyncns_t *asyncns, asyncns_query_t*q) {<br>
> +int sd_asyncns_isdone(sd_asyncns_t *asyncns, sd_asyncns_query_t*q) {<br>
> assert(asyncns);<br>
> assert(q);<br>
> assert(q->asyncns == asyncns);<br>
> @@ -1141,7 +1141,7 @@ int asyncns_isdone(asyncns_t *asyncns, asyncns_query_t*q) {<br>
> return q->done;<br>
> }<br>
><br>
> -void asyncns_setuserdata(asyncns_t *asyncns, asyncns_query_t *q, void *userdata) {<br>
> +void asyncns_setuserdata(sd_asyncns_t *asyncns, sd_asyncns_query_t *q, void *userdata) {<br>
> assert(q);<br>
> assert(asyncns);<br>
> assert(q->asyncns = asyncns);<br>
> @@ -1149,7 +1149,7 @@ void asyncns_setuserdata(asyncns_t *asyncns, asyncns_query_t *q, void *userdata)<br>
> q->userdata = userdata;<br>
> }<br>
><br>
> -void* asyncns_getuserdata(asyncns_t *asyncns, asyncns_query_t *q) {<br>
> +void *asyncns_getuserdata(sd_asyncns_t *asyncns, sd_asyncns_query_t *q) {<br>
> assert(q);<br>
> assert(asyncns);<br>
> assert(q->asyncns = asyncns);<br>
> diff --git a/src/libsystemd-bus/test-dns.c b/src/libsystemd-bus/test-dns.c<br>
> index b4f064f..78aa557 100644<br>
> --- a/src/libsystemd-bus/test-dns.c<br>
> +++ b/src/libsystemd-bus/test-dns.c<br>
> @@ -37,17 +37,17 @@<br>
><br>
> int main(int argc, char *argv[]) {<br>
> int r = 1, ret;<br>
> - _cleanup_asyncns_free_ asyncns_t *asyncns = NULL;<br>
> + _cleanup_asyncns_free_ sd_asyncns_t *asyncns = NULL;<br>
> _cleanup_asyncns_addrinfo_free_ struct addrinfo *ai = NULL;<br>
> _cleanup_asyncns_answer_free_ unsigned char *srv = NULL;<br>
> - asyncns_query_t *q1, *q2, *q3;<br>
> + sd_asyncns_query_t *q1, *q2, *q3;<br>
> struct addrinfo hints = {};<br>
> struct sockaddr_in sa = {};<br>
> char host[NI_MAXHOST] = "", serv[NI_MAXSERV] = "";<br>
><br>
> signal(SIGCHLD, SIG_IGN);<br>
><br>
> - asyncns = asyncns_new(2);<br>
> + asyncns = sd_asyncns_new(2);<br>
> if (!asyncns)<br>
> log_oom();<br>
><br>
> @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) {<br>
> hints.ai_family = PF_UNSPEC;<br>
> hints.ai_socktype = SOCK_STREAM;<br>
><br>
> - q1 = asyncns_getaddrinfo(asyncns, argc >= 2 ? argv[1] : "<a href="http://www.heise.de" target="_blank">www.heise.de</a>", NULL, &hints);<br>
> + q1 = sd_asyncns_getaddrinfo(asyncns, argc >= 2 ? argv[1] : "<a href="http://www.heise.de" target="_blank">www.heise.de</a>", NULL, &hints);<br>
> if (!q1)<br>
> fprintf(stderr, "asyncns_getaddrinfo(): %s\n", strerror(errno));<br>
><br>
> @@ -64,25 +64,25 @@ int main(int argc, char *argv[]) {<br>
> sa.sin_addr.s_addr = inet_addr(argc >= 3 ? argv[2] : "193.99.144.71");<br>
> sa.sin_port = htons(80);<br>
><br>
> - q2 = asyncns_getnameinfo(asyncns, (struct sockaddr*) &sa, sizeof(sa), 0, 1, 1);<br>
> + q2 = sd_asyncns_getnameinfo(asyncns, (struct sockaddr*) &sa, sizeof(sa), 0, 1, 1);<br>
> if (!q2)<br>
> fprintf(stderr, "asyncns_getnameinfo(): %s\n", strerror(errno));<br>
><br>
> /* Make a res_query() call */<br>
> - q3 = asyncns_res_query(asyncns, "_xmpp-client._<a href="http://tcp.gmail.com" target="_blank">tcp.gmail.com</a>", C_IN, T_SRV);<br>
> + q3 = sd_asyncns_res_query(asyncns, "_xmpp-client._<a href="http://tcp.gmail.com" target="_blank">tcp.gmail.com</a>", C_IN, T_SRV);<br>
> if (!q3)<br>
> fprintf(stderr, "asyncns_res_query(): %s\n", strerror(errno));<br>
><br>
> /* Wait until the three queries are completed */<br>
> - while (!asyncns_isdone(asyncns, q1) ||<br>
> - !asyncns_isdone(asyncns, q2) ||<br>
> - !asyncns_isdone(asyncns, q3)) {<br>
> - if (asyncns_wait(asyncns, 1) < 0)<br>
> + while (!sd_asyncns_isdone(asyncns, q1) ||<br>
> + !sd_asyncns_isdone(asyncns, q2) ||<br>
> + !sd_asyncns_isdone(asyncns, q3)) {<br>
> + if (sd_asyncns_wait(asyncns, 1) < 0)<br>
> fprintf(stderr, "asyncns_wait(): %s\n", strerror(errno));<br>
> }<br>
><br>
> /* Interpret the result of the name -> addr query */<br>
> - ret = asyncns_getaddrinfo_done(asyncns, q1, &ai);<br>
> + ret = sd_asyncns_getaddrinfo_done(asyncns, q1, &ai);<br>
> if (ret)<br>
> fprintf(stderr, "error: %s %i\n", gai_strerror(ret), ret);<br>
> else {<br>
> @@ -102,14 +102,14 @@ int main(int argc, char *argv[]) {<br>
> }<br>
><br>
> /* Interpret the result of the addr -> name query */<br>
> - ret = asyncns_getnameinfo_done(asyncns, q2, host, sizeof(host), serv, sizeof(serv));<br>
> + ret = sd_asyncns_getnameinfo_done(asyncns, q2, host, sizeof(host), serv, sizeof(serv));<br>
> if (ret)<br>
> fprintf(stderr, "error: %s %i\n", gai_strerror(ret), ret);<br>
> else<br>
> printf("%s -- %s\n", host, serv);<br>
><br>
> /* Interpret the result of the SRV lookup */<br>
> - ret = asyncns_res_done(asyncns, q3, &srv);<br>
> + ret = sd_asyncns_res_done(asyncns, q3, &srv);<br>
> if (ret < 0) {<br>
> fprintf(stderr, "error: %s %i\n", strerror(errno), ret);<br>
> } else if (ret == 0) {<br>
> diff --git a/src/systemd/sd-dns.h b/src/systemd/sd-dns.h<br>
> index 38972db..4b382ec 100644<br>
> --- a/src/systemd/sd-dns.h<br>
> +++ b/src/systemd/sd-dns.h<br>
> @@ -33,7 +33,7 @@ _SD_BEGIN_DECLARATIONS;<br>
> *<br>
> * \section moo Method of operation<br>
> *<br>
> - * To use libasyncns allocate an asyncns_t object with<br>
> + * To use libasyncns allocate an sd_asyncns_t object with<br>
> * asyncns_new(). This will spawn a number of worker threads (or processes, depending on what is available) which<br>
> * are subsequently used to process the queries the controlling<br>
> * program issues via asyncns_getaddrinfo() and<br>
> @@ -45,36 +45,36 @@ _SD_BEGIN_DECLARATIONS;<br>
> */<br>
><br>
> /** An opaque libasyncns session structure */<br>
> -typedef struct asyncns asyncns_t;<br>
> +typedef struct sd_asyncns sd_asyncns_t;<br>
><br>
> /** An opaque libasyncns query structure */<br>
> -typedef struct asyncns_query asyncns_query_t;<br>
> +typedef struct sd_asyncns_query sd_asyncns_query_t;<br>
><br>
> /** Allocate a new libasyncns session with n_proc worker processes/threads */<br>
> -asyncns_t* asyncns_new(unsigned n_proc);<br>
> +sd_asyncns_t* sd_asyncns_new(unsigned n_proc);<br>
><br>
> /** Free a libasyncns session. This destroys all attached<br>
> - * asyncns_query_t objects automatically */<br>
> -void asyncns_free(asyncns_t *asyncns);<br>
> + * sd_asyncns_query_t objects automatically */<br>
> +void sd_asyncns_free(sd_asyncns_t *asyncns);<br>
><br>
> /** Return the UNIX file descriptor to select() for readability<br>
> * on. Use this function to integrate libasyncns with your custom main<br>
> * loop. */<br>
> -int asyncns_fd(asyncns_t *asyncns);<br>
> +int sd_asyncns_fd(sd_asyncns_t *asyncns);<br>
><br>
> /** Process pending responses. After this function is called you can<br>
> * get the next completed query object(s) using asyncns_getnext(). If<br>
> * block is non-zero wait until at least one response has been<br>
> * processed. If block is zero, process all pending responses and<br>
> * return. */<br>
> -int asyncns_wait(asyncns_t *asyncns, int block);<br>
> +int sd_asyncns_wait(sd_asyncns_t *asyncns, int block);<br>
><br>
> /** Issue a name to address query on the specified session. The<br>
> * arguments are compatible with the ones of libc's<br>
> * getaddrinfo(3). The function returns a new query object. When the<br>
> * query is completed you may retrieve the results using<br>
> * asyncns_getaddrinfo_done().*/<br>
> -asyncns_query_t* asyncns_getaddrinfo(asyncns_t *asyncns, const char *node, const char *service, const struct addrinfo *hints);<br>
> +sd_asyncns_query_t* sd_asyncns_getaddrinfo(sd_asyncns_t *asyncns, const char *node, const char *service, const struct addrinfo *hints);<br>
><br>
> /** Retrieve the results of a preceding asyncns_getaddrinfo()<br>
> * call. Returns a addrinfo structure and a return value compatible<br>
> @@ -83,7 +83,7 @@ asyncns_query_t* asyncns_getaddrinfo(asyncns_t *asyncns, const char *node, const<br>
> * returned addrinfo structure with asyncns_freeaddrinfo() and not<br>
> * libc's freeaddrinfo(3)! If the query is not completed yet EAI_AGAIN<br>
> * is returned.*/<br>
> -int asyncns_getaddrinfo_done(asyncns_t *asyncns, asyncns_query_t* q, struct addrinfo **ret_res);<br>
> +int sd_asyncns_getaddrinfo_done(sd_asyncns_t *asyncns, sd_asyncns_query_t* q, struct addrinfo **ret_res);<br>
><br>
> /** Issue an address to name query on the specified session. The<br>
> * arguments are compatible with the ones of libc's<br>
> @@ -91,26 +91,26 @@ int asyncns_getaddrinfo_done(asyncns_t *asyncns, asyncns_query_t* q, struct addr<br>
> * query is completed you may retrieve the results using<br>
> * asyncns_getnameinfo_done(). Set gethost (resp. getserv) to non-zero<br>
> * if you want to query the hostname (resp. the service name). */<br>
> -asyncns_query_t* asyncns_getnameinfo(asyncns_t *asyncns, const struct sockaddr *sa, socklen_t salen, int flags, int gethost, int getserv);<br>
> +sd_asyncns_query_t* sd_asyncns_getnameinfo(sd_asyncns_t *asyncns, const struct sockaddr *sa, socklen_t salen, int flags, int gethost, int getserv);<br>
><br>
> /** Retrieve the results of a preceding asyncns_getnameinfo()<br>
> * call. Returns the hostname and the service name in ret_host and<br>
> * ret_serv. The query object q is destroyed by this call and may not<br>
> * be used any further. If the query is not completed yet EAI_AGAIN is<br>
> * returned. */<br>
> -int asyncns_getnameinfo_done(asyncns_t *asyncns, asyncns_query_t* q, char *ret_host, size_t hostlen, char *ret_serv, size_t servlen);<br>
> +int sd_asyncns_getnameinfo_done(sd_asyncns_t *asyncns, sd_asyncns_query_t* q, char *ret_host, size_t hostlen, char *ret_serv, size_t servlen);<br>
><br>
> /** Issue a resolver query on the specified session. The arguments are<br>
> * compatible with the ones of libc's res_query(3). The function returns a new<br>
> * query object. When the query is completed you may retrieve the results using<br>
> * asyncns_res_done(). */<br>
> -asyncns_query_t* asyncns_res_query(asyncns_t *asyncns, const char *dname, int class, int type);<br>
> +sd_asyncns_query_t* sd_asyncns_res_query(sd_asyncns_t *asyncns, const char *dname, int class, int type);<br>
><br>
> /** Issue an resolver query on the specified session. The arguments are<br>
> * compatible with the ones of libc's res_search(3). The function returns a new<br>
> * query object. When the query is completed you may retrieve the results using<br>
> * asyncns_res_done(). */<br>
> -asyncns_query_t* asyncns_res_search(asyncns_t *asyncns, const char *dname, int class, int type);<br>
> +sd_asyncns_query_t* sd_asyncns_res_search(sd_asyncns_t *asyncns, const char *dname, int class, int type);<br>
><br>
> /** Retrieve the results of a preceding asyncns_res_query() or<br>
> * asyncns_res_search call. The query object q is destroyed by this<br>
> @@ -119,39 +119,39 @@ asyncns_query_t* asyncns_res_search(asyncns_t *asyncns, const char *dname, int c<br>
> * -EAGAIN is returned, on failure -errno is returned, otherwise the<br>
> * length of answer is returned. Make sure to free the answer is a<br>
> * call to asyncns_freeanswer(). */<br>
> -int asyncns_res_done(asyncns_t *asyncns, asyncns_query_t* q, unsigned char **answer);<br>
> +int sd_asyncns_res_done(sd_asyncns_t *asyncns, sd_asyncns_query_t* q, unsigned char **answer);<br>
><br>
> /** Return the next completed query object. If no query has been<br>
> * completed yet, return NULL. Please note that you need to run<br>
> * asyncns_wait() before this function will return sensible data. */<br>
> -asyncns_query_t* asyncns_getnext(asyncns_t *asyncns);<br>
> +sd_asyncns_query_t* sd_asyncns_getnext(sd_asyncns_t *asyncns);<br>
><br>
> /** Return the number of query objects (completed or not) attached to<br>
> * this session */<br>
> -int asyncns_getnqueries(asyncns_t *asyncns);<br>
> +int sd_asyncns_getnqueries(sd_asyncns_t *asyncns);<br>
><br>
> /** Cancel a currently running query. q is is destroyed by this call<br>
> * and may not be used any futher. */<br>
> -void asyncns_cancel(asyncns_t *asyncns, asyncns_query_t* q);<br>
> +void sd_asyncns_cancel(sd_asyncns_t *asyncns, sd_asyncns_query_t* q);<br>
><br>
> /** Free the addrinfo structure as returned by<br>
> * asyncns_getaddrinfo_done(). Make sure to use this functions instead<br>
> * of the libc's freeaddrinfo()! */<br>
> -void asyncns_freeaddrinfo(struct addrinfo *ai);<br>
> +void sd_asyncns_freeaddrinfo(struct addrinfo *ai);<br>
><br>
> /** Free the answer data as returned by asyncns_res_done().*/<br>
> -void asyncns_freeanswer(unsigned char *answer);<br>
> +void sd_asyncns_freeanswer(unsigned char *answer);<br>
><br>
> /** Returns non-zero when the query operation specified by q has been completed */<br>
> -int asyncns_isdone(asyncns_t *asyncns, asyncns_query_t*q);<br>
> +int sd_asyncns_isdone(sd_asyncns_t *asyncns, sd_asyncns_query_t*q);<br>
><br>
> /** Assign some opaque userdata with a query object */<br>
> -void asyncns_setuserdata(asyncns_t *asyncns, asyncns_query_t *q, void *userdata);<br>
> +void sd_asyncns_setuserdata(sd_asyncns_t *asyncns, sd_asyncns_query_t *q, void *userdata);<br>
><br>
> /** Return userdata assigned to a query object. Use<br>
> * asyncns_setuserdata() to set this data. If no data has been set<br>
> * prior to this call it returns NULL. */<br>
> -void* asyncns_getuserdata(asyncns_t *asyncns, asyncns_query_t *q);<br>
> +void* sd_asyncns_getuserdata(sd_asyncns_t *asyncns, sd_asyncns_query_t *q);<br>
><br>
> _SD_END_DECLARATIONS;<br>
><br>
> --<br>
> 1.8.5.2<br>
><br>
</div></div>> _______________________________________________<br>
> systemd-devel mailing list<br>
> <a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
<br>
<br>
Hm, I guess we should be renaming all of this to "sd_dns*" and not<br>
"sd_asyncns*", no?<br>
<span class="HOEnZb"><font color="#888888"><br>
-t<br>
</font></span></blockquote></div><br></div>