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