mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-17 14:48:20 +00:00
committed by
Christian Helmuth
parent
15141f3ca7
commit
807be83b1b
@ -126,7 +126,7 @@ class Gpt : public Block::Partition_table
|
||||
PLOGV(" gpe crc: %x", _gpe_crc);
|
||||
}
|
||||
|
||||
bool is_valid(bool check_primary = true)
|
||||
bool valid(bool check_primary = true)
|
||||
{
|
||||
dump_hdr(check_primary);
|
||||
|
||||
@ -156,7 +156,7 @@ class Gpt : public Block::Partition_table
|
||||
if (check_primary) {
|
||||
/* check backup gpt header */
|
||||
Sector backup_hdr(_backup_hdr_lba, 1);
|
||||
if (!backup_hdr.addr<Gpt_hdr*>()->is_valid(false)) {
|
||||
if (!backup_hdr.addr<Gpt_hdr*>()->valid(false)) {
|
||||
PWRN("Backup GPT header is corrupted");
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ class Gpt : public Block::Partition_table
|
||||
Genode::uint64_t _attr; /* partition attributes */
|
||||
Genode::uint16_t _name[NAME_LEN]; /* partition name in UNICODE-16 */
|
||||
|
||||
bool is_valid()
|
||||
bool valid()
|
||||
{
|
||||
if (_type.time_low == 0x00000000)
|
||||
return false;
|
||||
@ -226,7 +226,7 @@ class Gpt : public Block::Partition_table
|
||||
*/
|
||||
void _parse_gpt(Gpt_hdr *gpt)
|
||||
{
|
||||
if (!(gpt->is_valid()))
|
||||
if (!(gpt->valid()))
|
||||
throw Genode::Exception();
|
||||
|
||||
Sector entry_array(gpt->_gpe_lba,
|
||||
@ -236,7 +236,7 @@ class Gpt : public Block::Partition_table
|
||||
for (int i = 0; i < MAX_PARTITIONS; i++) {
|
||||
Gpt_entry *e = (entries + i);
|
||||
|
||||
if (!e->is_valid())
|
||||
if (!e->valid())
|
||||
continue;
|
||||
|
||||
Genode::uint64_t start = e->_lba_start;
|
||||
|
@ -46,9 +46,9 @@ struct Mbr_partition_table : public Block::Partition_table
|
||||
Genode::uint32_t _lba; /* logical block address */
|
||||
Genode::uint32_t _sectors; /* number of sectors */
|
||||
|
||||
bool is_valid() { return _type != INVALID; }
|
||||
bool is_extented() { return _type == EXTENTED; }
|
||||
bool is_protective() { return _type == PROTECTIVE; }
|
||||
bool valid() { return _type != INVALID; }
|
||||
bool extented() { return _type == EXTENTED; }
|
||||
bool protective() { return _type == PROTECTIVE; }
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@ struct Mbr_partition_table : public Block::Partition_table
|
||||
Partition_record _records[4];
|
||||
Genode::uint16_t _magic;
|
||||
|
||||
bool is_valid()
|
||||
bool valid()
|
||||
{
|
||||
/* magic number of partition table */
|
||||
enum { MAGIC = 0xaa55 };
|
||||
@ -86,13 +86,13 @@ struct Mbr_partition_table : public Block::Partition_table
|
||||
Sector s(lba, 1);
|
||||
Mbr *ebr = s.addr<Mbr *>();
|
||||
|
||||
if (!(ebr->is_valid()))
|
||||
if (!(ebr->valid()))
|
||||
return;
|
||||
|
||||
/* The first record is the actual logical partition. The lba of this
|
||||
* partition is relative to the lba of the current EBR */
|
||||
Partition_record *logical = &(ebr->_records[0]);
|
||||
if (logical->is_valid() && nr < MAX_PARTITIONS) {
|
||||
if (logical->valid() && nr < MAX_PARTITIONS) {
|
||||
_part_list[nr++] = new (Genode::env()->heap())
|
||||
Block::Partition(logical->_lba + lba, logical->_sectors);
|
||||
|
||||
@ -107,29 +107,29 @@ struct Mbr_partition_table : public Block::Partition_table
|
||||
r = &(ebr->_records[1]);
|
||||
lba += ebr->_records[1]._lba;
|
||||
|
||||
} while (r->is_valid());
|
||||
} while (r->valid());
|
||||
}
|
||||
|
||||
void _parse_mbr(Mbr *mbr)
|
||||
{
|
||||
/* no partition table, use whole disc as partition 0 */
|
||||
if (!(mbr->is_valid()))
|
||||
if (!(mbr->valid()))
|
||||
_part_list[0] = new(Genode::env()->heap())
|
||||
Block::Partition(0, Block::Driver::driver().blk_cnt() - 1);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
Partition_record *r = &(mbr->_records[i]);
|
||||
|
||||
if (!r->is_valid())
|
||||
if (!r->valid())
|
||||
continue;
|
||||
|
||||
PINF("Partition %d: LBA %u (%u blocks) type: %x",
|
||||
i + 1, r->_lba, r->_sectors, r->_type);
|
||||
|
||||
if (r->is_protective())
|
||||
if (r->protective())
|
||||
throw Protective_mbr_found();
|
||||
|
||||
if (r->is_extented()) {
|
||||
if (r->extented()) {
|
||||
_parse_extented(r);
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user