Re: [RFC] virfile: fix cast-align error

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

 



Michal Privoznik <mprivozn@xxxxxxxxxx> [2018-10-09, 03:45PM +0200]:
> On 10/08/2018 08:41 PM, Marc Hartmayer wrote:
> > Use the correct type in order to fix the following error on s390x:
> > 
> > In function 'virFileIsSharedFSType':
> > ../../src/util/virfile.c:3578:38: error: cast increases required alignment of target type [-Werror=cast-align]
> >          virFileIsSharedFixFUSE(path, (long *) &sb.f_type);
> > 
> > Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx>
> > ---
> >  src/util/virfile.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/util/virfile.c b/src/util/virfile.c
> > index 2a7e87102a25..832d832696d5 100644
> > --- a/src/util/virfile.c
> > +++ b/src/util/virfile.c
> > @@ -3466,7 +3466,7 @@ int virFilePrintf(FILE *fp, const char *msg, ...)
> >  
> >  static int
> >  virFileIsSharedFixFUSE(const char *path,
> > -                       long *f_type)
> > +                       unsigned int *f_type)
> >  {
> >      char *dirpath = NULL;
> >      const char **mounts = NULL;
> > @@ -3575,7 +3575,7 @@ virFileIsSharedFSType(const char *path,
> >  
> >      if (sb.f_type == FUSE_SUPER_MAGIC) {
> >          VIR_DEBUG("Found FUSE mount for path=%s. Trying to fix it", path);
> > -        virFileIsSharedFixFUSE(path, (long *) &sb.f_type);
> > +        virFileIsSharedFixFUSE(path, &sb.f_type);
> 
> This won't fly on x86_64 where f_type is long. I think we can use
> __fsword_t directly.
> 
> >      }
> >  
> >      VIR_DEBUG("Check if path %s with FS magic %lld is shared",
> > 
> 
> Does that work for you?

Hmm, __fsword_t is still a long int but the f_type member is defined as
unsigned int in the userspace header. Also, I am against exposing any
internal data types.

virFileIsSharedFixFUSE could just return the value, the return value
right now is not checked anyways.

> 
> Michal
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
> 

-- 
IBM Systems
Linux on Z & Virtualization Development
--------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
--------------------------------------------------
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294 

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux