Linux-EROFS Archive on lore.kernel.org
 help / color / Atom feed
* 撤回: [PATCH 2/2] erofs-utils: support 128-bit filesystem UUID
@ 2019-11-07  7:22 Gaoxiang (xiang, OS Lab)
  2019-11-07  8:57 ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: Gaoxiang (xiang, OS Lab) @ 2019-11-07  7:22 UTC (permalink / raw)
  To: liguifu (C), Yuchao (T); +Cc: miaoxie \(A\), linux-erofs

Gaoxiang (xiang, OS Lab) 将撤回邮件“[PATCH 2/2] erofs-utils: support 128-bit filesystem UUID”。

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

* Re: 撤回: [PATCH 2/2] erofs-utils: support 128-bit filesystem UUID
  2019-11-07  7:22 撤回: [PATCH 2/2] erofs-utils: support 128-bit filesystem UUID Gaoxiang (xiang, OS Lab)
@ 2019-11-07  8:57 ` Gao Xiang
  0 siblings, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2019-11-07  8:57 UTC (permalink / raw)
  To: liguifu (C), Yuchao (T); +Cc: linux-erofs, miaoxie \(A\)

On Thu, Nov 07, 2019 at 07:22:20AM +0000, Gaoxiang (xiang, OS Lab) wrote:
> Gaoxiang (xiang, OS Lab) 将撤回邮件“[PATCH 2/2] erofs-utils: support 128-bit filesystem UUID”。

Oops, it seems our mailing server went wrong since no mail
sent out successfully hours later.

Please ignore this email. :(

Thanks,
Gao Xiang


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

* [PATCH 2/2] erofs-utils: support 128-bit filesystem UUID
  2019-11-07  4:03 [PATCH v10 1/2] erofs-utils: support calculating checksum of superblock Gao Xiang
@ 2019-11-07  4:03 ` Gao Xiang
  0 siblings, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2019-11-07  4:03 UTC (permalink / raw)
  To: Li Guifu, Chao Yu; +Cc: Miao Xie, linux-erofs

Introduce filesystem UUID and a new feature_compat
flag to indicate uuid field is available.

Cc: Chao Yu <yuchao0@huawei.com>
Cc: Li Guifu <bluce.liguifu@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
---
 configure.ac             | 18 ++++++++++++++++++
 include/erofs/internal.h |  1 +
 include/erofs_fs.h       |  1 +
 mkfs/Makefile.am         |  3 ++-
 mkfs/main.c              | 18 ++++++++++++++++++
 5 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a93767f61578..c4d3af6a3a43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,10 @@ AC_ARG_ENABLE(lz4,
    [AS_HELP_STRING([--disable-lz4], [disable LZ4 compression support @<:@default=enabled@:>@])],
    [enable_lz4="$enableval"], [enable_lz4="yes"])
 
