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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
/*
libparted - a library for manipulating disk partitions
Copyright (C) 1998 - 2001, 2005, 2007-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \addtogroup PedDevice
* @{
*/
/** \file device.h */
#ifndef PED_DEVICE_H_INCLUDED
#define PED_DEVICE_H_INCLUDED
/** We can address 2^63 sectors */
typedef long long PedSector;
/** \deprecated Removal from API planned */
typedef enum {
PED_DEVICE_UNKNOWN = 0,
PED_DEVICE_SCSI = 1,
PED_DEVICE_IDE = 2,
PED_DEVICE_DAC960 = 3,
PED_DEVICE_CPQARRAY = 4,
PED_DEVICE_FILE = 5,
PED_DEVICE_ATARAID = 6,
PED_DEVICE_I2O = 7,
PED_DEVICE_UBD = 8,
PED_DEVICE_DASD = 9,
PED_DEVICE_VIODASD = 10,
PED_DEVICE_SX8 = 11,
PED_DEVICE_DM = 12,
PED_DEVICE_XVD = 13,
PED_DEVICE_SDMMC = 14
} PedDeviceType;
typedef struct _PedDevice PedDevice;
typedef struct _PedDeviceArchOps PedDeviceArchOps;
typedef struct _PedCHSGeometry PedCHSGeometry;
/**
* A cylinder-head-sector "old-style" geometry.
*
* A device addressed in this way has C*H*S sectors.
*/
struct _PedCHSGeometry {
int cylinders;
int heads;
int sectors;
};
/** A block device - for example, /dev/hda, not /dev/hda3 */
struct _PedDevice {
PedDevice* next;
char* model; /**< \brief description of hardware
(manufacturer, model) */
char* path; /**< device /dev entry */
PedDeviceType type; /**< SCSI, IDE, etc.
\deprecated \sa PedDeviceType */
long long sector_size; /**< logical sector size */
long long phys_sector_size; /**< physical sector size */
PedSector length; /**< device length (LBA) */
int open_count; /**< the number of times this device has
been opened with ped_device_open(). */
int read_only;
int external_mode;
int dirty;
int boot_dirty;
PedCHSGeometry hw_geom;
PedCHSGeometry bios_geom;
short host, did;
void* arch_specific;
};
/**
* List of functions implementing architecture-specific operations.
*/
struct _PedDeviceArchOps {
PedDevice* (*_new) (const char* path);
void (*destroy) (PedDevice* dev);
int (*is_busy) (PedDevice* dev);
int (*open) (PedDevice* dev);
int (*refresh_open) (PedDevice* dev);
int (*close) (PedDevice* dev);
int (*refresh_close) (PedDevice* dev);
int (*read) (const PedDevice* dev, void* buffer,
PedSector start, PedSector count);
int (*write) (PedDevice* dev, const void* buffer,
PedSector start, PedSector count);
int (*sync) (PedDevice* dev);
int (*sync_fast) (PedDevice* dev);
PedSector (*check) (PedDevice* dev, void* buffer,
PedSector start, PedSector count);
void (*probe_all) ();
};
#include <parted/constraint.h>
#include <parted/timer.h>
extern void ped_device_probe_all ();
extern void ped_device_free_all ();
extern PedDevice* ped_device_get (const char* name);
extern PedDevice* ped_device_get_next (const PedDevice* dev);
extern int ped_device_is_busy (PedDevice* dev);
extern int ped_device_open (PedDevice* dev);
extern int ped_device_close (PedDevice* dev);
extern void ped_device_destroy (PedDevice* dev);
extern void ped_device_cache_remove (PedDevice* dev);
extern int ped_device_begin_external_access (PedDevice* dev);
extern int ped_device_end_external_access (PedDevice* dev);
extern int ped_device_read (const PedDevice* dev, void* buffer,
PedSector start, PedSector count);
extern int ped_device_write (PedDevice* dev, const void* buffer,
PedSector start, PedSector count);
extern int ped_device_sync (PedDevice* dev);
extern int ped_device_sync_fast (PedDevice* dev);
extern PedSector ped_device_check (PedDevice* dev, void* buffer,
PedSector start, PedSector count);
extern PedConstraint* ped_device_get_constraint (PedDevice* dev);
/* private stuff ;-) */
extern void _ped_device_probe (const char* path);
#endif /* PED_DEVICE_H_INCLUDED */
/** @} */
|