diff options
author | Karel Zak | 2013-05-29 13:17:06 +0200 |
---|---|---|
committer | Karel Zak | 2013-09-16 16:46:57 +0200 |
commit | 1c314b318307ee8f0c1366b31ee26d44210db111 (patch) | |
tree | 9b90c5d73fde1d047a272c7158caff4eae8aca23 /libblkid/src | |
parent | libfdisk: make it possible to reset device properties (diff) | |
download | kernel-qcow2-util-linux-1c314b318307ee8f0c1366b31ee26d44210db111.tar.gz kernel-qcow2-util-linux-1c314b318307ee8f0c1366b31ee26d44210db111.tar.xz kernel-qcow2-util-linux-1c314b318307ee8f0c1366b31ee26d44210db111.zip |
libblkid: move SGI disklabel definitions to include/
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src')
-rw-r--r-- | libblkid/src/partitions/sgi.c | 80 |
1 files changed, 3 insertions, 77 deletions
diff --git a/libblkid/src/partitions/sgi.c b/libblkid/src/partitions/sgi.c index b292e7150..bcde84f2a 100644 --- a/libblkid/src/partitions/sgi.c +++ b/libblkid/src/partitions/sgi.c @@ -13,81 +13,7 @@ #include <stdint.h> #include "partitions.h" - -#define SGI_MAXPARTITIONS 16 - -/* partition type */ -#define SGI_TYPE_VOLHDR 0x00 -#define SGI_TYPE_VOLULME 0x06 /* entire disk */ - -struct sgi_device_parameter { - unsigned char skew; - unsigned char gap1; - unsigned char gap2; - unsigned char sparecyl; - - uint16_t pcylcount; - uint16_t head_vol0; - uint16_t ntrks; /* tracks in cyl 0 or vol 0 */ - - unsigned char cmd_tag_queue_depth; - unsigned char unused0; - - uint16_t unused1; - uint16_t nsect; /* sectors/tracks in cyl 0 or vol 0 */ - uint16_t bytes; - uint16_t ilfact; - uint32_t flags; /* controller flags */ - uint32_t datarate; - uint32_t retries_on_error; - uint32_t ms_per_word; - uint16_t xylogics_gap1; - uint16_t xylogics_syncdelay; - uint16_t xylogics_readdelay; - uint16_t xylogics_gap2; - uint16_t xylogics_readgate; - uint16_t xylogics_writecont; -} __attribute__((packed)); - -struct sgi_disklabel { - uint32_t magic; /* magic number */ - uint16_t root_part_num; /* # root partition */ - uint16_t swap_part_num; /* # swap partition */ - unsigned char boot_file[16]; /* name of boot file */ - - struct sgi_device_parameter devparam; /* not used now */ - - struct sgi_volume { - unsigned char name[8]; /* name of volume */ - uint32_t block_num; /* logical block number */ - uint32_t num_bytes; /* how big, in bytes */ - } __attribute__((packed)) volume[15]; - - struct sgi_partition { - uint32_t num_blocks; /* size in logical blocks */ - uint32_t first_block; /* first logical block */ - uint32_t type; /* type of this partition */ - } __attribute__((packed)) partitions[SGI_MAXPARTITIONS]; - - /* checksum is the 32bit 2's complement sum of the disklabel */ - uint32_t csum; /* disk label checksum */ - uint32_t padding; /* padding */ -} __attribute__((packed)); - -static uint32_t count_checksum(struct sgi_disklabel *label) -{ - int i; - uint32_t *ptr = (uint32_t *) label; - uint32_t sum = 0; - - i = sizeof(*label) / sizeof(*ptr); - - while (i--) - sum += be32_to_cpu(ptr[i]); - - return sum; -} - +#include "pt-sgi.h" static int probe_sgi_pt(blkid_probe pr, const struct blkid_idmag *mag __attribute__((__unused__))) @@ -102,7 +28,7 @@ static int probe_sgi_pt(blkid_probe pr, if (!l) goto nothing; - if (count_checksum(l)) { + if (sgi_pt_checksum(l)) { DBG(LOWPROBE, blkid_debug( "detected corrupted sgi disk label -- ignore")); goto nothing; @@ -126,7 +52,7 @@ static int probe_sgi_pt(blkid_probe pr, uint32_t type = be32_to_cpu(p->type); blkid_partition par; - if (size == 0 || type == SGI_TYPE_VOLULME || + if (size == 0 || type == SGI_TYPE_ENTIRE_DISK || type == SGI_TYPE_VOLHDR) { blkid_partlist_increment_partno(ls); continue; |