Changeset View
Changeset View
Standalone View
Standalone View
stand/common/disk.h
Show All 26 Lines | |||||
*/ | */ | ||||
/* | /* | ||||
* Device descriptor for partitioned disks. To use, set the | * Device descriptor for partitioned disks. To use, set the | ||||
* d_slice and d_partition variables as follows: | * d_slice and d_partition variables as follows: | ||||
* | * | ||||
* Whole disk access: | * Whole disk access: | ||||
* | * | ||||
* d_slice = -1 | * d_slice = D_SLICENONE | ||||
* d_partition = -1 | * d_partition = <doesn't matter> | ||||
* | * | ||||
* Whole MBR slice: | * Whole MBR slice: | ||||
* | * | ||||
* d_slice = MBR slice number (typically 1..4) | * d_slice = MBR slice number (typically 1..4) | ||||
* d_partition = -1 | * d_partition = D_PARTNONE | ||||
* | * | ||||
* BSD disklabel partition within an MBR slice: | * BSD disklabel partition within an MBR slice: | ||||
* | * | ||||
* d_slice = MBR slice number (typically 1..4) | * d_slice = MBR slice number (typically 1..4) | ||||
* d_partition = disklabel partition (typically 0..19) | * d_partition = disklabel partition (typically 0..19 or D_PARTWILD) | ||||
* | * | ||||
* BSD disklabel partition on the true dedicated disk: | * BSD disklabel partition on the true dedicated disk: | ||||
* | * | ||||
* d_slice = -1 | * d_slice = D_SLICENONE | ||||
* d_partition = disklabel partition (typically 0..19) | * d_partition = disklabel partition (typically 0..19 or D_PARTWILD) | ||||
* | * | ||||
* GPT partition: | * GPT partition: | ||||
* | * | ||||
* d_slice = GPT partition number (typically 1..N) | * d_slice = GPT partition number (typically 1..N) | ||||
* d_partition = 255 | * d_partition = D_PARTISGPT | ||||
* | * | ||||
* For both MBR and GPT, to automatically find the 'best' slice or partition, | * For MBR, setting d_partition to D_PARTWILD will automatically use the first | ||||
* set d_slice to zero. This uses the partition type to decide which partition | * partition within the slice. | ||||
* to use according to the following list of preferences: | |||||
* | * | ||||
* For both MBR and GPT, to automatically find the 'best' slice and partition, | |||||
* set d_slice to D_SLICEWILD. This uses the partition type to decide which | |||||
* partition to use according to the following list of preferences: | |||||
* | |||||
* FreeBSD (active) | * FreeBSD (active) | ||||
* FreeBSD (inactive) | * FreeBSD (inactive) | ||||
* Linux (active) | * Linux (active) | ||||
* Linux (inactive) | * Linux (inactive) | ||||
* DOS/Windows (active) | * DOS/Windows (active) | ||||
* DOS/Windows (inactive) | * DOS/Windows (inactive) | ||||
* | * | ||||
* Active MBR slices (marked as bootable) are preferred over inactive. GPT | * Active MBR slices (marked as bootable) are preferred over inactive. GPT | ||||
* doesn't have the concept of active/inactive partitions. In both MBR and GPT, | * doesn't have the concept of active/inactive partitions. In both MBR and GPT, | ||||
* if there are multiple slices/partitions of a given type, the first one | * if there are multiple slices/partitions of a given type, the first one | ||||
* is chosen. | * is chosen. | ||||
* | * | ||||
* The low-level disk device will typically call disk_open() from its open | * The low-level disk device will typically call disk_open() from its open | ||||
* method to interpret the disk partition tables according to the rules above. | * method to interpret the disk partition tables according to the rules above. | ||||
* This will initialize d_offset to the block offset of the start of the | * This will initialize d_offset to the block offset of the start of the | ||||
* selected partition - this offset should be added to the offset passed to | * selected partition - this offset should be added to the offset passed to | ||||
* the device's strategy method. | * the device's strategy method. | ||||
*/ | */ | ||||
#ifndef _DISK_H | #ifndef _DISK_H | ||||
#define _DISK_H | #define _DISK_H | ||||
#define D_SLICENONE -1 | |||||
#define D_SLICEWILD 0 | |||||
#define D_PARTNONE -1 | |||||
#define D_PARTWILD -2 | |||||
#define D_PARTISGPT 255 | |||||
struct disk_devdesc { | struct disk_devdesc { | ||||
struct devdesc dd; /* Must be first. */ | struct devdesc dd; /* Must be first. */ | ||||
int d_slice; | int d_slice; | ||||
int d_partition; | int d_partition; | ||||
uint64_t d_offset; | uint64_t d_offset; | ||||
}; | }; | ||||
Show All 23 Lines |