util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] libmount: only invoke loopcxt on linux
@ 2014-09-18 23:36 Andreas Henriksson
  2014-09-18 23:36 ` [PATCH 2/5] libmount: only include context " Andreas Henriksson
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Andreas Henriksson @ 2014-09-18 23:36 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

This is part of an attempt to make libmount buildable on non-linux.

The support for /dev/loop* is Linux-specific so just disable
it on non-linux for now.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 libmount/src/cache.c | 2 ++
 libmount/src/tab.c   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libmount/src/cache.c b/libmount/src/cache.c
index 8b2e656..fcd84fd 100644
--- a/libmount/src/cache.c
+++ b/libmount/src/cache.c
@@ -633,6 +633,7 @@ char *mnt_pretty_path(const char *path, struct libmnt_cache *cache)
 	if (!pretty)
 		return strdup("none");
 
+#ifdef __linux__
 	/* users assume backing file name rather than /dev/loopN in
 	 * output if the device has been initialized by mount(8).
 	 */
@@ -653,6 +654,7 @@ char *mnt_pretty_path(const char *path, struct libmnt_cache *cache)
 		loopcxt_deinit(&lc);
 
 	}
+#endif
 
 done:
 	/* don't return pointer to the cache, allocate a new string */
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 4094fb8..011ba54 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1439,8 +1439,10 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
 			} else
 				flags = LOOPDEV_FL_OFFSET;
 
+#if __linux__
 			if (loopdev_is_used(mnt_fs_get_srcpath(fs), src, offset, flags))
 				break;
+#endif
 		}
 
 		if (root) {
-- 
2.1.0.rc1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] libmount: only include context on linux
  2014-09-18 23:36 [PATCH 1/5] libmount: only invoke loopcxt on linux Andreas Henriksson
@ 2014-09-18 23:36 ` Andreas Henriksson
  2014-09-18 23:36 ` [PATCH 3/5] build-sys: build libmount everywhere Andreas Henriksson
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas Henriksson @ 2014-09-18 23:36 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

This is part of an attempt to make libmount buildable on non-linux.

The parts that need architecture specific porting is under
the context*.c files and the rest of libmount is useful/used
by for example fsck.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 libmount/src/Makemodule.am | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libmount/src/Makemodule.am b/libmount/src/Makemodule.am
index d21179a..5a03520 100644
--- a/libmount/src/Makemodule.am
+++ b/libmount/src/Makemodule.am
@@ -8,10 +8,6 @@ libmount_la_SOURCES = \
 	include/list.h \
 	\
 	libmount/src/cache.c \
-	libmount/src/context.c \
-	libmount/src/context_loopdev.c \
-	libmount/src/context_mount.c \
-	libmount/src/context_umount.c \
 	libmount/src/fs.c \
 	libmount/src/init.c \
 	libmount/src/iter.c \
@@ -28,6 +24,14 @@ libmount_la_SOURCES = \
 	libmount/src/version.c \
 	$(nodist_mountinc_HEADERS)
 
+if LINUX
+libmount_la_SOURCES += \
+	libmount/src/context.c \
+	libmount/src/context_loopdev.c \
+	libmount/src/context_mount.c \
+	libmount/src/context_umount.c
+endif
+
 nodist_libmount_la_SOURCES = libmount/src/mountP.h
 
 libmount_la_LIBADD = libcommon.la libblkid.la $(SELINUX_LIBS)
-- 
2.1.0.rc1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] build-sys: build libmount everywhere
  2014-09-18 23:36 [PATCH 1/5] libmount: only invoke loopcxt on linux Andreas Henriksson
  2014-09-18 23:36 ` [PATCH 2/5] libmount: only include context " Andreas Henriksson
@ 2014-09-18 23:36 ` Andreas Henriksson
  2014-09-18 23:36 ` [PATCH 4/5] build-sys: swaplabel needs libmount Andreas Henriksson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas Henriksson @ 2014-09-18 23:36 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

This enables libmount to build on non-linux, which also
means we can build fsck on non-linux again.
(Since the context part of libmount still needs porting,
building the mount utility has instead been restricted
to only build on Linux.)

This has been build-tested on Debian GNU/kFreeBSD.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 387372f..ed3a65d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -799,7 +799,6 @@ AC_ARG_ENABLE([libmount],
   [], [UL_DEFAULT_ENABLE([libmount], [check])]
 )
 UL_BUILD_INIT([libmount])
-UL_REQUIRES_LINUX([libmount])
 UL_REQUIRES_BUILD([libmount], [libblkid])
 UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
 AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
