forked from caldwell/gdisk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.h
28 lines (21 loc) · 820 Bytes
/
device.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) 2008 David Caldwell, All Rights Reserved.
#ifndef __DEVICE_H__
#define __DEVICE_H__
#include <stdbool.h>
struct device {
char *name;
unsigned long sector_size;
unsigned long long sector_count;
int fd;
};
void *alloc_sectors(struct device *dev, unsigned long sectors);
void *get_sectors(struct device *dev, unsigned long long sector_num, unsigned long sectors);
// device specific:
struct device *open_device(char *name);
void close_device(struct device *dev);
bool device_read(struct device *dev, void *buffer, unsigned long long sector, unsigned long sectors);
bool device_write(struct device *dev, void *buffer, unsigned long long sector, unsigned long sectors);
char *device_help();
// Backend use only:
struct device *open_disk_device(char *name);
#endif /* __DEVICE_H__ */