9 # define uintptr_t linux_uintptr_t
10 # include <linux/types.h>
11 # include <linux/stddef.h>
14 /** Unsigned integer which can contain a HC ring-3 pointer. */
15 #if R3_ARCH_BITS == 32
16 typedef uint32_t RTR3UINTPTR
;
17 #elif R3_ARCH_BITS == 64
18 typedef uint64_t RTR3UINTPTR
;
20 # error Unsupported R3_ARCH_BITS value.
23 /** Unsigned integer register in the current context. */
25 typedef uint32_t RTCCUINTREG
;
27 typedef uint64_t RTCCUINTREG
;
29 # error "Unsupported ARCH_BITS!"
31 /** Pointer to an unsigned integer register in the current context. */
32 typedef RTCCUINTREG
*PRTCCUINTREG
;
33 /** Pointer to a const unsigned integer register in the current context. */
34 typedef const RTCCUINTREG
*PCRTCCUINTREG
;
36 /** HC ring-3 pointer. */
38 typedef void * RTR3PTR
;
40 typedef RTR3UINTPTR RTR3PTR
;
43 /** File mode (see iprt/fs.h). */
44 typedef uint32_t RTFMODE
;
45 /** Pointer to file mode. */
46 typedef RTFMODE
*PRTFMODE
;
49 typedef uint32_t RTUID
;
50 /** Pointer to a user id. */
51 typedef RTUID
*PRTUID
;
54 typedef uint32_t RTGID
;
55 /** Pointer to a group id. */
56 typedef RTGID
*PRTGID
;
58 /** Device unix number. */
59 typedef uint32_t RTDEV
;
60 /** Pointer to a device unix number. */
61 typedef RTDEV
*PRTDEV
;
64 typedef uint64_t RTINODE
;
65 /** Pointer to a i-node number. */
66 typedef RTINODE
*PRTINODE
;
81 /** The way the UUID is declared by the ext2 guys. */
86 uint16_t u16TimeHiAndVersion
;
91 unsigned char aUuid
[16];
93 /** Pointer to UUID data. */
94 typedef RTUUID
*PRTUUID
;
95 /** Pointer to readonly UUID data. */
96 typedef const RTUUID
*PCRTUUID
;
98 /** Unsigned integer. */
99 typedef uint32_t RTUINT
;
101 typedef RTUINT RTFILE
;
102 /** Pointer to file handle. */
103 typedef RTFILE
*PRTFILE
;
104 /** Nil file handle. */
105 #define NIL_RTFILE (~(RTFILE)0)
108 * BIOS translation mode.
110 typedef enum PDMBIOSTRANSLATION
112 /** No translation. */
113 PDMBIOSTRANSLATION_NONE
= 1,
114 /** LBA translation. */
115 PDMBIOSTRANSLATION_LBA
,
116 /** Automatic select mode. */
117 PDMBIOSTRANSLATION_AUTO
118 } PDMBIOSTRANSLATION
;
120 /** Pointer to BIOS translation mode. */
121 typedef PDMBIOSTRANSLATION
*PPDMBIOSTRANSLATION
;
123 /** Pointer to a media interface. */
124 typedef struct PDMIMEDIA
*PPDMIMEDIA
;
127 * Makes up the fundation for PDMIBLOCK and PDMIBLOCKBIOS.
129 typedef struct PDMIMEDIA
134 * @returns VBox status code.
135 * @param pInterface Pointer to the interface structure containing the called function pointer.
136 * @param off Offset to start reading from.
137 * @param pvBuf Where to store the read bits.
138 * @param cbRead Number of bytes to read.
139 * @thread Any thread.
141 DECLR3CALLBACKMEMBER(int, pfnRead
,(PPDMIMEDIA pInterface
, uint64_t off
, void *pvBuf
, size_t cbRead
));
146 * @returns VBox status code.
147 * @param pInterface Pointer to the interface structure containing the called function pointer.
148 * @param off Offset to start writing at.
149 * @param pvBuf Where to store the write bits.
150 * @param cbWrite Number of bytes to write.
151 * @thread Any thread.
153 DECLR3CALLBACKMEMBER(int, pfnWrite
,(PPDMIMEDIA pInterface
, uint64_t off
, const void *pvBuf
, size_t cbWrite
));
156 * Make sure that the bits written are actually on the storage medium.
158 * @returns VBox status code.
159 * @param pInterface Pointer to the interface structure containing the called function pointer.
160 * @thread Any thread.
162 DECLR3CALLBACKMEMBER(int, pfnFlush
,(PPDMIMEDIA pInterface
));
165 * Get the media size in bytes.
167 * @returns Media size in bytes.
168 * @param pInterface Pointer to the interface structure containing the called function pointer.
169 * @thread Any thread.
171 DECLR3CALLBACKMEMBER(uint64_t, pfnGetSize
,(PPDMIMEDIA pInterface
));
174 * Check if the media is readonly or not.
176 * @returns true if readonly.
177 * @returns false if read/write.
178 * @param pInterface Pointer to the interface structure containing the called function pointer.
179 * @thread Any thread.
181 DECLR3CALLBACKMEMBER(bool, pfnIsReadOnly
,(PPDMIMEDIA pInterface
));
184 * Get stored media geometry - BIOS property.
185 * This is an optional feature of a media.
187 * @returns VBox status code.
188 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
189 * @returns VERR_PDM_GEOMETRY_NOT_SET if the geometry hasn't been set using pfnBiosSetGeometry() yet.
190 * @param pInterface Pointer to the interface structure containing the called function pointer.
191 * @param pcCylinders Number of cylinders.
192 * @param pcHeads Number of heads.
193 * @param pcSectors Number of sectors. This number is 1-based.
194 * @remark This have no influence on the read/write operations.
195 * @thread Any thread.
197 DECLR3CALLBACKMEMBER(int, pfnBiosGetGeometry
,(PPDMIMEDIA pInterface
, uint32_t *pcCylinders
, uint32_t *pcHeads
, uint32_t *pcSectors
));
200 * Store the media geometry - BIOS property.
201 * This is an optional feature of a media.
203 * @returns VBox status code.
204 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
205 * @param pInterface Pointer to the interface structure containing the called function pointer.
206 * @param cCylinders Number of cylinders.
207 * @param cHeads Number of heads.
208 * @param cSectors Number of sectors. This number is 1-based.
209 * @remark This have no influence on the read/write operations.
210 * @thread The emulation thread.
212 DECLR3CALLBACKMEMBER(int, pfnBiosSetGeometry
,(PPDMIMEDIA pInterface
, uint32_t cCylinders
, uint32_t cHeads
, uint32_t cSectors
));
215 * Get stored geometry translation mode - BIOS property.
216 * This is an optional feature of a media.
218 * @returns VBox status code.
219 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry translation mode.
220 * @returns VERR_PDM_TRANSLATION_NOT_SET if the translation hasn't been set using pfnBiosSetTranslation() yet.
221 * @param pInterface Pointer to the interface structure containing the called function pointer.
222 * @param penmTranslation Where to store the translation type.
223 * @remark This have no influence on the read/write operations.
224 * @thread Any thread.
226 DECLR3CALLBACKMEMBER(int, pfnBiosGetTranslation
,(PPDMIMEDIA pInterface
, PPDMBIOSTRANSLATION penmTranslation
));
229 * Store media geometry - BIOS property.
230 * This is an optional feature of a media.
232 * @returns VBox status code.
233 * @returns VERR_NOT_IMPLEMENTED if the media doesn't support storing the geometry.
234 * @param pInterface Pointer to the interface structure containing the called function pointer.
235 * @param enmTranslation The translation type.
236 * @remark This have no influence on the read/write operations.
237 * @thread The emulation thread.
239 DECLR3CALLBACKMEMBER(int, pfnBiosSetTranslation
,(PPDMIMEDIA pInterface
, PDMBIOSTRANSLATION enmTranslation
));
242 * Gets the UUID of the media drive.
244 * @returns VBox status code.
245 * @param pInterface Pointer to the interface structure containing the called function pointer.
246 * @param pUuid Where to store the UUID on success.
247 * @thread Any thread.
249 DECLR3CALLBACKMEMBER(int, pfnGetUuid
,(PPDMIMEDIA pInterface
, PRTUUID pUuid
));
253 /** Pointer to a PDM Driver Instance. */
254 typedef struct PDMDRVINS
*PPDMDRVINS
;
255 /** Pointer to a pointer to a PDM Driver Instance. */
256 typedef PPDMDRVINS
*PPPDMDRVINS
;
258 /** A file offset / size (off_t). */
259 typedef int64_t RTFOFF
;
260 /** Pointer to a file offset / size. */
261 typedef RTFOFF
*PRTFOFF
;
263 /** File mode (see iprt/fs.h). */
264 typedef uint32_t RTFMODE
;
265 /** Pointer to file mode. */
266 typedef RTFMODE
*PRTFMODE
;
270 * This will report the completion percentage of an operation.
272 * @returns VINF_SUCCESS.
273 * @returns Error code to cancel the operation with.
274 * @param pVM The VM handle.
275 * @param uPercent Completetion precentage (0-100).
276 * @param pvUser User specified argument.
278 typedef int FNVMPROGRESS(void* pVM
, unsigned uPercent
, void *pvUser
);
279 /** Pointer to a FNVMPROGRESS function. */
280 typedef FNVMPROGRESS
*PFNVMPROGRESS
;
283 * Generic process callback.
285 * @returns VBox status code. Failure will cancel the operation.
286 * @param uPercentage The percentage of the operation which has been completed.
287 * @param pvUser The user specified argument.
289 typedef int FNRTPROGRESS(unsigned uPrecentage
, void *pvUser
);
290 /** Pointer to a generic progress callback function, FNRTPROCESS(). */
291 typedef FNRTPROGRESS
*PFNRTPROGRESS
;
294 * 64-bit unsigned interger union.
296 typedef union RTUINT64U
306 /** Double-Word view. */
330 /** Pointer to a 64-bit unsigned interger union. */
331 typedef RTUINT64U
*PRTUINT64U
;
332 /** Pointer to a const 64-bit unsigned interger union. */
333 typedef const RTUINT64U
*PCRTUINT64U
;
337 * @remark wchar_t is not usable since it's compiler defined.
338 * @remark When we use the term character we're not talking about unicode code point, but
339 * the basic unit of the string encoding. Thus cuc - count of unicode chars - means
340 * count of RTUTF16. And cch means count of the typedef 'char', which is assumed
343 typedef uint16_t RTUTF16
;
344 /** Pointer to a UTF-16 character. */
345 typedef RTUTF16
*PRTUTF16
;
346 /** Pointer to a const UTF-16 character. */
347 typedef const RTUTF16
*PCRTUTF16
;
351 * @remark wchar_t is not usable since it's compiler defined.
352 * @deprecated Use RTUTF16!
354 typedef RTUTF16 RTUCS2
;
355 /** Pointer to UCS-2 character.
356 * @deprecated Use PRTUTF16!
358 typedef PRTUTF16 PRTUCS2
;
359 /** Pointer to const UCS-2 character.
360 * @deprecated Use PCRTUTF16!
362 typedef PCRTUTF16 PCRTUCS2
;