@@ -856,6 +855,7 @@ AC_ARG_ENABLE([mount],
   [], [UL_DEFAULT_ENABLE([mount], [check])]
 )
 UL_BUILD_INIT([mount])
+UL_REQUIRES_LINUX([mount])
 UL_REQUIRES_BUILD([mount], [libmount])
 AM_CONDITIONAL([BUILD_MOUNT], [test "x$build_mount" = xyes])
 
-- 
2.1.0.rc1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] build-sys: swaplabel needs libmount
  2014-09-18 23:36 [PATCH 1/5] libmount: only invoke loopcxt on linux Andreas Henriksson
  2014-09-18 23:36 ` [PATCH 2/5] libmount: only include context " Andreas Henriksson
  2014-09-18 23:36 ` [PATCH 3/5] build-sys: build libmount everywhere Andreas Henriksson
@ 2014-09-18 23:36 ` Andreas Henriksson
  2014-09-22 11:27   ` Karel Zak
  2014-09-18 23:36 ` [PATCH 5/5] logger: gettimeofday needs <sys/time.h> Andreas Henriksson
  2014-09-22 11:21 ` [PATCH 1/5] libmount: only invoke loopcxt on linux Karel Zak
  4 siblings, 1 reply; 8+ messages in thread
From: Andreas Henriksson @ 2014-09-18 23:36 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

The swaplabel utility uses libmount functionality and
thus libmount has to be available if we want to build
swaplabel. This change makes swaplabel be automatically
disabled when we don't.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index ed3a65d..f8b3397 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1143,6 +1143,7 @@ AM_CONDITIONAL([BUILD_WDCTL], [test "x$build_wdctl" = xyes])
 
 UL_BUILD_INIT([swaplabel], [check])
 UL_REQUIRES_BUILD([swaplabel], [libblkid])
+UL_REQUIRES_BUILD([swaplabel], [libmount])
 AM_CONDITIONAL([BUILD_SWAPLABEL], [test "x$build_swaplabel" = xyes])
 
 
-- 
2.1.0.rc1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] logger: gettimeofday needs <sys/time.h>
  2014-09-18 23:36 [PATCH 1/5] libmount: only invoke loopcxt on linux Andreas Henriksson
                   ` (2 preceding siblings ...)
  2014-09-18 23:36 ` [PATCH 4/5] build-sys: swaplabel needs libmount Andreas Henriksson
@ 2014-09-18 23:36 ` Andreas Henriksson
  2014-09-22 11:21 ` [PATCH 1/5] libmount: only invoke loopcxt on linux Karel Zak
  4 siblings, 0 replies; 8+ messages in thread
From: Andreas Henriksson @ 2014-09-18 23:36 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

Either works on linux, but kfreebsd build fails
if we don't use the <sys/time.h> include.

According to man gettimeofday the correct include is <sys/time.h>

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 misc-utils/logger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 99a5569..2994dc0 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -40,7 +40,7 @@
 #include <limits.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <time.h>
+#include <sys/time.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
-- 
2.1.0.rc1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] build-sys: link swapoff to libblkid
@ 2014-09-19  0:27 Andreas Henriksson
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Henriksson @ 2014-09-19  0:27 UTC (permalink / raw)
  To: util-linux; +Cc: Andreas Henriksson

The swapoff utility seems to need linking with libblkid otherwise
this build error occurs:

$ git describe
v2.25-180-g29607ed
$ ./autogen.sh && ./configure --without-python  && make
[....]
  CCLD     swapoff
/usr/bin/ld: sys-utils/swapoff-swapon-common.o: undefined reference to symbol 'blkid_probe_lookup_value@@BLKID_2.15'
//home/ah/opt/pkg-util-linux/util-linux/.libs/libblkid.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:5992: recipe for target 'swapoff' failed
make[2]: *** [swapoff] Error 1
make[2]: Leaving directory '/home/ah/opt/pkg-util-linux/util-linux'
Makefile:10220: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ah/opt/pkg-util-linux/util-linux'
Makefile:4433: recipe for target 'all' failed
make: *** [all] Error 2

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
---
 sys-utils/Makemodule.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index 058bb62..62e26f4 100644
--- a/sys-utils/Makemodule.am
+++ b/sys-utils/Makemodule.am
@@ -275,7 +275,7 @@ swapon_LDADD = $(LDADD) \
 
 swapoff_SOURCES = sys-utils/swapoff.c sys-utils/swapon-common.c
 swapoff_CFLAGS = $(AM_CFLAGS) -I$(ul_libmount_incdir) -I$(ul_libblkid_incdir)
