X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=extras%2Fvolume_id%2Flib%2Fgfs.c;h=e1293ebce724f01e826d75faccd88c32ad42cf39;hb=e5931bb7d86226a3823bdf5f4ec01c857827d386;hp=40a4493b32710bd6fb55c6ff1ea57966d18fcccb;hpb=e55a73abb07e6949ebbf17fa08a3ddeaddbbc41f;p=elogind.git diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 40a4493b3..e1293ebce 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" /* Common gfs/gfs2 constants: */ @@ -78,7 +79,7 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v { struct gfs2_sb *sbd; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); sbd = (struct gfs2_sb *) volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb)); @@ -86,8 +87,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 +102,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; @@ -109,12 +116,12 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v return -1; } -int volume_id_probe_gfs(struct volume_id *id, uint64_t off) +int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size) { return volume_id_probe_gfs_generic(id, off, 1); } -int volume_id_probe_gfs2(struct volume_id *id, uint64_t off) +int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size) { return volume_id_probe_gfs_generic(id, off, 2); }