All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH v4 1/2] libxl: postpone backend name resolution
Date: Mon, 15 Apr 2013 16:55:08 +0200	[thread overview]
Message-ID: <516C14CC.3000107@citrix.com> (raw)
In-Reply-To: <1365780146-20785-1-git-send-email-dgdegra@tycho.nsa.gov>

On 12/04/13 17:22, Daniel De Graaf wrote:
> This adds a backend_domname field in libxl devices that contain a
> backend_domid field, allowing either a domid or a domain name to be
> specified in the configuration structures.  The domain name is resolved
> into a domain ID in the _setdefault function when adding the device.
> This change allows the backend of the block devices to be specified
> (which previously required passing the libxl_ctx down into the block
> device parser), and will simplify specification of backend domains in
> other users of libxl.
> 
> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> 
> ---
> 
> This patch does not include the changes to tools/libxl/libxlu_disk_l.c
> and tools/libxl/libxlu_disk_l.h because the diffs contain unrelated
> changes due to different generator versions.
> 
> Changes since v3:
>  - Add #define LIBXL_HAVE_DEVICE_BACKEND_DOMNAME in libxl.h
>  - Create libxl_domain_qualifier_to_domid function in libxl_util.h
> 
>  docs/misc/xl-disk-configuration.txt | 12 ++++++
>  tools/libxl/libxl.c                 | 17 +++++++--
>  tools/libxl/libxl.h                 | 12 ++++++
>  tools/libxl/libxl_types.idl         |  5 +++
>  tools/libxl/libxl_utils.c           | 19 ++++++++++
>  tools/libxl/libxl_utils.h           |  1 +
>  tools/libxl/libxlu_disk_l.l         |  1 +
>  tools/libxl/xl_cmdimpl.c            | 75 ++++++++-----------------------------
>  8 files changed, 78 insertions(+), 64 deletions(-)
> 
> diff --git a/docs/misc/xl-disk-configuration.txt b/docs/misc/xl-disk-configuration.txt
> index 86c16be..5bd456d 100644
> --- a/docs/misc/xl-disk-configuration.txt
> +++ b/docs/misc/xl-disk-configuration.txt
> @@ -139,6 +139,18 @@ cdrom
>  Convenience alias for "devtype=cdrom".
> 
> 
> +backend=<domain-name>
> +---------------------
> +
> +Description:           Designates a backend domain for the device
> +Supported values:      Valid domain names
> +Mandatory:             No
> +
> +Specifies the backend domain which this device should attach to. This
> +defaults to domain 0. Specifying another domain requires setting up a
> +driver domain which is outside the scope of this document.
> +
> +
>  backendtype=<backend-type>
>  --------------------------
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 572c2c6..b994fea 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -1730,13 +1730,21 @@ static int libxl__device_nextid(libxl__gc *gc, uint32_t domid, char *device)
>      return nextid;
>  }
> 
> +static int libxl__resolve_domid(libxl__gc *gc, const char *name,
> +                                uint32_t *domid)
> +{
> +    if (!name)
> +        return 0;

This is just my opinion, but I find this function ambiguous, it will
return 0 (success), if either name is NULL, or name != NULL and it can
be resolved to a domid, which means that even when returning 0 the value
in *domid might be uninitialized (if name == NULL). I would rather do
something like

if (!name || !domid)
	return ERROR_INVAL;

And make sure callers only call this function if there's a real need to
resolve a domid.

Also, do we check somewhere that both backend_domid and backend_domname
are not specified at the same time?

  parent reply	other threads:[~2013-04-15 14:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 15:22 [PATCH v4 1/2] libxl: postpone backend name resolution Daniel De Graaf
2013-04-12 15:22 ` [PATCH v4 2/2] libxl: properly initialize device structures Daniel De Graaf
2013-04-15 12:11   ` Ian Campbell
2013-04-17 15:01     ` Ian Campbell
2013-04-17 15:06       ` Daniel De Graaf
2013-04-15 12:11 ` [PATCH v4 1/2] libxl: postpone backend name resolution Ian Campbell
2013-04-15 14:29   ` Daniel De Graaf
2013-04-16 11:23   ` George Dunlap
2013-04-15 14:55 ` Roger Pau Monné [this message]
2013-04-15 14:59   ` Ian Campbell
2013-04-15 15:38     ` Ian Campbell
2013-04-15 15:03   ` Daniel De Graaf

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=516C14CC.3000107@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=xen-devel@lists.xen.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.