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 library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //kbuild:lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o
24 //config:config FEATURE_VOLUMEID_REISERFS
25 //config: bool "Reiser filesystem"
27 //config: depends on VOLUMEID
29 #include "volume_id_internal.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 FAST_FUNC volume_id_probe_reiserfs(struct volume_id *id /*,uint64_t off*/)
60 #define off ((uint64_t)0)
61 struct reiserfs_super_block *rs;
62 struct reiser4_super_block *rs4;
64 dbg("reiserfs: probing at offset 0x%llx", (unsigned long long) off);
66 rs = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
70 if (memcmp(rs->magic, "ReIsErFs", 8) == 0) {
71 dbg("reiserfs: ReIsErFs, no label");
72 // strcpy(id->type_version, "3.5");
75 if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) {
76 dbg("reiserfs: ReIsEr2Fs");
77 // strcpy(id->type_version, "3.6");
80 if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) {
81 dbg("reiserfs: ReIsEr3Fs");
82 // strcpy(id->type_version, "JR");
86 rs4 = (struct reiser4_super_block *) rs;
87 if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) {
88 // strcpy(id->type_version, "4");
89 // volume_id_set_label_raw(id, rs4->label, 16);
90 volume_id_set_label_string(id, rs4->label, 16);
91 volume_id_set_uuid(id, rs4->uuid, UUID_DCE);
92 dbg("reiserfs: ReIsEr4, label '%s' uuid '%s'", id->label, id->uuid);
96 rs = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200);
100 if (memcmp(rs->magic, "ReIsErFs", 8) == 0) {
101 dbg("reiserfs: ReIsErFs, no label");
102 // strcpy(id->type_version, "3.5");
106 dbg("reiserfs: no signature found");
110 // volume_id_set_label_raw(id, rs->label, 16);
111 volume_id_set_label_string(id, rs->label, 16);
112 volume_id_set_uuid(id, rs->uuid, UUID_DCE);
113 dbg("reiserfs: label '%s' uuid '%s'", id->label, id->uuid);
116 // volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
117 IF_FEATURE_BLKID_TYPE(id->type = "reiserfs";)