MiniVHD: Add convenience functions to public API. Patch from shermanp.
This commit is contained in:
parent
c7e5dd93b4
commit
22e7faaabc
3 changed files with 45 additions and 3 deletions
|
|
@ -191,6 +191,46 @@ void mvhd_close(MVHDMeta* vhdm);
|
|||
*/
|
||||
MVHDGeom mvhd_calculate_geometry(uint64_t size);
|
||||
|
||||
/**
|
||||
* \brief Get the CHS geometry from the image
|
||||
*
|
||||
* \param [in] vhdm MiniVHD data structure
|
||||
*
|
||||
* \return The CHS geometry as stored in the image
|
||||
*/
|
||||
MVHDGeom mvhd_get_geometry(MVHDMeta* vhdm);
|
||||
|
||||
/**
|
||||
* \brief Get the 'current_size' value from the image
|
||||
*
|
||||
* Note that the size returned may not match the size calculated from the
|
||||
* CHS geometry. It is up to the caller to decide how best to handle this.
|
||||
*
|
||||
* \param [in] vhdm MiniVHD data structure
|
||||
*
|
||||
* \return The 'current_size' value in bytes, as stored in the image.
|
||||
* Note, this may not match the CHS geometry.
|
||||
*/
|
||||
uint64_t mvhd_get_current_size(MVHDMeta* vhdm);
|
||||
|
||||
/**
|
||||
* \brief Calculate CHS geometry size in bytes
|
||||
*
|
||||
* \param [in] geom the CHS geometry to calculate
|
||||
*
|
||||
* \return the size in bytes
|
||||
*/
|
||||
uint64_t mvhd_calc_size_bytes(MVHDGeom *geom);
|
||||
|
||||
/**
|
||||
* \brief Calculate CHS geometry size in sectors
|
||||
*
|
||||
* \param [in] geom the CHS geometry to calculate
|
||||
*
|
||||
* \return the size in sectors
|
||||
*/
|
||||
uint32_t mvhd_calc_size_sectors(MVHDGeom *geom);
|
||||
|
||||
/**
|
||||
* \brief Convert a raw disk image to a fixed VHD image
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "libxml2_encoding.h"
|
||||
#include "minivhd_internal.h"
|
||||
#include "minivhd_util.h"
|
||||
#include "minivhd.h"
|
||||
|
||||
const char MVHD_CONECTIX_COOKIE[] = "conectix";
|
||||
const char MVHD_CREATOR[] = "pcem";
|
||||
|
|
@ -186,6 +187,10 @@ MVHDGeom mvhd_get_geometry(MVHDMeta* vhdm) {
|
|||
return geometry;
|
||||
}
|
||||
|
||||
uint64_t mvhd_get_current_size(MVHDMeta* vhdm) {
|
||||
return vhdm->footer.curr_sz;
|
||||
}
|
||||
|
||||
uint32_t mvhd_gen_footer_checksum(MVHDFooter* footer) {
|
||||
uint32_t new_chk = 0;
|
||||
uint32_t orig_chk = footer->checksum;
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ time_t vhd_get_created_time(MVHDMeta *vhdm);
|
|||
FILE* mvhd_fopen(const char* path, const char* mode, int* err);
|
||||
|
||||
void mvhd_set_encoding_err(int encoding_retval, int* err);
|
||||
uint64_t mvhd_calc_size_bytes(MVHDGeom *geom);
|
||||
uint32_t mvhd_calc_size_sectors(MVHDGeom *geom);
|
||||
MVHDGeom mvhd_get_geometry(MVHDMeta* vhdm);
|
||||
|
||||
/**
|
||||
* \brief Generate VHD footer checksum
|
||||
|
|
|
|||
Loading…
Reference in a new issue