Retro Rocket Kernel BASIC-Powered Operating System

Data Structures | Macros | Functions | Variables
partition.h File Reference
`#include "kernel.h"`

## Data Structures
struct | partition_t
| A disk partition on a storage device. More...
struct | partition_table_t
| A disk partition table consisiting of four partition_t. More...
struct | gpt_header_t
struct | gpt_entry_t

## Macros
#define | PARTITION_TABLE_OFFSET 0x1BE
#define | PARTITON_GPT_PROTECTIVE 0xEE
#define | GUID_ASCII_LEN 36
#define | GUID_BINARY_LEN 16

## Functions
struct partition_t | __attribute__ ((packed)) partition_t
| A disk partition on a storage device. More...
bool | find_partition_of_type (const char *device_name, uint8_t partition_type, char *found_guid, const char *partition_type_guid, uint8_t *partition_id, uint64_t *start, uint64_t *length)
| Given a device name and partition type ID, find the start and length of that partition on the device. Returns false if the partition could not be found. More...
bool | guid_to_binary (const char *guid, void *binary)
bool | binary_to_guid (const void *binary, char *guid)

## Variables
uint8_t | bootable
| Partition is bootable. More...
uint8_t | starthead
| Starting head. More...
uint16_t | startcylsect
| Starting cylinder and sector. More...
uint8_t | systemid
| partition type id More...
uint8_t | endhead
| End head. More...
uint16_t | endcylsect
| End cylinder and sector. More...
uint32_t | startlba
| Starting LBA. More...
uint32_t | length
| LBA length. More...
partition_t | p_entry [4]
| Partition entries. More...
char | signature [8]
uint32_t | gpt_revision
uint32_t | header_size
uint32_t | crc_checksum
uint32_t | reserved0
uint64_t | lba_of_this_header
uint64_t | lba_of_alternative_header
uint64_t | first_usable_block
uint64_t | last_usable_block
uint8_t | disk_guid [16]
uint64_t | lba_of_partition_entries
uint32_t | number_partition_entries
uint32_t | size_of_each_entry
uint32_t | crc_32_of_entries
uint8_t | reserved1 []
uint8_t | type_guid [16]
uint8_t | unique_id [16]
uint64_t | start_lba
uint64_t | end_lba
uint64_t | attributes
char | name [72]

## Detailed Description

Author
  Craig Edwards (craig.nosp@m.edwa.nosp@m.rds@b.nosp@m.rain.nosp@m.box.c.nosp@m.c)

Copyright
  Copyright (c) 2012-2023

## Macro Definition Documentation

## ◆ GUID_ASCII_LEN

#define GUID_ASCII_LEN 36

## ◆ GUID_BINARY_LEN

#define GUID_BINARY_LEN 16

## ◆ PARTITION_TABLE_OFFSET

#define PARTITION_TABLE_OFFSET 0x1BE

## ◆ PARTITON_GPT_PROTECTIVE

#define PARTITON_GPT_PROTECTIVE 0xEE

## Function Documentation

## ◆ __attribute__()

struct partition_t __attribute__ | ( | (packed) |  | ) |

A disk partition on a storage device.

A disk partition table consisiting of four partition_t.

## ◆ binary_to_guid()

bool binary_to_guid | ( | const void * | binary,
|  | char * | guid
| ) |  |

## ◆ find_partition_of_type()

bool find_partition_of_type | ( | const char * | device_name,
|  | uint8_t | partition_type,
|  | char * | found_guid,
|  | const char * | partition_type_guid,
|  | uint8_t * | partition_id,
|  | uint64_t * | start,
|  | uint64_t * | length
| ) |  |

Given a device name and partition type ID, find the start and length of that partition on the device. Returns false if the partition could not be found.

Parameters

  device_name | Device name
  partition_type | Partition type ID to find
  found_guid | filled with the guid of the found partition, if found on a GPT partition
  partition_id | Partition ID of found partition, filled if found, or 0xFF if found on a GPT partition
  start | Start of found partition, filled if found
  length | Length of found partition, filled if found

Returns
  true if partition found, partition_id, start and length will be set
  false if partition not found, partition_id, start and length will be unchanged

## ◆ guid_to_binary()

bool guid_to_binary | ( | const char * | guid,
|  | void * | binary
| ) |  |

## Variable Documentation

## ◆ attributes

uint64_t attributes

## ◆ bootable

uint8_t bootable

Partition is bootable.

## ◆ crc_32_of_entries

uint32_t crc_32_of_entries

## ◆ crc_checksum

uint32_t crc_checksum

## ◆ disk_guid

uint8_t disk_guid[16]

## ◆ end_lba

uint64_t end_lba

## ◆ endcylsect

uint16_t endcylsect

End cylinder and sector.

## ◆ endhead

uint8_t endhead

End head.

## ◆ first_usable_block

uint64_t first_usable_block

## ◆ gpt_revision

uint32_t gpt_revision

## ◆ header_size

uint32_t header_size

## ◆ last_usable_block

uint64_t last_usable_block

## ◆ lba_of_alternative_header

uint64_t lba_of_alternative_header

## ◆ lba_of_partition_entries

uint64_t lba_of_partition_entries

## ◆ lba_of_this_header

uint64_t lba_of_this_header

## ◆ length

uint32_t length

LBA length.

## ◆ name

char name[72]

## ◆ number_partition_entries

uint32_t number_partition_entries

## ◆ p_entry

partition_t p_entry[4]

Partition entries.

## ◆ reserved0

uint32_t reserved0

## ◆ reserved1

uint8_t reserved1[]

## ◆ signature

char signature[8]

## ◆ size_of_each_entry

uint32_t size_of_each_entry

## ◆ start_lba

uint64_t start_lba

## ◆ startcylsect

uint16_t startcylsect

Starting cylinder and sector.

## ◆ starthead

uint8_t starthead

Starting head.

## ◆ startlba

uint32_t startlba

Starting LBA.

## ◆ systemid

uint8_t systemid

partition type id

## ◆ type_guid

uint8_t type_guid[16]

## ◆ unique_id

uint8_t unique_id[16]