From: Ian Campbell <ian.campbell@citrix.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>, xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>, Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH 2/2] libxl: fix UUID usage on FreeBSD
Date: Fri, 15 Jan 2016 15:26:22 +0000 [thread overview]
Message-ID: <1452871582.6020.38.camel@citrix.com> (raw)
In-Reply-To: <56990C23.3030803@citrix.com>
On Fri, 2016-01-15 at 16:11 +0100, Roger Pau Monné wrote:
> El 15/01/16 a les 11.26, Ian Campbell ha escrit:
> > On Tue, 2016-01-12 at 14:14 +0100, Roger Pau Monne wrote:
> > > libxl makes the assumtion that libxl_uuid == uuid_t,
> >
> > ("assumption")
> >
> > > and that uuid_t can be
> > > freely used as a byte array. This is not true on FreeBSD (and NetBSD
> > > too, not sure about other BSD UUID implementations), where the
> > > internals
> > > of
> > > uuid don't match what libxl expects as a byte array because of
> > > endianness
> > > issues.
> > >
> > > Fix this by converting the libxl_uuid type to a struct with an
> > > internal
> > > uuid_t field and a byte-array. Also introduce a new function that
> > > should
> > > be
> > > used in order to load a byte array into a uuid_t struct.
> >
> > Do we really need to keep both the uuid_t and the byte-array
> > representation
> > around? It looks to me as if we only really need the byte-array form,
> > which
> > might then involve changing various uses of uuid_* internally to just
> > be
> > mem*.
>
> Yes, we can remove the uuid_t from libxl_uuid, but this is AFAICT a
> structure that belongs to the stable API.
Oh b*m, so it is.
> My current change keeps the
> same layout by turning the union into a struct, but without changing the
> fields.
The danger with your change is that the two halves can now get out of sync.
Neither xl nor libvirt actually poke into the contents of the struct at
all. So I wonder if we can get away with deprecating it?
Or can we get rid of uuid_raw (which is not touched, and is less likely to
be given that it is only on a subset of platforms) and have libxl
_internal_ stuff convert to a byte array.
The problem there I guess is that would involve changing the semantics of
libxl_uuid_bytearray{,_const} (since the result would now need to be freed,
since both returns a static buffer, so who knows what the const distinction
was supposed to be for!).
Hrm, we've certainly painted ourselves into a corner with this one :-/
If we do go with keeping both the uuid_t and the raw array then we should
clearly mark the uuid_t one as the canonical copy (the raw one essentially
becomes a scratch space used to facilitate the provision of the broken
libxl_uuid_bytearray* interfaces).
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-01-15 15:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-12 13:14 [PATCH 0/2] libxl: FreeBSD fixes Roger Pau Monne
2016-01-12 13:14 ` [PATCH 1/2] libxl: fix _SC_GETPW_R_SIZE_MAX usage Roger Pau Monne
2016-01-13 3:19 ` Doug Goldstein
2016-01-13 9:08 ` Roger Pau Monné
2016-01-15 10:16 ` Ian Campbell
2016-01-12 13:14 ` [PATCH 2/2] libxl: fix UUID usage on FreeBSD Roger Pau Monne
2016-01-15 10:26 ` Ian Campbell
2016-01-15 15:11 ` Roger Pau Monné
2016-01-15 15:26 ` Ian Campbell [this message]
2016-01-19 18:40 ` Ian Jackson
2016-01-12 14:54 ` [PATCH 0/2] libxl: FreeBSD fixes Roger Pau Monné
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=1452871582.6020.38.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=roger.pau@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.