chiark / gitweb /
volume_id: enable GFS probing code, add LABEL support
authorKarel Zak <kzak@redhat.com>
Wed, 28 May 2008 10:25:09 +0000 (12:25 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 28 May 2008 18:07:17 +0000 (20:07 +0200)
 * enables GFS/GFS2 probing code (it's disabled now!)

 * adds support for LABELs -- it seems that locktable name is usable as
   a LABEL (at least according to libblkid).

 * removes extra check of sb_header.mh_format -- nothing in kernel and
   blkid checks this superblock entry. It seems that check GFS_MAGIC and
   GFS_METATYPE_SB is enough.

Signed-off-by: Karel Zak <kzak@redhat.com>
extras/volume_id/README
extras/volume_id/lib/gfs.c
extras/volume_id/lib/volume_id.c

index 217be3114c8e8a55340925237ffcc476dae64e38..01b4c446c6409e48df4e43e7bdc0d5907327333d 100644 (file)
@@ -40,7 +40,7 @@ minix                  *      -      -     *
 ocfs (1, 2)            *      *      *     *
 vxfs                   *      -      -     *
 nss (netware)          *             *     *
-gfs, gfs2              *      -      -     -
+gfs, gfs2              *      *      -     -
 
 Raid members are detected to prevent the probing for a filesystem
 -----------------------------------------------------------------
index 53382222ac48cd18853cf8a8f87069a8ca460d4c..2cb16a8693a606387890803e6dce24dc724314f6 100644 (file)
@@ -86,8 +86,7 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v
                return -1;
 
        if (be32_to_cpu(sbd->sb_header.mh_magic) == GFS_MAGIC &&
-               be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB &&
-               be32_to_cpu(sbd->sb_header.mh_format) == GFS_FORMAT_SB) {
+               be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB) {
                if (vers == 1) {
                        if (be32_to_cpu(sbd->sb_fs_format) != GFS_FORMAT_FS ||
                                be32_to_cpu(sbd->sb_multihost_format) != GFS_FORMAT_MULTI)
@@ -102,6 +101,13 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v
                }
                else
                        return -1;
+
+               if (strlen(sbd->sb_locktable)) {
+                       uint8_t *label = (uint8_t *) sbd->sb_locktable;
+
+                       volume_id_set_label_raw(id, label, GFS_LOCKNAME_LEN);
+                       volume_id_set_label_string(id, label, GFS_LOCKNAME_LEN);
+               }
                strcpy(id->type_version, "1");
                volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
                return 0;
index bb909c99569ec479d554e48c5b63e2f8b3df5cac..baeaa9f74e0def5d444ee63747b8fbfc92616f2d 100644 (file)
@@ -70,6 +70,8 @@ static const struct prober prober_filesystem[] = {
        { volume_id_probe_hpfs, { "hpfs", } },
        { volume_id_probe_sysv, { "sysv", "xenix", } },
        { volume_id_probe_minix, { "minix",  } },
+       { volume_id_probe_gfs, { "gfs", } },
+       { volume_id_probe_gfs2, { "gfs2", } },
        { volume_id_probe_ocfs1, { "ocfs1", } },
        { volume_id_probe_ocfs2, { "ocfs2", } },
        { volume_id_probe_vxfs, { "vxfs", } },