2 * No copyright is claimed. This code is in the public domain; do with
5 #ifndef UTIL_LINUX_PT_SGI_H
6 #define UTIL_LINUX_PT_SGI_H
10 #define SGI_LABEL_MAGIC 0x0be5a941
12 #define SGI_MAXPARTITIONS 16
13 #define SGI_MAXVOLUMES 15
17 SGI_TYPE_VOLHDR
= 0x00,
18 SGI_TYPE_TRKREPL
= 0x01,
19 SGI_TYPE_SECREPL
= 0x02,
23 SGI_TYPE_ENTIRE_DISK
= 0x06,
26 SGI_TYPE_RLVOL
= 0x09,
28 SGI_TYPE_XFSLOG
= 0x0b,
33 struct sgi_device_parameter
{
37 unsigned char sparecyl
;
41 uint16_t ntrks
; /* tracks in cyl 0 or vol 0 */
43 unsigned char cmd_tag_queue_depth
;
44 unsigned char unused0
;
47 uint16_t nsect
; /* sectors/tracks in cyl 0 or vol 0 */
50 uint32_t flags
; /* SGI_DEVPARAM_* controller flags */
52 uint32_t retries_on_error
;
54 uint16_t xylogics_gap1
;
55 uint16_t xylogics_syncdelay
;
56 uint16_t xylogics_readdelay
;
57 uint16_t xylogics_gap2
;
58 uint16_t xylogics_readgate
;
59 uint16_t xylogics_writecont
;
60 } __attribute__((packed
));
63 SGI_DEVPARAM_SECTOR_SLIP
= 0x01,
64 SGI_DEVPARAM_SECTOR_FWD
= 0x02,
65 SGI_DEVPARAM_TRACK_FWD
= 0x04,
66 SGI_DEVPARAM_TRACK_MULTIVOL
= 0x08,
67 SGI_DEVPARAM_IGNORE_ERRORS
= 0x10,
68 SGI_DEVPARAM_RESEEK
= 0x20,
69 SGI_DEVPARAM_CMDTAGQ_ENABLE
= 0x40
73 struct sgi_disklabel
{
74 uint32_t magic
; /* magic number */
75 uint16_t root_part_num
; /* # root partition */
76 uint16_t swap_part_num
; /* # swap partition */
77 unsigned char boot_file
[16]; /* name of boot file */
79 struct sgi_device_parameter devparam
; /* not used now */
82 unsigned char name
[8]; /* name of volume */
83 uint32_t block_num
; /* logical block number */
84 uint32_t num_bytes
; /* how big, in bytes */
85 } __attribute__((packed
)) volume
[SGI_MAXVOLUMES
];
87 struct sgi_partition
{
88 uint32_t num_blocks
; /* size in logical blocks */
89 uint32_t first_block
; /* first logical block */
90 uint32_t type
; /* type of this partition */
91 } __attribute__((packed
)) partitions
[SGI_MAXPARTITIONS
];
93 /* checksum is the 32bit 2's complement sum of the disklabel */
94 uint32_t csum
; /* disk label checksum */
95 uint32_t padding
; /* padding */
96 } __attribute__((packed
));
98 static inline uint32_t sgi_pt_checksum(struct sgi_disklabel
*label
)
102 unsigned char *ptr
= (unsigned char *) label
;
104 count
= sizeof(*label
) / sizeof(uint32_t);
105 ptr
+= sizeof(uint32_t) * (count
- 1);
110 memcpy(&val
, ptr
, sizeof(uint32_t));
111 sum
-= be32_to_cpu(val
);
113 ptr
-= sizeof(uint32_t);
119 #endif /* UTIL_LINUX_PT_SGI_H */