[dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev

Milan Broz gmazyland at gmail.com
Tue Apr 19 08:34:31 CEST 2016


On 04/19/2016 08:16 AM, Mike Frysinger wrote:
> These functions are defined in that header, so include it when needed.
> Otherwise we can get build failures like:
> veritysetup-utils_loop.o: In function '_sysfs_backing_file':
> utils_loop.c:(.text+0x50): undefined reference to 'minor'
> utils_loop.c:(.text+0x5e): undefined reference to 'major'
> veritysetup-utils_loop.o: In function 'crypt_loop_device':
> utils_loop.c:(.text+0x638): undefined reference to 'major'
> ../lib/.libs/libcryptsetup.so: undefined reference to 'makedev'
> ---
>  lib/utils_devpath.c | 1 +
>  lib/utils_loop.c    | 1 +
>  lib/utils_wipe.c    | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/lib/utils_devpath.c b/lib/utils_devpath.c
> index 963785a..0bc0563 100644
> --- a/lib/utils_devpath.c
> +++ b/lib/utils_devpath.c
> @@ -30,6 +30,7 @@
>  #include <errno.h>
>  #include <limits.h>
>  #include <sys/stat.h>
> +#include <sys/sysmacros.h>

Shouldn't we also check for existence of this header in autoconf?
I do not think it is present on all systems (FreeBSD?).

(Basically the same like util-linux is doing now.)

Milan

>  #include <sys/types.h>
>  #include "internal.h"
>  
> diff --git a/lib/utils_loop.c b/lib/utils_loop.c
> index ff30a27..b392160 100644
> --- a/lib/utils_loop.c
> +++ b/lib/utils_loop.c
> @@ -27,6 +27,7 @@
>  #include <limits.h>
>  #include <sys/ioctl.h>
>  #include <sys/stat.h>
> +#include <sys/sysmacros.h>
>  #include <sys/types.h>
>  #include <linux/loop.h>
>  
> diff --git a/lib/utils_wipe.c b/lib/utils_wipe.c
> index 210c566..8e2a2aa 100644
> --- a/lib/utils_wipe.c
> +++ b/lib/utils_wipe.c
> @@ -29,6 +29,7 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <sys/ioctl.h>
> +#include <sys/sysmacros.h>
>  #include <fcntl.h>
>  
>  #include "libcryptsetup.h"
> 


More information about the dm-crypt mailing list