chiark / gitweb /
volume_id: support for GFS2 UUIDs
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 10 Oct 2008 10:54:46 +0000 (11:54 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Mon, 13 Oct 2008 01:23:31 +0000 (03:23 +0200)
extras/volume_id/README
extras/volume_id/lib/gfs.c

index 0c5e37f9691c2fb00ec124b8e5b18a6e80e8cafc..44a9a875f339043ec73c49628291b16f8b898b06 100644 (file)
@@ -40,7 +40,7 @@ minix                  *      -      -     *
 ocfs (1, 2)            *      *      *     *
 vxfs                   *      -      -     *
 nss (netware)          *             *     *
 ocfs (1, 2)            *      *      *     *
 vxfs                   *      -      -     *
 nss (netware)          *             *     *
-gfs, gfs2              *      *      -     -
+gfs, gfs2              *      *      *     -
 oracleasm              *      *      -     -
 
 Raid members are detected to prevent the probing for a filesystem
 oracleasm              *      *      -     -
 
 Raid members are detected to prevent the probing for a filesystem
index 25f96f668bd569a0ff7bbf9640d04125bd9ed01b..d97730c7a4d9b8a5aaff11b4e3b2ef89aa5e2266 100644 (file)
@@ -76,9 +76,22 @@ struct gfs2_sb {
 
        char sb_lockproto[GFS_LOCKNAME_LEN];
        char sb_locktable[GFS_LOCKNAME_LEN];
 
        char sb_lockproto[GFS_LOCKNAME_LEN];
        char sb_locktable[GFS_LOCKNAME_LEN];
-       /* In gfs1, quota and license dinodes followed */
+
+       struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
+       struct gfs2_inum __pad4; /* Was licence inode in gfs1 */
+       uint8_t sb_uuid[16]; /* The UUID maybe 0 for backwards compat */
 } PACKED;
 
 } PACKED;
 
+static int uuid_non_zero(const uint8_t *p)
+{
+       int i;
+       for (i = 0; i < 16; i++) {
+               if (p[i] != 0)
+                       return 1;
+       }
+       return 0;
+}
+
 static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers)
 {
        struct gfs2_sb *sbd;
 static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers)
 {
        struct gfs2_sb *sbd;
@@ -113,6 +126,8 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v
                        volume_id_set_label_raw(id, label, GFS_LOCKNAME_LEN);
                        volume_id_set_label_string(id, label, GFS_LOCKNAME_LEN);
                }
                        volume_id_set_label_raw(id, label, GFS_LOCKNAME_LEN);
                        volume_id_set_label_string(id, label, GFS_LOCKNAME_LEN);
                }
+               if (vers == 2 && uuid_non_zero(sbd->sb_uuid))
+                       volume_id_set_uuid(id, sbd->sb_uuid, 0, UUID_DCE);
                strcpy(id->type_version, "1");
                volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
                return 0;
                strcpy(id->type_version, "1");
                volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
                return 0;