/src/util-linux/libblkid/src/superblocks/netware.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2008 Karel Zak <kzak@redhat.com> |
3 | | * |
4 | | * Inspired by libvolume_id by |
5 | | * Kay Sievers <kay.sievers@vrfy.org> |
6 | | * |
7 | | * This file may be redistributed under the terms of the |
8 | | * GNU Lesser General Public License. |
9 | | */ |
10 | | #include <stdio.h> |
11 | | #include <stdlib.h> |
12 | | #include <unistd.h> |
13 | | #include <string.h> |
14 | | #include <stdint.h> |
15 | | |
16 | | #include "superblocks.h" |
17 | | |
18 | | struct netware_super_block { |
19 | | uint8_t SBH_Signature[4]; |
20 | | uint16_t SBH_VersionMajor; |
21 | | uint16_t SBH_VersionMinor; |
22 | | uint16_t SBH_VersionMediaMajor; |
23 | | uint16_t SBH_VersionMediaMinor; |
24 | | uint32_t SBH_ItemsMoved; |
25 | | uint8_t SBH_InternalID[16]; |
26 | | uint32_t SBH_PackedSize; |
27 | | uint32_t SBH_Checksum; |
28 | | uint32_t supersyncid; |
29 | | int64_t superlocation[4]; |
30 | | uint32_t physSizeUsed; |
31 | | uint32_t sizeUsed; |
32 | | uint32_t superTimeStamp; |
33 | | uint32_t reserved0[1]; |
34 | | int64_t SBH_LoggedPoolDataBlk; |
35 | | int64_t SBH_PoolDataBlk; |
36 | | uint8_t SBH_OldInternalID[16]; |
37 | | uint32_t SBH_PoolToLVStartUTC; |
38 | | uint32_t SBH_PoolToLVEndUTC; |
39 | | uint16_t SBH_VersionMediaMajorCreate; |
40 | | uint16_t SBH_VersionMediaMinorCreate; |
41 | | uint32_t SBH_BlocksMoved; |
42 | | uint32_t SBH_TempBTSpBlk; |
43 | | uint32_t SBH_TempFTSpBlk; |
44 | | uint32_t SBH_TempFTSpBlk1; |
45 | | uint32_t SBH_TempFTSpBlk2; |
46 | | uint32_t nssMagicNumber; |
47 | | uint32_t poolClassID; |
48 | | uint32_t poolID; |
49 | | uint32_t createTime; |
50 | | int64_t SBH_LoggedVolumeDataBlk; |
51 | | int64_t SBH_VolumeDataBlk; |
52 | | int64_t SBH_SystemBeastBlkNum; |
53 | | uint64_t totalblocks; |
54 | | uint16_t SBH_Name[64]; |
55 | | uint8_t SBH_VolumeID[16]; |
56 | | uint8_t SBH_PoolID[16]; |
57 | | uint8_t SBH_PoolInternalID[16]; |
58 | | uint64_t SBH_Lsn; |
59 | | uint32_t SBH_SS_Enabled; |
60 | | uint32_t SBH_SS_CreateTime; |
61 | | uint8_t SBH_SS_OriginalPoolID[16]; |
62 | | uint8_t SBH_SS_OriginalVolumeID[16]; |
63 | | uint8_t SBH_SS_Guid[16]; |
64 | | uint16_t SBH_SS_OriginalName[64]; |
65 | | uint32_t reserved2[64-(2+46)]; |
66 | | } __attribute__((__packed__)); |
67 | | |
68 | | static int probe_netware(blkid_probe pr, const struct blkid_idmag *mag) |
69 | 58 | { |
70 | 58 | const struct netware_super_block *nw; |
71 | | |
72 | 58 | nw = blkid_probe_get_sb(pr, mag, struct netware_super_block); |
73 | 58 | if (!nw) |
74 | 0 | return errno ? -errno : 1; |
75 | | |
76 | 58 | blkid_probe_set_uuid(pr, nw->SBH_PoolID); |
77 | | |
78 | 58 | blkid_probe_sprintf_version(pr, "%u.%02u", |
79 | 58 | le16_to_cpu(nw->SBH_VersionMediaMajor), |
80 | 58 | le16_to_cpu(nw->SBH_VersionMediaMinor)); |
81 | | |
82 | 58 | return 0; |
83 | 58 | } |
84 | | |
85 | | const struct blkid_idinfo netware_idinfo = |
86 | | { |
87 | | .name = "nss", |
88 | | .usage = BLKID_USAGE_FILESYSTEM, |
89 | | .probefunc = probe_netware, |
90 | | .magics = |
91 | | { |
92 | | { .magic = "SPB5", .len = 4, .kboff = 4 }, |
93 | | { NULL } |
94 | | } |
95 | | }; |
96 | | |
97 | | |