16static bool driversRegistered =
false;
25 bool vfatOk = dvmRegisterFsDriver(&g_vfatFsDriver);
26 bool exfatOk = dvmRegisterFsDriver(&g_exfatFsDriver);
27 bool ntfsOk = dvmRegisterFsDriver(&g_ntfsFsDriver);
29 driversRegistered = vfatOk && exfatOk && ntfsOk;
30 return driversRegistered;
35 for(
int i = 0; i < DVM_WUT_MAX_VOLUMES; i++)
36 if(volumes[i].name[0] !=
'\0' && strcmp(volumes[i].name, name) == 0)
47 for(
int i = 0; i < DVM_WUT_MAX_VOLUMES; i++)
49 if(volumes[i].name[0] ==
'\0')
51 strncpy(volumes[i].name, name,
sizeof(volumes[i].name) - 1);
52 volumes[i].name[
sizeof(volumes[i].name) - 1] =
'\0';
59bool dvmWutMountVolume(
const char * name, DISC_INTERFACE * iface,
unsigned cachePages,
unsigned sectorsPerPage)
61 if(!driversRegistered || !name || !iface)
68 DvmDisc * disc = dvmDiscCreate(iface);
74 DvmDisc * cachedDisc = dvmDiscCacheCreate(disc, cachePages, sectorsPerPage);
88 unsigned mounted = dvmProbeMountDisc(name, disc);
91 disc->vt->destroy(disc);
100void dvmWutUnmountVolume(
const char * name)
110 dvmUnmountVolume(name);
116bool dvmWutVolumeStillPresent(
const char * name)
122 alignas(LIBDVM_BUFFER_ALIGN) uint8_t scratch[512];
123 return dvmDiscProbePresence((DvmDisc *)vol->
disc, scratch);
126bool dvmWutGetVolumeLabel(
const char * name,
char * labelOut,
size_t labelOutSize)
128 if(!name || !labelOut || labelOutSize < 12)
134 if(fatGetVolumeLabel(name, labelOut) && labelOut[0] !=
'\0')
139 return ntfsGetVolumeLabel(name, labelOut, labelOutSize) && labelOut[0] !=
'\0';
One storage slot's dvm mount state.
void * disc
opaque DvmDisc* - valid only while isMounted, NULL otherwise
bool isMounted
true while the volume is mounted through libdvm