From: Ian Campbell Subject: Re: [PATCH] xl: create VFB for PV guest when VNC is specified Date: Mon, 16 Dec 2013 16:57:34 +0000 Message-ID: <1387213054.21086.40.camel@kazak.uk.xensource.com> References: <1387212158-15338-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1387212158-15338-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2013-12-16 at 16:42 +0000, Wei Liu wrote: > This replicates a Xend behavior, when you specify: > > vnc=1 > vnclisten=XXXX > vncpasswd=XXXX > > in a PV guest's config file, it creates a VFB for you. > > Fixes bug #25. > http://bugs.xenproject.org/xen/bug/25 > > Reported-by: Konrad Wilk > Signed-off-by: Wei Liu > Cc: Ian Campbell > Cc: Ian Jackson > > --- > Changes in V2: > * use macros to reduce code duplication > * vfb=[] take precedence over top level VNC options > --- > --- > tools/libxl/xl_cmdimpl.c | 96 ++++++++++++++++++++++++++++++++++------------ > 1 file changed, 72 insertions(+), 24 deletions(-) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index bd26bcc..f3f4d71 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -1357,11 +1357,37 @@ skip_nic: > fprintf(stderr, "WARNING: vif2: netchannel2 is deprecated and not supported by xl\n"); > } > > +#define add_vfb_vkb(vfb,vkb) \ I think what Ian was suggesting was a single macro which could expand an arbitrary array given as a parameter, rather than this, which is pretty fuggly. e.g. vfb = ARRAY_EXTEND(d_config->vfbs, d_config->num_vfbs) or something (making liberal use of typeof() etc). Perhaps even vfb = ARRAY_EXTEND(d_config, vfbs) and some cpp token pasting. Once you have that you can use it for both vkb and vfb. I think you would be better off skipping the ->devid set, but if you want to keep it you'd want to call it something more suitable like NEW_DEVICE() perhaps. You don't need to use the new macro everywhere right now during code freeze but we can flip everything in 4.5. > @@ -1608,6 +1624,47 @@ skip_vfb: > > #undef parse_extra_args > > +#define parse_top_level_vnc_options(enable,listen,passwd,display,unused) \ I think this could be a function, which is would be preferable to a macro if possible. Ian.