-swapoff_LDADD = $(LDADD) libmount.la
+swapoff_LDADD = $(LDADD) libmount.la libblkid.la
 endif
 
 if BUILD_LSCPU
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/5] libmount: only invoke loopcxt on linux
  2014-09-18 23:36 [PATCH 1/5] libmount: only invoke loopcxt on linux Andreas Henriksson
                   ` (3 preceding siblings ...)
  2014-09-18 23:36 ` [PATCH 5/5] logger: gettimeofday needs <sys/time.h> Andreas Henriksson
@ 2014-09-22 11:21 ` Karel Zak
  4 siblings, 0 replies; 8+ messages in thread
From: Karel Zak @ 2014-09-22 11:21 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: util-linux

On Fri, Sep 19, 2014 at 01:36:33AM +0200, Andreas Henriksson wrote:
>  libmount/src/cache.c | 2 ++
>  libmount/src/tab.c   | 2 ++
>  2 files changed, 4 insertions(+)
 

On Fri, Sep 19, 2014 at 01:36:34AM +0200, Andreas Henriksson wrote:
>  libmount/src/Makemodule.am | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
 

On Fri, Sep 19, 2014 at 01:36:35AM +0200, Andreas Henriksson wrote:
>  configure.ac | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


On Fri, Sep 19, 2014 at 01:36:37AM +0200, Andreas Henriksson wrote:
>  misc-utils/logger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


 All applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] build-sys: swaplabel needs libmount
  2014-09-18 23:36 ` [PATCH 4/5] build-sys: swaplabel needs libmount Andreas Henriksson
@ 2014-09-22 11:27   ` Karel Zak
  0 siblings, 0 replies; 8+ messages in thread
From: Karel Zak @ 2014-09-22 11:27 UTC (permalink / raw)
  To: Andreas Henriksson; +Cc: util-linux

On Fri, Sep 19, 2014 at 01:36:36AM +0200, Andreas Henriksson wrote:
> The swaplabel utility uses libmount functionality and
> thus libmount has to be available if we want to build
> swaplabel. This change makes swaplabel be automatically
> disabled when we don't.
> ---
>  configure.ac | 1 +
>  1 file changed, 1 insertion(+)
> 

On Fri, Sep 19, 2014 at 02:27:19AM +0200, Andreas Henriksson wrote:
> The swapoff utility seems to need linking with libblkid otherwise
> this build error occurs:
> 
> $ git describe
> v2.25-180-g29607ed
> $ ./autogen.sh && ./configure --without-python  && make
> [....]
>   CCLD     swapoff
> /usr/bin/ld: sys-utils/swapoff-swapon-common.o: undefined reference to symbol 'blkid_probe_lookup_value@@BLKID_2.15'
> //home/ah/opt/pkg-util-linux/util-linux/.libs/libblkid.so.1: error adding symbols: DSO missing from command line
> collect2: error: ld returned 1 exit status
> Makefile:5992: recipe for target 'swapoff' failed
> make[2]: *** [swapoff] Error 1
> make[2]: Leaving directory '/home/ah/opt/pkg-util-linux/util-linux'
> Makefile:10220: recipe for target 'all-recursive' failed
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory '/home/ah/opt/pkg-util-linux/util-linux'
> Makefile:4433: recipe for target 'all' failed
> make: *** [all] Error 2
> 
> ---
>  sys-utils/Makemodule.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)


 I have modified swapoff, swapon and swaplabel to use separate file
 lib/swapprobe.c for libblkid stuff. So now:

    swapon    - requires libmount and libblkid
    swapoff   - requires libmount
    swaplabel - requires libblkid


 link directly both libs everywhere is overkill. Please, test the
 current git tree. Thanks!

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-09-22 11:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18 23:36 [PATCH 1/5] libmount: only invoke loopcxt on linux Andreas Henriksson
2014-09-18 23:36 ` [PATCH 2/5] libmount: only include context " Andreas Henriksson
2014-09-18 23:36 ` [PATCH 3/5] build-sys: build libmount everywhere Andreas Henriksson
2014-09-18 23:36 ` [PATCH 4/5] build-sys: swaplabel needs libmount Andreas Henriksson
2014-09-22 11:27   ` Karel Zak
2014-09-18 23:36 ` [PATCH 5/5] logger: gettimeofday needs <sys/time.h> Andreas Henriksson
2014-09-22 11:21 ` [PATCH 1/5] libmount: only invoke loopcxt on linux Karel Zak
  -- strict thread matches above, loose matches on Subject: below --
2014-09-19  0:27 [PATCH] build-sys: link swapoff to libblkid Andreas Henriksson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).