]> git.ipfire.org Git - thirdparty/util-linux.git/blob - include/pt-sun.h
dmesg: add --follow-new
[thirdparty/util-linux.git] / include / pt-sun.h
1 #ifndef UTIL_LINUX_PT_SUN_H
2 #define UTIL_LINUX_PT_SUN_H
3
4 #include <stdint.h>
5
6 #define SUN_LABEL_MAGIC 0xDABE
7
8 /* Supported VTOC setting */
9 #define SUN_VTOC_SANITY 0x600DDEEE /* magic number */
10 #define SUN_VTOC_VERSION 1
11 #define SUN_MAXPARTITIONS 8
12
13 struct sun_disklabel {
14 unsigned char label_id[128]; /* Informative text string */
15
16 struct sun_vtoc {
17 uint32_t version; /* version */
18 char volume_id[8];/* volume name */
19 uint16_t nparts; /* num of partitions */
20
21 struct sun_info { /* partition information */
22 uint16_t id; /* SUN_TAG_* */
23 uint16_t flags; /* SUN_FLAG_* */
24 } __attribute__ ((packed)) infos[8];
25
26 uint16_t padding; /* padding */
27 uint32_t bootinfo[3]; /* info needed by mboot */
28 uint32_t sanity; /* magic number */
29 uint32_t reserved[10]; /* padding */
30 uint32_t timestamp[8]; /* partition timestamp */
31 } __attribute__ ((packed)) vtoc;
32
33 uint32_t write_reinstruct; /* sectors to skip, writes */
34 uint32_t read_reinstruct; /* sectors to skip, reads */
35 unsigned char spare[148]; /* padding */
36 uint16_t rpm; /* disk rotational speed */
37 uint16_t pcyl; /* physical cylinder count */
38 uint16_t apc; /* extra sects per cylinder */
39 uint16_t obs1;
40 uint16_t obs2;
41 uint16_t intrlv; /* interleave factor */
42 uint16_t ncyl; /* data cylinder count */
43 uint16_t acyl; /* alt. cylinder count */
44 uint16_t nhead; /* tracks per cylinder <---- */
45 uint16_t nsect; /* sectors per track <---- */
46 uint16_t obs3;
47 uint16_t obs4;
48
49 struct sun_partition { /* partitions */
50 uint32_t start_cylinder;
51 uint32_t num_sectors;
52 } __attribute__ ((packed)) partitions[8];
53
54 uint16_t magic; /* magic number */
55 uint16_t csum; /* label xor'd checksum */
56 } __attribute__ ((packed));
57
58
59 #define SUN_TAG_UNASSIGNED 0x00 /* Unassigned partition */
60 #define SUN_TAG_BOOT 0x01 /* Boot partition */
61 #define SUN_TAG_ROOT 0x02 /* Root filesystem */
62 #define SUN_TAG_SWAP 0x03 /* Swap partition */
63 #define SUN_TAG_USR 0x04 /* /usr filesystem */
64 #define SUN_TAG_WHOLEDISK 0x05 /* Full-disk slice */
65 #define SUN_TAG_STAND 0x06 /* Stand partition */
66 #define SUN_TAG_VAR 0x07 /* /var filesystem */
67 #define SUN_TAG_HOME 0x08 /* /home filesystem */
68 #define SUN_TAG_ALTSCTR 0x09 /* Alt sector partition */
69 #define SUN_TAG_CACHE 0x0a /* Cachefs partition */
70 #define SUN_TAG_RESERVED 0x0b /* SMI reserved data */
71 #define SUN_TAG_LINUX_SWAP 0x82 /* Linux SWAP */
72 #define SUN_TAG_LINUX_NATIVE 0x83 /* Linux filesystem */
73 #define SUN_TAG_LINUX_LVM 0x8e /* Linux LVM */
74 #define SUN_TAG_LINUX_RAID 0xfd /* LInux RAID */
75
76 #define SUN_FLAG_UNMNT 0x01 /* Unmountable partition*/
77 #define SUN_FLAG_RONLY 0x10 /* Read only */
78
79 static inline uint16_t sun_pt_checksum(const struct sun_disklabel *label)
80 {
81 const uint16_t *ptr = ((const uint16_t *) (label + 1)) - 1;
82 uint16_t sum;
83
84 for (sum = 0; ptr >= ((const uint16_t *) label);)
85 sum ^= *ptr--;
86
87 return sum;
88 }
89
90 #endif /* UTIL_LINUX_PT_SUN_H */