+AC_ARG_WITH(uuid,
+   [AS_HELP_STRING([--without-uuid],
+      [Ignore presence of libuuid and disable uuid support @<:@default=enabled@:>@])])
+
 # Checks for libraries.
 # Use customized LZ4 library path when specified.
 AC_ARG_WITH(lz4-incdir,
@@ -172,6 +176,20 @@ fi
 AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"])
 AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"])
 
+# Configure libuuid
+AS_IF([test "x$with_uuid" != "xno"],
+   [PKG_CHECK_MODULES([libuuid], [uuid],
+      [have_uuid=yes], [have_uuid=no])],
+   [have_uuid=no]
+)
+
+AS_IF([test "x$have_uuid" = "xyes"],
+   [AC_DEFINE([HAVE_LIBUUID], 1, [Define to 1 if libuuid is found])],
+   [AS_IF([test "x$with_uuid" = "xyes"],
+      [AC_MSG_ERROR([uuid support requested but libuuid not found])]
+   )]
+)
+
 AC_CONFIG_FILES([Makefile
 		 man/Makefile
 		 lib/Makefile
diff --git a/include/erofs/internal.h b/include/erofs/internal.h
index 9e2bb9ce33b6..e13adda12257 100644
--- a/include/erofs/internal.h
+++ b/include/erofs/internal.h
@@ -56,6 +56,7 @@ struct erofs_sb_info {
 	u32 feature_incompat;
 	u64 build_time;
 	u32 build_time_nsec;
+	u8 uuid[16];
 };
 
 /* global sbi */
diff --git a/include/erofs_fs.h b/include/erofs_fs.h
index bcc4f0c630ad..66844dc627f5 100644
--- a/include/erofs_fs.h
+++ b/include/erofs_fs.h
@@ -14,6 +14,7 @@
 #define EROFS_SUPER_OFFSET      1024
 
 #define EROFS_FEATURE_COMPAT_SB_CHKSUM		0x00000001
+#define EROFS_FEATURE_COMPAT_SB_UUID		0x00000002
 
 /*
  * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
diff --git a/mkfs/Makefile.am b/mkfs/Makefile.am
index 257f86422bae..9ce06d654d3d 100644
--- a/mkfs/Makefile.am
+++ b/mkfs/Makefile.am
@@ -3,7 +3,8 @@
 
 AUTOMAKE_OPTIONS = foreign
 bin_PROGRAMS     = mkfs.erofs
+AM_CPPFLAGS = ${libuuid_CFLAGS}
 mkfs_erofs_SOURCES = main.c
 mkfs_erofs_CFLAGS = -Wall -Werror -I$(top_srcdir)/include
-mkfs_erofs_LDADD = $(top_builddir)/lib/liberofs.la
+mkfs_erofs_LDADD = $(top_builddir)/lib/liberofs.la ${libuuid_LIBS}
 
diff --git a/mkfs/main.c b/mkfs/main.c
index 9187c43ed671..e42b10f754b6 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -22,6 +22,10 @@
 #include "erofs/compress.h"
 #include "erofs/xattr.h"
 
+#ifdef HAVE_LIBUUID
+#include <uuid/uuid.h>
+#endif
+
 #define EROFS_SUPER_END (EROFS_SUPER_OFFSET + sizeof(struct erofs_super_block))
 
 static struct option long_options[] = {
@@ -234,6 +238,7 @@ int erofs_mkfs_update_super_block(struct erofs_buffer_head *bh,
 	*blocks         = erofs_mapbh(NULL, true);
 	sb.blocks       = cpu_to_le32(*blocks);
 	sb.root_nid     = cpu_to_le16(root_nid);
+	memcpy(sb.uuid, sbi.uuid, sizeof(sb.uuid));
 
 	buf = calloc(sb_blksize, 1);
 	if (!buf) {
@@ -305,6 +310,18 @@ static int erofs_mkfs_superblock_csum_set(void)
 	return 0;
 }
 
+static void erofs_mkfs_generate_uuid(void)
+{
+	char uuid_str[37] = "not available";
+
+#ifdef HAVE_LIBUUID
+	uuid_generate(sbi.uuid);
+	uuid_unparse_lower(sbi.uuid, uuid_str);
+	sbi.feature_compat |= EROFS_FEATURE_COMPAT_SB_UUID;
+#endif
+	erofs_info("filesystem UUID: %s", uuid_str);
+}
+
 int main(int argc, char **argv)
 {
 	int err = 0;
@@ -376,6 +393,7 @@ int main(int argc, char **argv)
 		goto exit;
 	}
 
+	erofs_mkfs_generate_uuid();
 	erofs_inode_manager_init();
 
 	err = erofs_build_shared_xattrs_from_path(cfg.c_src_path);
-- 
2.17.1


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07  7:22 撤回: [PATCH 2/2] erofs-utils: support 128-bit filesystem UUID Gaoxiang (xiang, OS Lab)
2019-11-07  8:57 ` Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2019-11-07  4:03 [PATCH v10 1/2] erofs-utils: support calculating checksum of superblock Gao Xiang
2019-11-07  4:03 ` [PATCH 2/2] erofs-utils: support 128-bit filesystem UUID Gao Xiang

Linux-EROFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-erofs/0 linux-erofs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-erofs linux-erofs/ https://lore.kernel.org/linux-erofs \
		linux-erofs@lists.ozlabs.org linux-erofs@ozlabs.org
	public-inbox-index linux-erofs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linux-erofs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git