[dm-devel] [PATCH 6/7] kpartx: Fix a compiler warning
Christophe Varoqui
christophe.varoqui at opensvc.com
Wed May 17 22:24:51 UTC 2017
This patch is dropped, due to
Martin's 8b9cda51f5c64bc869188ca0b2e1ac0e7eb7c667 patch switching to
sys/sysmacros.h
Otherwise, the rest of the set is now merged.
Thanks.
On Wed, May 17, 2017 at 5:43 PM, Bart Van Assche <bart.vanassche at sandisk.com
> wrote:
> Avoid that building against glibc >= 2.25 triggers the following
> compiler warning:
>
> lopart.c: In function 'is_loop_device':
> lopart.c:93:13: warning: 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 undefine it after including <sys/types.h>.
> major(statbuf.st_rdev) == loopmajor);
>
> Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
> ---
> kpartx/Makefile | 4 ++++
> kpartx/sysmacros.h | 6 ++++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/kpartx/Makefile b/kpartx/Makefile
> index 9441a2ba..2d2a249e 100644
> --- a/kpartx/Makefile
> +++ b/kpartx/Makefile
> @@ -10,6 +10,10 @@ LIBDEPS += -ldevmapper
> ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),
> 0)
> CFLAGS += -DLIBDM_API_COOKIE
> endif
> +ifneq ($(call check_func,major,/usr/include/sys/sysmacros.h),0)
> + CFLAGS += -DHAVE_SYS_SYSMACROS_H
> +endif
> +
>
> OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
> gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o
> diff --git a/kpartx/sysmacros.h b/kpartx/sysmacros.h
> index 171b33d4..dc5077ec 100644
> --- a/kpartx/sysmacros.h
> +++ b/kpartx/sysmacros.h
> @@ -1,5 +1,10 @@
> /* versions to be used with > 16-bit dev_t - leave unused for now */
>
> +#ifdef HAVE_SYS_SYSMACROS_H
> +#include <sys/sysmacros.h>
> +#else
> +#include <sys/types.h>
> +
> #ifndef major
> #define major(dev) ((dev) >> 8)
> #endif
> @@ -7,3 +12,4 @@
> #ifndef minor
> #define minor(dev) ((dev) & 0xff)
> #endif
> +#endif
> --
> 2.12.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20170518/312df965/attachment.htm>
More information about the dm-devel
mailing list