2 * volume_id - reads filesystem label and uuid
4 * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include "libvolume_id.h"
32 #include "libvolume_id-private.h"
34 #define NW_SUPERBLOCK_OFFSET 0x1000
36 struct netware_super_block {
37 uint8_t SBH_Signature[4];
38 uint16_t SBH_VersionMajor;
39 uint16_t SBH_VersionMinor;
40 uint16_t SBH_VersionMediaMajor;
41 uint16_t SBH_VersionMediaMinor;
42 uint32_t SBH_ItemsMoved;
43 uint8_t SBH_InternalID[16];
44 uint32_t SBH_PackedSize;
45 uint32_t SBH_Checksum;
47 int64_t superlocation[4];
48 uint32_t physSizeUsed;
50 uint32_t superTimeStamp;
51 uint32_t reserved0[1];
52 int64_t SBH_LoggedPoolDataBlk;
53 int64_t SBH_PoolDataBlk;
54 uint8_t SBH_OldInternalID[16];
55 uint32_t SBH_PoolToLVStartUTC;
56 uint32_t SBH_PoolToLVEndUTC;
57 uint16_t SBH_VersionMediaMajorCreate;
58 uint16_t SBH_VersionMediaMinorCreate;
59 uint32_t SBH_BlocksMoved;
60 uint32_t SBH_TempBTSpBlk;
61 uint32_t SBH_TempFTSpBlk;
62 uint32_t SBH_TempFTSpBlk1;
63 uint32_t SBH_TempFTSpBlk2;
64 uint32_t nssMagicNumber;
68 int64_t SBH_LoggedVolumeDataBlk;
69 int64_t SBH_VolumeDataBlk;
70 int64_t SBH_SystemBeastBlkNum;
72 uint16_t SBH_Name[64];
73 uint8_t SBH_VolumeID[16];
74 uint8_t SBH_PoolID[16];
75 uint8_t SBH_PoolInternalID[16];
77 uint32_t SBH_SS_Enabled;
78 uint32_t SBH_SS_CreateTime;
79 uint8_t SBH_SS_OriginalPoolID[16];
80 uint8_t SBH_SS_OriginalVolumeID[16];
81 uint8_t SBH_SS_Guid[16];
82 uint16_t SBH_SS_OriginalName[64];
83 uint32_t reserved2[64-(2+46)];
86 int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size)
88 struct netware_super_block *nw;
90 info("probing at offset 0x%" PRIx64 "\n", off);
92 nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200);
96 if (memcmp(nw->SBH_Signature, "SPB5", 4) != 0)
99 volume_id_set_uuid(id, nw->SBH_PoolID, 0, UUID_DCE);
101 snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%02u",
102 le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor));
104 volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);