1 | /** @file
|
---|
2 | * VBox HDD Container API.
|
---|
3 | * Will replace VBoxHDD.h.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef __VBox_VBoxHDDNew_h__
|
---|
23 | #define __VBox_VBoxHDDNew_h__
|
---|
24 |
|
---|
25 | #include <VBox/cdefs.h>
|
---|
26 | #include <VBox/types.h>
|
---|
27 | #include <VBox/pdm.h>
|
---|
28 |
|
---|
29 | __BEGIN_DECLS
|
---|
30 |
|
---|
31 | #ifdef IN_RING0
|
---|
32 | # error "There are no VBox HDD Container APIs available in Ring-0 Host Context!"
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | /** @defgroup grp_vbox_hdd VBox HDD Container
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | /** Current VMDK image version. */
|
---|
40 | #define VMDK_IMAGE_VERSION (0x0001)
|
---|
41 |
|
---|
42 | /** Current VDI image major version. */
|
---|
43 | #define VDI_IMAGE_VERSION_MAJOR (0x0001)
|
---|
44 | /** Current VDI image minor version. */
|
---|
45 | #define VDI_IMAGE_VERSION_MINOR (0x0001)
|
---|
46 | /** Current VDI image version. */
|
---|
47 | #define VDI_IMAGE_VERSION ((VDI_IMAGE_VERSION_MAJOR << 16) | VDI_IMAGE_VERSION_MINOR)
|
---|
48 |
|
---|
49 | /** Get VDI major version from combined version. */
|
---|
50 | #define VDI_GET_VERSION_MAJOR(uVer) ((uVer) >> 16)
|
---|
51 | /** Get VDI minor version from combined version. */
|
---|
52 | #define VDI_GET_VERSION_MINOR(uVer) ((uVer) & 0xffff)
|
---|
53 |
|
---|
54 | /** @name VBox HDD container image types
|
---|
55 | * @{ */
|
---|
56 | typedef enum VBOXHDDIMAGETYPE
|
---|
57 | {
|
---|
58 | /** Normal dynamically growing base image file. */
|
---|
59 | VBOXHDD_IMAGE_TYPE_NORMAL = 1,
|
---|
60 | /** Preallocated base image file of a fixed size. */
|
---|
61 | VBOXHDD_IMAGE_TYPE_FIXED,
|
---|
62 | /** Dynamically growing image file for undo/commit changes support. */
|
---|
63 | VBOXHDD_IMAGE_TYPE_UNDO,
|
---|
64 | /** Dynamically growing image file for differencing support. */
|
---|
65 | VBOXHDD_IMAGE_TYPE_DIFF,
|
---|
66 |
|
---|
67 | /** First valid image type value. */
|
---|
68 | VBOXHDD_IMAGE_TYPE_FIRST = VBOXHDD_IMAGE_TYPE_NORMAL,
|
---|
69 | /** Last valid image type value. */
|
---|
70 | VBOXHDD_IMAGE_TYPE_LAST = VBOXHDD_IMAGE_TYPE_DIFF
|
---|
71 | } VBOXHDDIMAGETYPE;
|
---|
72 | /** Pointer to VBox HDD container image type. */
|
---|
73 | typedef VBOXHDDIMAGETYPE *PVBOXHDDIMAGETYPE;
|
---|
74 | /** @} */
|
---|
75 |
|
---|
76 | /** @name VBox HDD container image flags
|
---|
77 | * @{
|
---|
78 | */
|
---|
79 | /** No flags. */
|
---|
80 | #define VBOXHDD_IMAGE_FLAGS_NONE (0)
|
---|
81 | /** VMDK: Split image into 2GB extents. */
|
---|
82 | #define VBOXHDD_VMDK_IMAGE_FLAGS_SPLIT_2G (0x0001)
|
---|
83 | /** VMDK: Split image into 2GB extents. */
|
---|
84 | #define VBOXHDD_VMDK_IMAGE_FLAGS_RAWDISK (0x0002)
|
---|
85 | /** VDI: Fill new blocks with zeroes while expanding image file. */
|
---|
86 | #define VBOXHDD_VDI_IMAGE_FLAGS_ZERO_EXPAND (0x0100)
|
---|
87 |
|
---|
88 | /** Mask of valid image flags for VMDK. */
|
---|
89 | #define VBOXHDD_VMDK_IMAGE_FLAGS_MASK (VBOXHDD_IMAGE_FLAGS_NONE | VBOXHDD_VMDK_IMAGE_FLAGS_SPLIT_2G | VBOXHDD_VMDK_IMAGE_FLAGS_RAWDISK)
|
---|
90 |
|
---|
91 | /** Mask of valid image flags for VDI. */
|
---|
92 | #define VBOXHDD_VDI_IMAGE_FLAGS_MASK (VBOXHDD_IMAGE_FLAGS_NONE | VBOXHDD_VDI_IMAGE_FLAGS_ZERO_EXPAND)
|
---|
93 |
|
---|
94 | /** Default image flags. */
|
---|
95 | #define VBOXHDD_IMAGE_FLAGS_DEFAULT (VBOXHDD_IMAGE_FLAGS_NONE)
|
---|
96 | /** @} */
|
---|
97 |
|
---|
98 | /** @name VBox HDD container image open mode flags
|
---|
99 | * @{
|
---|
100 | */
|
---|
101 | /** Try to open image in read/write exclusive access mode if possible, or in read-only elsewhere. */
|
---|
102 | #define VBOXHDD_OPEN_FLAGS_NORMAL (0)
|
---|
103 | /** Open image in read-only mode with sharing access with others. */
|
---|
104 | #define VBOXHDD_OPEN_FLAGS_READONLY (1)
|
---|
105 | /** Honor zero block writes instead of ignoring them whenever possible. */
|
---|
106 | #define VBOXHDD_OPEN_FLAGS_HONOR_ZEROES (2)
|
---|
107 | /** Mask of valid flags. */
|
---|
108 | #define VBOXHDD_OPEN_FLAGS_MASK (VBOXHDD_OPEN_FLAGS_NORMAL | VBOXHDD_OPEN_FLAGS_READONLY | VBOXHDD_OPEN_FLAGS_HONOR_ZEROES)
|
---|
109 | /** @}*/
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * VBox HDD Container main structure.
|
---|
113 | */
|
---|
114 | /* Forward declaration, VBOXHDD structure is visible only inside VBox HDD module. */
|
---|
115 | struct VBOXHDD;
|
---|
116 | typedef struct VBOXHDD VBOXHDD;
|
---|
117 | typedef VBOXHDD *PVBOXHDD;
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * Allocates and initializes an empty VBox HDD container.
|
---|
121 | * No image files are opened.
|
---|
122 | *
|
---|
123 | * @returns Pointer to newly created empty HDD container.
|
---|
124 | * @returns NULL on failure, typically out of memory.
|
---|
125 | * @param pszBackend Name of the image file backend to use.
|
---|
126 | */
|
---|
127 | VBOXDDU_DECL(PVBOXHDD) VBOXHDDCreate(const char *pszBackend);
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * Destroys the VBox HDD container.
|
---|
131 | * If container has opened image files they will be closed.
|
---|
132 | *
|
---|
133 | * @param pDisk Pointer to VBox HDD container.
|
---|
134 | */
|
---|
135 | VBOXDDU_DECL(void) VBOXHDDDestroy(PVBOXHDD pDisk);
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Opens an image file.
|
---|
139 | *
|
---|
140 | * The first opened image file in a HDD container must have a base image type,
|
---|
141 | * others (next opened images) must be differencing or undo images.
|
---|
142 | * Linkage is checked for differencing image to be consistent with the previously opened image.
|
---|
143 | * When another differencing image is opened and the last image was opened in read/write access
|
---|
144 | * mode, then the last image is reopened in read-only with deny write sharing mode. This allows
|
---|
145 | * other processes to use images in read-only mode too.
|
---|
146 | *
|
---|
147 | * Note that the image is opened in read-only mode if a read/write open is not possible.
|
---|
148 | * Use VBOXHDDIsReadOnly to check open mode.
|
---|
149 | *
|
---|
150 | * @returns VBox status code.
|
---|
151 | * @param pDisk Pointer to VBox HDD container.
|
---|
152 | * @param pszFilename Name of the image file to open.
|
---|
153 | * @param uOpenFlags Image file open mode, see VBOXHDD_OPEN_FLAGS_* constants.
|
---|
154 | */
|
---|
155 | VBOXDDU_DECL(int) VBOXHDDOpenImage(PVBOXHDD pDisk, const char *pszFilename, unsigned uOpenFlags);
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Creates and opens a new base image file.
|
---|
159 | *
|
---|
160 | * @returns VBox status code.
|
---|
161 | * @param pDisk Pointer to VBox HDD container.
|
---|
162 | * @param pszFilename Name of the image file to create.
|
---|
163 | * @param enmType Image type, only base image types are acceptable.
|
---|
164 | * @param cbSize Image size in bytes.
|
---|
165 | * @param uImageFlags Flags specifying special image features.
|
---|
166 | * @param pszComment Pointer to image comment. NULL is ok.
|
---|
167 | * @param uOpenFlags Image file open mode, see VBOXHDD_OPEN_FLAGS_* constants.
|
---|
168 | * @param pfnProgress Progress callback. Optional. NULL if not to be used.
|
---|
169 | * @param pvUser User argument for the progress callback.
|
---|
170 | */
|
---|
171 | VBOXDDU_DECL(int) VBOXHDDCreateBaseImage(PVBOXHDD pDisk, const char *pszFilename,
|
---|
172 | VBOXHDDIMAGETYPE enmType, uint64_t cbSize,
|
---|
173 | unsigned uImageFlags, const char *pszComment,
|
---|
174 | unsigned uOpenFlags,
|
---|
175 | PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
176 |
|
---|
177 | /**
|
---|
178 | * Creates and opens a new differencing image file in HDD container.
|
---|
179 | * See comments for VBOXHDDOpenImage function about differencing images.
|
---|
180 | *
|
---|
181 | * @returns VBox status code.
|
---|
182 | * @param pDisk Pointer to VBox HDD container.
|
---|
183 | * @param pszFilename Name of the differencing image file to create.
|
---|
184 | * @param uImageFlags Flags specifying special image features.
|
---|
185 | * @param pszComment Pointer to image comment. NULL is ok.
|
---|
186 | * @param uOpenFlags Image file open mode, see VBOXHDD_OPEN_FLAGS_* constants.
|
---|
187 | * @param pfnProgress Progress callback. Optional. NULL if not to be used.
|
---|
188 | * @param pvUser User argument for the progress callback.
|
---|
189 | */
|
---|
190 | VBOXDDU_DECL(int) VBOXHDDCreateDifferenceImage(PVBOXHDD pDisk, const char *pszFilename,
|
---|
191 | unsigned uImageFlags, const char *pszComment,
|
---|
192 | unsigned uOpenFlags,
|
---|
193 | PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
194 |
|
---|
195 | /**
|
---|
196 | * Merges two images having a parent/child relationship (both directions).
|
---|
197 | * As a side effect the source image is deleted from both the disk and
|
---|
198 | * the images in the VBox HDD container.
|
---|
199 | *
|
---|
200 | * @returns VBox status code.
|
---|
201 | * @param pDisk Pointer to VBox HDD container.
|
---|
202 | * @param nImageFrom Name of the image file to merge from.
|
---|
203 | * @param nImageTo Name of the image file to merge to.
|
---|
204 | * @param pfnProgress Progress callback. Optional. NULL if not to be used.
|
---|
205 | * @param pvUser User argument for the progress callback.
|
---|
206 | */
|
---|
207 | VBOXDDU_DECL(int) VBOXHDDMergeImage(PVBOXHDD pDisk, unsigned nImageFrom, unsigned nImageTo,
|
---|
208 | PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
209 |
|
---|
210 | /**
|
---|
211 | * Copies an image from one VBox HDD container to another.
|
---|
212 | * The copy is opened in the target VBox HDD container.
|
---|
213 | * It is possible to convert between different image formats, because the
|
---|
214 | * backend for the destination VBox HDD container may be different from the
|
---|
215 | * source container.
|
---|
216 | *
|
---|
217 | * @returns VBox status code.
|
---|
218 | * @param pDiskFrom Pointer to source VBox HDD container.
|
---|
219 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
220 | * @param pDiskTo Pointer to destination VBox HDD container.
|
---|
221 | * @param pfnProgress Progress callback. Optional. NULL if not to be used.
|
---|
222 | * @param pvUser User argument for the progress callback.
|
---|
223 | */
|
---|
224 | VBOXDDU_DECL(int) VBOXHDDCopyImage(PVBOXHDD pDiskFrom, unsigned nImage, PVBOXHDD pDiskTo,
|
---|
225 | PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
226 |
|
---|
227 | /**
|
---|
228 | * Compacts a growing image file by removing zeroed data blocks.
|
---|
229 | * Optionally defragments data in the image so that ascending sector numbers
|
---|
230 | * are stored in ascending location in the image file.
|
---|
231 | *
|
---|
232 | * @returns VBox status code.
|
---|
233 | * @param pDisk Pointer to VBox HDD container.
|
---|
234 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
235 | * @param fDefragment If true, reorder file data so that sectors are stored in ascending order.
|
---|
236 | * @param pfnProgress Progress callback. Optional. NULL if not to be used.
|
---|
237 | * @param pvUser User argument for the progress callback.
|
---|
238 | */
|
---|
239 | VBOXDDU_DECL(int) VBOXHDDCompactImage(PVBOXHDD pDisk, unsigned nImage,
|
---|
240 | bool fDefragment,
|
---|
241 | PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
242 |
|
---|
243 | /**
|
---|
244 | * Resizes an image. Allows setting the disk size to both larger and smaller
|
---|
245 | * values than the current disk size.
|
---|
246 | *
|
---|
247 | * @returns VBox status code.
|
---|
248 | * @param pDisk Pointer to VBox HDD container.
|
---|
249 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
250 | * @param cbSize New image size in bytes.
|
---|
251 | * @param pfnProgress Progress callback. Optional. NULL if not to be used.
|
---|
252 | * @param pvUser User argument for the progress callback.
|
---|
253 | */
|
---|
254 | VBOXDDU_DECL(int) VBOXHDDResizeImage(PVBOXHDD pDisk, unsigned nImage, uint64_t cbSize,
|
---|
255 | PFNVMPROGRESS pfnProgress, void *pvUser);
|
---|
256 |
|
---|
257 | /**
|
---|
258 | * Closes the last opened image file in the HDD container. Leaves all changes inside it.
|
---|
259 | * If previous image file was opened in read-only mode (that is normal) and closing image
|
---|
260 | * was opened in read-write mode (the whole disk was in read-write mode) - the previous image
|
---|
261 | * will be reopened in read/write mode.
|
---|
262 | *
|
---|
263 | * @param pDisk Pointer to VBox HDD container.
|
---|
264 | * @param fDelete If true, delete the image from the host disk.
|
---|
265 | */
|
---|
266 | VBOXDDU_DECL(void) VBOXHDDCloseImage(PVBOXHDD pDisk, bool fDelete);
|
---|
267 |
|
---|
268 | /**
|
---|
269 | * Closes all opened image files in HDD container.
|
---|
270 | *
|
---|
271 | * @param pDisk Pointer to VBox HDD container.
|
---|
272 | */
|
---|
273 | VBOXDDU_DECL(void) VBOXHDDCloseAllImages(PVBOXHDD pDisk);
|
---|
274 |
|
---|
275 | /**
|
---|
276 | * Read data from virtual HDD.
|
---|
277 | *
|
---|
278 | * @returns VBox status code.
|
---|
279 | * @param pDisk Pointer to VBox HDD container.
|
---|
280 | * @param offStart Offset of first reading byte from start of disk.
|
---|
281 | * @param pvBuf Pointer to buffer for reading data.
|
---|
282 | * @param cbToRead Number of bytes to read.
|
---|
283 | */
|
---|
284 | VBOXDDU_DECL(int) VBOXHDDRead(PVBOXHDD pDisk, uint64_t offStart, void *pvBuf, unsigned cbToRead);
|
---|
285 |
|
---|
286 | /**
|
---|
287 | * Write data to virtual HDD.
|
---|
288 | *
|
---|
289 | * @returns VBox status code.
|
---|
290 | * @param pDisk Pointer to VBox HDD container.
|
---|
291 | * @param offStart Offset of first writing byte from start of disk.
|
---|
292 | * @param pvBuf Pointer to buffer of writing data.
|
---|
293 | * @param cbToWrite Number of bytes to write.
|
---|
294 | */
|
---|
295 | VBOXDDU_DECL(int) VBOXHDDWrite(PVBOXHDD pDisk, uint64_t offStart, const void *pvBuf, unsigned cbToWrite);
|
---|
296 |
|
---|
297 | /**
|
---|
298 | * Get number of opened images in HDD container.
|
---|
299 | *
|
---|
300 | * @returns Number of opened images for HDD container. 0 if no images has been opened.
|
---|
301 | * @param pDisk Pointer to VBox HDD container.
|
---|
302 | */
|
---|
303 | VBOXDDU_DECL(int) VBOXHDDGetImagesCount(PVBOXHDD pDisk);
|
---|
304 |
|
---|
305 | /**
|
---|
306 | * Get read/write mode of the VBox HDD container.
|
---|
307 | *
|
---|
308 | * @returns Virtual disk ReadOnly status.
|
---|
309 | * @returns true if no image is opened in HDD container.
|
---|
310 | * @param pDisk Pointer to VBox HDD container.
|
---|
311 | */
|
---|
312 | VBOXDDU_DECL(bool) VBOXHDDIsReadOnly(PVBOXHDD pDisk);
|
---|
313 |
|
---|
314 | /**
|
---|
315 | * Get total disk size of the VBox HDD container.
|
---|
316 | *
|
---|
317 | * @returns Virtual disk size in bytes.
|
---|
318 | * @returns 0 if no image is opened in HDD container.
|
---|
319 | * @param pDisk Pointer to VBox HDD container.
|
---|
320 | */
|
---|
321 | VBOXDDU_DECL(uint64_t) VBOXHDDGetSize(PVBOXHDD pDisk);
|
---|
322 |
|
---|
323 | /**
|
---|
324 | * Get block size of the VBox HDD container.
|
---|
325 | *
|
---|
326 | * @returns Virtual disk block size in bytes.
|
---|
327 | * @returns 0 if no image is opened in HDD container.
|
---|
328 | * @param pDisk Pointer to VBox HDD container.
|
---|
329 | */
|
---|
330 | VBOXDDU_DECL(unsigned) VBOXHDDGetBlockSize(PVBOXHDD pDisk);
|
---|
331 |
|
---|
332 | /**
|
---|
333 | * Get optimal buffer size for working with the VBox HDD container.
|
---|
334 | * The working buffer size is an integral multiple of the block size.
|
---|
335 | *
|
---|
336 | * @returns Virtual disk working buffer size in bytes.
|
---|
337 | * @param pDisk Pointer to VBox HDD container.
|
---|
338 | */
|
---|
339 | VBOXDDU_DECL(unsigned) VBOXHDDGetBufferSize(PVBOXHDD pDisk);
|
---|
340 |
|
---|
341 | /**
|
---|
342 | * Get virtual disk geometry stored in HDD container.
|
---|
343 | *
|
---|
344 | * @returns VBox status code.
|
---|
345 | * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
|
---|
346 | * @returns VERR_VDI_GEOMETRY_NOT_SET if no geometry present in the HDD container.
|
---|
347 | * @param pDisk Pointer to VBox HDD container.
|
---|
348 | * @param pcCylinders Where to store the number of cylinders. NULL is ok.
|
---|
349 | * @param pcHeads Where to store the number of heads. NULL is ok.
|
---|
350 | * @param pcSectors Where to store the number of sectors. NULL is ok.
|
---|
351 | */
|
---|
352 | VBOXDDU_DECL(int) VBOXHDDGetGeometry(PVBOXHDD pDisk, unsigned *pcCylinders, unsigned *pcHeads, unsigned *pcSectors);
|
---|
353 |
|
---|
354 | /**
|
---|
355 | * Store virtual disk geometry in HDD container.
|
---|
356 | *
|
---|
357 | * Note that in case of unrecoverable error all images in HDD container will be closed.
|
---|
358 | *
|
---|
359 | * @returns VBox status code.
|
---|
360 | * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
|
---|
361 | * @param pDisk Pointer to VBox HDD container.
|
---|
362 | * @param cCylinders Number of cylinders.
|
---|
363 | * @param cHeads Number of heads.
|
---|
364 | * @param cSectors Number of sectors.
|
---|
365 | */
|
---|
366 | VBOXDDU_DECL(int) VBOXHDDSetGeometry(PVBOXHDD pDisk, unsigned cCylinders, unsigned cHeads, unsigned cSectors);
|
---|
367 |
|
---|
368 | /**
|
---|
369 | * Get virtual disk translation mode stored in HDD container.
|
---|
370 | *
|
---|
371 | * @returns VBox status code.
|
---|
372 | * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
|
---|
373 | * @param pDisk Pointer to VBox HDD container.
|
---|
374 | * @param penmTranslation Where to store the translation mode (see pdm.h).
|
---|
375 | */
|
---|
376 | VBOXDDU_DECL(int) VBOXHDDGetTranslation(PVBOXHDD pDisk, PPDMBIOSTRANSLATION penmTranslation);
|
---|
377 |
|
---|
378 | /**
|
---|
379 | * Store virtual disk translation mode in HDD container.
|
---|
380 | *
|
---|
381 | * Note that in case of unrecoverable error all images in HDD container will be closed.
|
---|
382 | *
|
---|
383 | * @returns VBox status code.
|
---|
384 | * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
|
---|
385 | * @param pDisk Pointer to VBox HDD container.
|
---|
386 | * @param enmTranslation Translation mode (see pdm.h).
|
---|
387 | */
|
---|
388 | VBOXDDU_DECL(int) VBOXHDDSetTranslation(PVBOXHDD pDisk, PDMBIOSTRANSLATION enmTranslation);
|
---|
389 |
|
---|
390 | /**
|
---|
391 | * Get version of opened image in HDD container.
|
---|
392 | *
|
---|
393 | * @returns VBox status code.
|
---|
394 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
395 | * @param pDisk Pointer to VBox HDD container.
|
---|
396 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
397 | * @param puVersion Where to store the image version.
|
---|
398 | */
|
---|
399 | VBOXDDU_DECL(int) VBOXHDDGetImageVersion(PVBOXHDD pDisk, unsigned nImage, unsigned *puVersion);
|
---|
400 |
|
---|
401 | /**
|
---|
402 | * Get type of opened image in HDD container.
|
---|
403 | *
|
---|
404 | * @returns VBox status code.
|
---|
405 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
406 | * @param pDisk Pointer to VBox HDD container.
|
---|
407 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
408 | * @param penmType Where to store the image type.
|
---|
409 | */
|
---|
410 | VBOXDDU_DECL(int) VBOXHDDGetImageType(PVBOXHDD pDisk, unsigned nImage, PVBOXHDDIMAGETYPE penmType);
|
---|
411 |
|
---|
412 | /**
|
---|
413 | * Get flags of opened image in HDD container.
|
---|
414 | *
|
---|
415 | * @returns VBox status code.
|
---|
416 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
417 | * @param pDisk Pointer to VBox HDD container.
|
---|
418 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
419 | * @param puImageFlags Where to store the image flags.
|
---|
420 | */
|
---|
421 | VBOXDDU_DECL(int) VBOXHDDGetImageFlags(PVBOXHDD pDisk, unsigned nImage, unsigned *puImageFlags);
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Get base filename of opened image in HDD container. Some image formats use
|
---|
425 | * other filenames as well, so don't use this for anything but for informational
|
---|
426 | * purposes.
|
---|
427 | *
|
---|
428 | * @returns VBox status code.
|
---|
429 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
430 | * @returns VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.
|
---|
431 | * @param pDisk Pointer to VBox HDD container.
|
---|
432 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
433 | * @param pszFilename Where to store the image file name.
|
---|
434 | * @param cbFilename Size of buffer pszFilename points to.
|
---|
435 | */
|
---|
436 | VBOXDDU_DECL(int) VBOXHDDGetImageFilename(PVBOXHDD pDisk, unsigned nImage, char *pszFilename, unsigned cbFilename);
|
---|
437 |
|
---|
438 | /**
|
---|
439 | * Get the comment line of opened image in HDD container.
|
---|
440 | *
|
---|
441 | * @returns VBox status code.
|
---|
442 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
443 | * @returns VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.
|
---|
444 | * @param pDisk Pointer to VBox HDD container.
|
---|
445 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
446 | * @param pszComment Where to store the comment string of image. NULL is ok.
|
---|
447 | * @param cbComment The size of pszComment buffer. 0 is ok.
|
---|
448 | */
|
---|
449 | VBOXDDU_DECL(int) VBOXHDDGetImageComment(PVBOXHDD pDisk, unsigned nImage, char *pszComment, unsigned cbComment);
|
---|
450 |
|
---|
451 | /**
|
---|
452 | * Changes the comment line of opened image in HDD container.
|
---|
453 | *
|
---|
454 | * @returns VBox status code.
|
---|
455 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
456 | * @param pDisk Pointer to VBox HDD container.
|
---|
457 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
458 | * @param pszComment New comment string (UTF-8). NULL is allowed to reset the comment.
|
---|
459 | */
|
---|
460 | VBOXDDU_DECL(int) VBOXHDDSetImageComment(PVBOXHDD pDisk, unsigned nImage, const char *pszComment);
|
---|
461 |
|
---|
462 | /**
|
---|
463 | * Get UUID of opened image in HDD container.
|
---|
464 | *
|
---|
465 | * @returns VBox status code.
|
---|
466 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
467 | * @param pDisk Pointer to VBox HDD container.
|
---|
468 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
469 | * @param pUuid Where to store the image creation uuid.
|
---|
470 | */
|
---|
471 | VBOXDDU_DECL(int) VBOXHDDGetImageUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
|
---|
472 |
|
---|
473 | /**
|
---|
474 | * Set the opened image's UUID. Should not be used by normal applications.
|
---|
475 | *
|
---|
476 | * @returns VBox status code.
|
---|
477 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
478 | * @param pDisk Pointer to VBox HDD container.
|
---|
479 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
480 | * @param pUuid Optional parameter, new UUID of the image.
|
---|
481 | */
|
---|
482 | VBOXDDU_DECL(int) VBOXHDDSetImageUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
|
---|
483 |
|
---|
484 | /**
|
---|
485 | * Get last modification UUID of opened image in HDD container.
|
---|
486 | *
|
---|
487 | * @returns VBox status code.
|
---|
488 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
489 | * @param pDisk Pointer to VBox HDD container.
|
---|
490 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
491 | * @param pUuid Where to store the image modification uuid.
|
---|
492 | */
|
---|
493 | VBOXDDU_DECL(int) VBOXHDDGetImageModificationUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
|
---|
494 |
|
---|
495 | /**
|
---|
496 | * Set the opened image's last modification UUID. Should not be used by normal applications.
|
---|
497 | *
|
---|
498 | * @returns VBox status code.
|
---|
499 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
500 | * @param pDisk Pointer to VBox HDD container.
|
---|
501 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
502 | * @param pUuid Optional parameter, new last modification UUID of the image.
|
---|
503 | */
|
---|
504 | VBOXDDU_DECL(int) VBOXHDDSetImageModificationUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
|
---|
505 |
|
---|
506 | /**
|
---|
507 | * Get parent UUID of opened image in HDD container.
|
---|
508 | *
|
---|
509 | * @returns VBox status code.
|
---|
510 | * @returns VERR_VDI_IMAGE_NOT_FOUND if image with specified number was not opened.
|
---|
511 | * @param pDisk Pointer to VBox HDD container.
|
---|
512 | * @param nImage Image number, counts from 0. 0 is always base image of the container.
|
---|
513 | * @param pUuid Where to store the image creation uuid.
|
---|
514 | */
|
---|
515 | VBOXDDU_DECL(int) VBOXHDDGetParentImageUuid(PVBOXHDD pDisk, unsigned nImage, PRTUUID pUuid);
|
---|
516 |
|
---|
517 | /**
|
---|
518 | * Set the image's parent UUID. Should not be used by normal applications.
|
---|
519 | *
|
---|
520 | * @returns VBox status code.
|
---|
521 | * @param pDisk Pointer to VBox HDD container.
|
---|
522 | * @param nImage Image number, counts from 0. 0 is always base image of container.
|
---|
523 | * @param pUuid Optional parameter, new parent UUID of the image.
|
---|
524 | */
|
---|
525 | VBOXDDU_DECL(int) VBOXHDDSetImageParentUuid(PVBOXHDD pDisk, unsigned nImage, PCRTUUID pUuid);
|
---|
526 |
|
---|
527 |
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * Debug helper - dumps all opened images in HDD container into the log file.
|
---|
531 | *
|
---|
532 | * @param pDisk Pointer to VBox HDD container.
|
---|
533 | */
|
---|
534 | VBOXDDU_DECL(void) VBOXHDDDumpImages(PVBOXHDD pDisk);
|
---|
535 |
|
---|
536 | __END_DECLS
|
---|
537 |
|
---|
538 | /** @} */
|
---|
539 |
|
---|
540 | #endif
|
---|