Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/common/disk.h
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* 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 | |||||
#define _DISK_H | |||||
struct disk_devdesc | struct disk_devdesc | ||||
{ | { | ||||
struct devsw *d_dev; | struct devsw *d_dev; | ||||
int d_type; | int d_type; | ||||
int d_unit; | int d_unit; | ||||
void *d_opendata; | void *d_opendata; | ||||
int d_slice; | int d_slice; | ||||
int d_partition; | int d_partition; | ||||
uint64_t d_offset; | uint64_t d_offset; | ||||
}; | }; | ||||
enum disk_ioctl { | enum disk_ioctl { | ||||
IOCTL_GET_BLOCKS, | IOCTL_GET_BLOCKS, | ||||
IOCTL_GET_BLOCK_SIZE | IOCTL_GET_BLOCK_SIZE | ||||
}; | }; | ||||
/* | /* | ||||
* Parse disk metadata and initialise dev->d_offset. | * Parse disk metadata and initialise dev->d_offset. | ||||
*/ | */ | ||||
extern int disk_open(struct disk_devdesc *dev, uint64_t mediasize, | extern int disk_open(struct disk_devdesc *, uint64_t, u_int); | ||||
u_int sectorsize, u_int flags); | extern int disk_close(struct disk_devdesc *); | ||||
#define DISK_F_NOCACHE 0x0001 /* Do not use metadata caching */ | extern int disk_ioctl(struct disk_devdesc *, u_long, void *); | ||||
extern int disk_close(struct disk_devdesc *dev); | extern int disk_read(struct disk_devdesc *, void *, uint64_t, u_int); | ||||
extern void disk_cleanup(const struct devsw *d_dev); | extern int disk_write(struct disk_devdesc *, void *, uint64_t, u_int); | ||||
extern int disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *buf); | extern int ptblread(void *, void *, size_t, uint64_t); | ||||
extern int disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset, | |||||
u_int blocks); | |||||
extern int disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, | |||||
u_int blocks); | |||||
extern int ptblread(void *d, void *buf, size_t blocks, uint64_t offset); | |||||
/* | /* | ||||
* Print information about slices on a disk. | * Print information about slices on a disk. | ||||
*/ | */ | ||||
extern int disk_print(struct disk_devdesc *dev, char *prefix, int verbose); | extern int disk_print(struct disk_devdesc *, char *, int); | ||||
extern char* disk_fmtdev(struct disk_devdesc *dev); | extern char* disk_fmtdev(struct disk_devdesc *); | ||||
extern int disk_parsedev(struct disk_devdesc *dev, const char *devspec, | extern int disk_parsedev(struct disk_devdesc *, const char *, const char **); | ||||
const char **path); | |||||
#endif /* _DISK_H */ |