Skip to contentSkip to conversation

libmount: define BTRFS_TEST_MAGIC if missing

PATCH Applied Bernhard Voelker 2 participants 2 messages Mar 5, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libmount: define BTRFS_TEST_MAGIC if missing

The patch below avoid the following compile error:

libmount/src/utils.c: In function 'mnt_statfs_get_fstype':
libmount/src/utils.c:397:7: error: 'BTRFS_TEST_MAGIC' undeclared (first use in this function)

    case BTRFS_TEST_MAGIC:  return "btrfs";
         ^

libmount/src/utils.c:397:7: note: each undeclared identifier is reported only once for each function it appears in

Have a nice day,
Berny

From 2a5ed00775aa558a71be462c05ded86ad3e632d9 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <[email protected]>
Date: Wed, 5 Mar 2014 11:52:13 +0100
Subject: [PATCH] libmount: define BTRFS_TEST_MAGIC if missing

* libmount/src/utils.c (BTRFS_TEST_MAGIC): Conditionally add define which is used since commit v2.24-243-g6a52473.

---
 libmount/src/utils.c | 3 +++
 1 file changed, 3 insertions(+)
libmount/src/utils.c +3 -0
index d402b7e..2541a22 100644
@@ -333,6 +333,9 @@ int mnt_fstype_is_netfs(const char *type)
 #ifndef CONFIGFS_SUPER_MAGIC
 # define CONFIGFS_SUPER_MAGIC	0x62656570
 #endif
+#ifndef BTRFS_TEST_MAGIC
+# define BTRFS_TEST_MAGIC	0x73727279
+#endif
 
 const char *mnt_statfs_get_fstype(struct statfs *vfs)
 {
Signature · 1 line
1.8.4.2
maintainer Applied
#1 lore raw
Quoted 2 lines · Bernhard Voelker

* libmount/src/utils.c (BTRFS_TEST_MAGIC): Conditionally add define which is used since commit v2.24-243-g6a52473.

Applied, thanks.

Unfortunately, this is not end of the statfs f_type horror -- all depends on kernel headers version, stuff in linux/magic.h, etc. And the list of the filesystems is also not complete.

So I guess we will see more reports...

Maybe the best would be to create our private include/statfs_magic.h with ifndef-define for all filesystems.

I'm trying to cleanup this thing in kernel tree, but the result is doubtful

http://www.spinics.net/lists/linux-fsdevel/threads.html#73297

and we still need compatibility with already released kernels.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com