[libvirt] [PATCH] Prefix major/minor with gnu_dev_
Andrea Bolognani
abologna at redhat.com
Tue Sep 6 10:59:59 UTC 2016
On Mon, 2016-09-05 at 14:47 +0100, Daniel P. Berrange wrote:
> On Mon, Sep 05, 2016 at 03:33:36PM +0200, Michal Privoznik wrote:
> >
> > In the latest glibc, major() and minor() functions are marked as
> > deprecated (glibc commit dbab6577):
> >
> > CC util/libvirt_util_la-vircgroup.lo
> > util/vircgroup.c: In function 'virCgroupGetBlockDevString':
> > util/vircgroup.c:768:5: error: '__major_from_sys_types' is deprecated:
> > In the GNU C Library, `major' is defined by <sys/sysmacros.h>.
> > For historical compatibility, it is currently defined by
> > <sys/types.h> as well, but we plan to remove this soon.
> > To use `major', include <sys/sysmacros.h> directly.
> > If you did not intend to use a system-defined macro `major',
> > you should #undef it after including <sys/types.h>.
> > [-Werror=deprecated-declarations]
> > if (virAsprintf(&ret, "%d:%d ", major(sb.st_rdev), minor(sb.st_rdev)) < 0)
> > ^~
> > In file included from /usr/include/features.h:397:0,
> > from /usr/include/bits/libc-header-start.h:33,
> > from /usr/include/stdio.h:28,
> > from ../gnulib/lib/stdio.h:43,
> > from util/vircgroup.c:26:
> > /usr/include/sys/sysmacros.h:87:1: note: declared here
> > __SYSMACROS_DEFINE_MAJOR (__SYSMACROS_FST_IMPL_TEMPL)
> > ^
> >
> > Applications are supposed to use gnu_dev_major() or
> > gnu_dev_minor() respectively.
>
> How does this work on non-gnu systems like *BSD / OS-X / Mingw[1] ?
It doesn't :)
util/virutil.c:1667:16: error: implicit declaration of function
'gnu_dev_major' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
*maj = gnu_dev_major(sb.st_rdev);
^
util/virutil.c:1669:16: error: implicit declaration of function
'gnu_dev_minor' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
*min = gnu_dev_minor(sb.st_rdev);
^
This is FreeBSD.
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list