* [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev
@ 2016-04-19 6:16 Mike Frysinger
2016-04-19 6:34 ` Milan Broz
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2016-04-19 6:16 UTC (permalink / raw)
To: gmazyland; +Cc: dm-crypt
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>
#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"
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev
2016-04-19 6:16 [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev Mike Frysinger
@ 2016-04-19 6:34 ` Milan Broz
2016-04-19 6:53 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Milan Broz @ 2016-04-19 6:34 UTC (permalink / raw)
To: Mike Frysinger; +Cc: dm-crypt
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"
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev
2016-04-19 6:34 ` Milan Broz
@ 2016-04-19 6:53 ` Mike Frysinger
2016-04-19 9:06 ` Milan Broz
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2016-04-19 6:53 UTC (permalink / raw)
To: Milan Broz; +Cc: dm-crypt
[-- Attachment #1: Type: text/plain, Size: 1522 bytes --]
On 19 Apr 2016 08:34, Milan Broz wrote:
> 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?).
i couldn't tell how portable this code base was trying to be or if it
was assuming Linux. if you want to be portable w/autoconf, should be
easy to do:
(1) call AC_HEADER_MAJOR in configure.ac
(2) use the idiom:
#ifdef MAJOR_IN_MKDEV
# include <sys/mkdev.h>
#elif defined(MAJOR_IN_SYSMACROS)
# include <sys/sysmacros.h>
#endif
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev
2016-04-19 6:53 ` Mike Frysinger
@ 2016-04-19 9:06 ` Milan Broz
2016-04-19 15:22 ` Mike Frysinger
0 siblings, 1 reply; 5+ messages in thread
From: Milan Broz @ 2016-04-19 9:06 UTC (permalink / raw)
To: Mike Frysinger; +Cc: dm-crypt
On 04/19/2016 08:53 AM, Mike Frysinger wrote:
> On 19 Apr 2016 08:34, Milan Broz wrote:
>> On 04/19/2016 08:16 AM, Mike Frysinger wrote:
...
>>> +#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?).
>
> i couldn't tell how portable this code base was trying to be or if it
> was assuming Linux. if you want to be portable w/autoconf, should be
> easy to do:
> (1) call AC_HEADER_MAJOR in configure.ac
> (2) use the idiom:
> #ifdef MAJOR_IN_MKDEV
> # include <sys/mkdev.h>
> #elif defined(MAJOR_IN_SYSMACROS)
> # include <sys/sysmacros.h>
> #endif
I fixed it with this commit
https://gitlab.com/cryptsetup/cryptsetup/commit/54c4b1656f93997ae5624051c91ea10249e5a823
Thanks,
Milan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev
2016-04-19 9:06 ` Milan Broz
@ 2016-04-19 15:22 ` Mike Frysinger
0 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2016-04-19 15:22 UTC (permalink / raw)
To: Milan Broz; +Cc: dm-crypt
[-- Attachment #1: Type: text/plain, Size: 923 bytes --]
On 19 Apr 2016 11:06, Milan Broz wrote:
> On 04/19/2016 08:53 AM, Mike Frysinger wrote:
> > On 19 Apr 2016 08:34, Milan Broz wrote:
> >> On 04/19/2016 08:16 AM, Mike Frysinger wrote:
> ...
> >>> +#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?).
> >
> > i couldn't tell how portable this code base was trying to be or if it
> > was assuming Linux. if you want to be portable w/autoconf, should be
> > easy to do:
> > (1) call AC_HEADER_MAJOR in configure.ac
> > (2) use the idiom:
> > #ifdef MAJOR_IN_MKDEV
> > # include <sys/mkdev.h>
> > #elif defined(MAJOR_IN_SYSMACROS)
> > # include <sys/sysmacros.h>
> > #endif
>
> I fixed it with this commit
> https://gitlab.com/cryptsetup/cryptsetup/commit/54c4b1656f93997ae5624051c91ea10249e5a823
that'll work for us too. thanks!
-mike
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-19 15:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-19 6:16 [dm-crypt] [PATCH] include sys/sysmacros.h for major/minor/makedev Mike Frysinger
2016-04-19 6:34 ` Milan Broz
2016-04-19 6:53 ` Mike Frysinger
2016-04-19 9:06 ` Milan Broz
2016-04-19 15:22 ` Mike Frysinger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.