[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 03/10] xen: sysfs: fix build warning.



On Wed, 2012-10-17 at 18:02 +0100, Stefano Stabellini wrote:
> On Wed, 17 Oct 2012, Ian Campbell wrote:
> > Define PRI macros for xen_ulong_t and xen_pfn_t and use to fix:
> > drivers/xen/sys-hypervisor.c:288:4: warning: format '%lx' expects argument 
> > of type 'long unsigned int', but argument 3 has type 'xen_ulong_t' 
> > [-Wformat]
> > 
> > Ideally this would use PRIx64 on ARM but these (or equivalent) don't
> > seem to be available in the kernel.
> 
> I don't think that the PRI macros are used at all in the kernel, so you
> can actually name and define these ones the way you like.

Sure, it's just a bit annoying to have the disconnect between "uint64_t"
and to pair it with "llx" instead of PRIx64. It might almost be better
to have typedef unsigned long long xen_pfn_t et al.

Anyway, lets stick with this for now.

> These definitions seem good to me.
> 
> 
> > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > ---
> >  arch/arm/include/asm/xen/interface.h |    2 ++
> >  arch/x86/include/asm/xen/interface.h |    2 ++
> >  drivers/xen/sys-hypervisor.c         |    3 ++-
> >  3 files changed, 6 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/arm/include/asm/xen/interface.h 
> > b/arch/arm/include/asm/xen/interface.h
> > index ae05e56..62160f2 100644
> > --- a/arch/arm/include/asm/xen/interface.h
> > +++ b/arch/arm/include/asm/xen/interface.h
> > @@ -31,7 +31,9 @@
> >  /* Explicitly size integers that represent pfns in the interface with
> >   * Xen so that we can have one ABI that works for 32 and 64 bit guests. */
> >  typedef uint64_t xen_pfn_t;
> > +#define PRI_xen_pfn "llx"
> >  typedef uint64_t xen_ulong_t;
> > +#define PRI_xen_ulong "llx"
> >  /* Guest handles for primitive C types. */
> >  __DEFINE_GUEST_HANDLE(uchar, unsigned char);
> >  __DEFINE_GUEST_HANDLE(uint,  unsigned int);
> > diff --git a/arch/x86/include/asm/xen/interface.h 
> > b/arch/x86/include/asm/xen/interface.h
> > index 6d2f75a..ab3c67c 100644
> > --- a/arch/x86/include/asm/xen/interface.h
> > +++ b/arch/x86/include/asm/xen/interface.h
> > @@ -51,7 +51,9 @@
> >   * with Xen so that on ARM we can have one ABI that works for 32 and 64
> >   * bit guests. */
> >  typedef unsigned long xen_pfn_t;
> > +#define PRI_xen_pfn "lx"
> >  typedef unsigned long xen_ulong_t;
> > +#define PRI_xen_ulong "lx"
> >  /* Guest handles for primitive C types. */
> >  __DEFINE_GUEST_HANDLE(uchar, unsigned char);
> >  __DEFINE_GUEST_HANDLE(uint,  unsigned int);
> > diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
> > index 66a0a14..96453f8 100644
> > --- a/drivers/xen/sys-hypervisor.c
> > +++ b/drivers/xen/sys-hypervisor.c
> > @@ -285,7 +285,8 @@ static ssize_t virtual_start_show(struct hyp_sysfs_attr 
> > *attr, char *buffer)
> >             ret = HYPERVISOR_xen_version(XENVER_platform_parameters,
> >                                          parms);
> >             if (!ret)
> > -                   ret = sprintf(buffer, "%lx\n", parms->virt_start);
> > +                   ret = sprintf(buffer, "%"PRI_xen_ulong"\n",
> > +                                 parms->virt_start);
> >             kfree(parms);
> >     }
> >  
> > -- 
> > 1.7.2.5
> > 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.