2 * volume_id - reads filesystem label and uuid
4 * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
5 * Copyright (C) 2005 Tobias Klauser <tklauser@access.unizh.ch>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation version 2 of the License.
27 #include "libvolume_id.h"
31 struct reiserfs_super_block {
32 uint32_t blocks_count;
35 uint32_t journal_block;
37 uint32_t orig_journal_size;
47 struct reiser4_super_block {
55 #define REISERFS1_SUPERBLOCK_OFFSET 0x2000
56 #define REISERFS_SUPERBLOCK_OFFSET 0x10000
58 int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off)
60 struct reiserfs_super_block *rs;
61 struct reiser4_super_block *rs4;
64 dbg("probing at offset 0x%llx", (unsigned long long) off);
66 buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
70 rs = (struct reiserfs_super_block *) buf;;
71 if (memcmp(rs->magic, "ReIsErFs", 8) == 0) {
72 strcpy(id->type_version, "3.5");
73 id->type = "reiserfs";
76 if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) {
77 strcpy(id->type_version, "3.6");
78 id->type = "reiserfs";
81 if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) {
82 strcpy(id->type_version, "JR");
83 id->type = "reiserfs";
87 rs4 = (struct reiser4_super_block *) buf;
88 if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) {
89 strcpy(id->type_version, "4");
90 volume_id_set_label_raw(id, rs4->label, 16);
91 volume_id_set_label_string(id, rs4->label, 16);
92 volume_id_set_uuid(id, rs4->uuid, UUID_DCE);
97 buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200);
101 rs = (struct reiserfs_super_block *) buf;
102 if (memcmp(rs->magic, "ReIsErFs", 8) == 0) {
103 strcpy(id->type_version, "3.5");
104 id->type = "reiserfs";
111 volume_id_set_label_raw(id, rs->label, 16);
112 volume_id_set_label_string(id, rs->label, 16);
113 volume_id_set_uuid(id, rs->uuid, UUID_DCE);
116 volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);