[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Re: master - libgfs2: Add support for UUID generation to gfs2_mkfs



On Fri, 10 Oct 2008, Steven Whitehouse wrote:

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=85049a0824daa9abaa38f5dca377767907b53b39
Commit:        85049a0824daa9abaa38f5dca377767907b53b39
Parent:        d763f902abf33655e635fc3b8b1919fd31d4f66c
Author:        Steven Whitehouse <swhiteho redhat com>
AuthorDate:    Fri Oct 10 16:04:29 2008 +0100
Committer:     Steven Whitehouse <swhiteho redhat com>
CommitterDate: Fri Oct 10 16:12:12 2008 +0100

libgfs2: Add support for UUID generation to gfs2_mkfs

nice...

Uses /dev/urandom to create 16 byte UUIDs for GFS2 filesystems
at mkfs time. Backwards and forwards compatible with all
GFS2 filesystems.

You'll need a set of kernel headers with
the new field defined in order for this feature to be
enabled. Bugzilla #242690

What kernel version is required to have UUID support? is it in .27 or will be in .28?

diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index eb4c7bd..002edb6 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -58,7 +58,17 @@ build_sb(struct gfs2_sbd *sdp)
	sb.sb_root_dir = sdp->md.rooti->i_di.di_num;
	strcpy(sb.sb_lockproto, sdp->lockproto);
	strcpy(sb.sb_locktable, sdp->locktable);
-
+#ifdef GFS2_HAS_UUID
+	{
+		int fd = open("/dev/urandom", O_RDONLY);
+		int n;
+		if (fd >= 0)
+			n = read(fd, &sb.sb_uuid, 16);
+		if (fd < 0 || n != 16)
+			memset(&sb.sb_uuid, 0, 16);
+		close(fd);
+	}
+#endif

NACK.

Please use libuuid for this operation.

Thanks
Fabio

--
I'm going to make him an offer he can't refuse.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]