mirror of
https://github.com/VARCem/MiniVHD.git
synced 2026-09-23 07:15:01 +00:00
Make 'file_is_vhd' function public
This commit is contained in:
@@ -40,6 +40,7 @@ struct MVHDMeta {
|
||||
int (*format_sectors)(MVHDMeta* vhdm, int offset, int num_sectors);
|
||||
};
|
||||
|
||||
bool mvhd_file_is_vhd(FILE* f);
|
||||
MVHDMeta* mvhd_open(const char* path, int* err);
|
||||
MVHDMeta* mvhd_create_fixed(const char* path, MVHDGeom geom, int* err);
|
||||
MVHDMeta* mvhd_create_sparse(const char* path, MVHDGeom geom, int* err);
|
||||
|
||||
@@ -20,17 +20,6 @@ static bool mvhd_sparse_checksum_valid(MVHDMeta* vhdm);
|
||||
static MVHDBlock* mvhd_read_bat(MVHDMeta *vhdm, MVHDError* err);
|
||||
static void mvhd_calc_sparse_values(MVHDMeta* vhdm);
|
||||
|
||||
static bool mvhd_file_is_vhd(FILE* f) {
|
||||
if (f) {
|
||||
uint8_t con_str[8];
|
||||
fseeko64(f, -MVHD_FOOTER_SIZE, SEEK_END);
|
||||
fread(con_str, sizeof con_str, 1, f);
|
||||
return mvhd_is_conectix_str(con_str);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void mvhd_read_footer(MVHDMeta* vhdm) {
|
||||
uint8_t buffer[MVHD_FOOTER_SIZE];
|
||||
fseeko64(vhdm->f, -MVHD_FOOTER_SIZE, SEEK_END);
|
||||
@@ -114,6 +103,17 @@ static void mvhd_assign_io_funcs(MVHDMeta* vhdm) {
|
||||
}
|
||||
}
|
||||
|
||||
bool mvhd_file_is_vhd(FILE* f) {
|
||||
if (f) {
|
||||
uint8_t con_str[8];
|
||||
fseeko64(f, -MVHD_FOOTER_SIZE, SEEK_END);
|
||||
fread(con_str, sizeof con_str, 1, f);
|
||||
return mvhd_is_conectix_str(con_str);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MVHDGeom mvhd_calculate_geometry(int size_mb, int* new_size) {
|
||||
MVHDGeom chs;
|
||||
uint32_t ts = ((uint64_t)size_mb * 1024 * 1024) / MVHD_SECTOR_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user