rulimine/stage2/lib/part.h

30 lines
599 B
C
Raw Normal View History

2020-04-15 14:21:44 +03:00
#ifndef __LIB__PART_H__
#define __LIB__PART_H__
#include <stdint.h>
2020-10-18 07:23:39 +03:00
#include <stdbool.h>
2020-11-02 11:20:34 +03:00
#include <lib/guid.h>
2020-04-15 14:21:44 +03:00
#define NO_PARTITION (-1)
#define INVALID_TABLE (-2)
#define END_OF_TABLE (-3)
2020-04-15 14:21:44 +03:00
struct part {
2020-11-01 23:25:35 +03:00
int drive;
int partition;
int sector_size;
2020-10-18 07:23:39 +03:00
uint64_t first_sect;
uint64_t sect_count;
2020-11-01 23:25:35 +03:00
bool guid_valid;
2020-10-18 07:23:39 +03:00
struct guid guid;
2020-04-15 14:21:44 +03:00
};
2020-10-18 07:23:39 +03:00
void part_create_index(void);
2020-11-02 12:17:20 +03:00
int part_get(struct part *part, int drive, int partition);
bool part_get_by_guid(struct part *part, struct guid *guid);
int part_read(struct part *part, void *buffer, uint64_t loc, uint64_t count);
2020-04-15 14:21:44 +03:00
#endif