From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH v2 11/11] tools/libvchan: libxenvchan_client_init: use ENOENT for no server
Date: Sat, 10 Nov 2018 10:06:47 +0100 [thread overview]
Message-ID: <20181110090647.GC4051@mail-itl> (raw)
In-Reply-To: <20181108170805.12774-12-ian.jackson@eu.citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 2778 bytes --]
On Thu, Nov 08, 2018 at 05:08:05PM +0000, Ian Jackson wrote:
> * Promise that we will set errno to ENOENT if the server is not
> yet set up.
> * Arrange that all ENOENT returns other than from the read of ring-ref
> are turned into EIO, logging when we do so.
>
> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
> CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Since xtl_log now accepts NULL, it should be fine. Thanks!
Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> tools/libvchan/init.c | 11 ++++++++++-
> tools/libvchan/libxenvchan.h | 4 ++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
> index d987acd338..e58f6bf9ac 100644
> --- a/tools/libvchan/init.c
> +++ b/tools/libvchan/init.c
> @@ -45,6 +45,7 @@
> #include <xen/sys/gntalloc.h>
> #include <xen/sys/gntdev.h>
> #include <libxenvchan.h>
> +#include <xentoollog.h>
>
> #ifndef PAGE_SHIFT
> #define PAGE_SHIFT 12
> @@ -419,7 +420,7 @@ struct libxenvchan *libxenvchan_client_init(struct xentoollog_logger *logger,
> snprintf(buf, sizeof buf, "%s/ring-ref", xs_path);
> ref = xs_read(xs, 0, buf, &len);
> if (!ref)
> - goto fail;
> + goto fail_allow_enoent;
> ring_ref = atoi(ref);
> free(ref);
> if (!ring_ref)
> @@ -452,7 +453,15 @@ struct libxenvchan *libxenvchan_client_init(struct xentoollog_logger *logger,
> if (xs)
> xs_daemon_close(xs);
> return ctrl;
> +
> fail:
> + if (errno == ENOENT) {
> + xtl_log(logger, XTL_ERROR, errno, "vchan",
> + "error talking to server `%s', returning EIO",
> + xs_path);
> + errno = EIO;
> + }
> + fail_allow_enoent:
> libxenvchan_close(ctrl);
> ctrl = NULL;
> goto out;
> diff --git a/tools/libvchan/libxenvchan.h b/tools/libvchan/libxenvchan.h
> index e4ccca1ff0..8a4ec2ce4c 100644
> --- a/tools/libvchan/libxenvchan.h
> +++ b/tools/libvchan/libxenvchan.h
> @@ -105,6 +105,10 @@ struct libxenvchan *libxenvchan_server_init(struct xentoollog_logger *logger,
> * safely, however no locking is performed, so you must prevent multiple clients
> * from connecting to a single server.
> *
> + * Failing with ENOENT means the server has not yet called
> + * libxenvchan_server_init, You may wait for a server to appear by
> + * setting a xenstore watch on xs_path.
> + *
> * @param logger Logger for libxc errors
> * @param domain The peer domain to connect to
> * @param xs_path Base xenstore path for storing ring/event data
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-11-10 9:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 17:07 [PATCH v2 00/11] xentoollog, libvchan: Minor improvements Ian Jackson
2018-11-08 17:07 ` [PATCH v2 01/11] tools/libs/toollog: Provide a default logger Ian Jackson
2018-11-08 17:24 ` Andrew Cooper
2018-11-08 17:28 ` Ian Jackson
2018-11-08 17:31 ` Andrew Cooper
2018-11-08 17:40 ` Andrew Cooper
2018-11-09 11:11 ` Ian Jackson
2018-11-08 17:07 ` [PATCH v2 02/11] tools/libs/toollog: Use the " Ian Jackson
2018-11-10 8:55 ` Marek Marczykowski-Górecki
2018-11-15 14:43 ` Wei Liu
2018-11-08 17:07 ` [PATCH v2 03/11] tools/libs/*: Rely on " Ian Jackson
2018-11-10 8:57 ` Marek Marczykowski-Górecki
2018-11-15 14:44 ` Wei Liu
2018-11-08 17:07 ` [PATCH v2 04/11] tools/libvchan: Initialise xs_transaction_t to XBT_NULL, not NULL Ian Jackson
2018-11-08 17:07 ` [PATCH v2 05/11] tools/xenstore: Document that xs_close(0) is OK Ian Jackson
2018-11-08 17:08 ` [PATCH v2 06/11] tools/libvchan: init_xs_srv: Simplify error handling (1) Ian Jackson
2018-11-08 17:08 ` [PATCH v2 07/11] tools/libvchan: init_xs_srv: Simplify error handling (2) Ian Jackson
2018-11-08 17:08 ` [PATCH v2 08/11] tools/libvchan: init_xs_srv: Turn xs retry from goto into for (; ; ) Ian Jackson
2018-11-08 17:08 ` [PATCH v2 09/11] tools/libvchan: Add xentoollog to direct dependencies Ian Jackson
2018-11-08 17:08 ` [PATCH v2 10/11] tools/libvchan: libxenvchan_*_init: Promise an errno Ian Jackson
2018-11-08 17:08 ` [PATCH v2 11/11] tools/libvchan: libxenvchan_client_init: use ENOENT for no server Ian Jackson
2018-11-10 9:06 ` Marek Marczykowski-Górecki [this message]
2018-11-12 13:52 ` Ian Jackson
2018-11-29 0:01 ` Marek Marczykowski-Górecki
2018-11-15 14:44 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181110090647.GC4051@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.