feat: expose drive labels to userspace, render in Files

This commit is contained in:
2026-04-22 07:45:33 +02:00
parent 38b1f8a7ef
commit 7fa2b6c54b
20 changed files with 261 additions and 38 deletions
+10
View File
@@ -1748,6 +1748,14 @@ namespace Fs::Fat32 {
// Template thunks — generate unique function pointers per instance
// =========================================================================
static const char* GetLabelImpl(int inst) {
if (inst < 0 || inst >= g_instanceCount || !g_instances[inst].active) return nullptr;
const char* label = g_instances[inst].volumeLabel;
if (label[0] == '\0' || StrEqualNoCase(label, "NO NAME")) return nullptr;
return label;
}
template<int N> struct Thunks {
static int Open(const char* p) { return OpenImpl(N, p); }
static int Read(int h, uint8_t* b, uint64_t o, uint64_t s) { return ReadImpl(N, h, b, o, s); }
@@ -1759,6 +1767,7 @@ namespace Fs::Fat32 {
static int Delete(const char* p) { return DeleteImpl(N, p); }
static int Mkdir(const char* p) { return MkdirImpl(N, p); }
static int Rename(const char* o, const char* n) { return RenameImpl(N, o, n); }
static const char* GetLabel() { return GetLabelImpl(N); }
};
template<int N>
@@ -1774,6 +1783,7 @@ namespace Fs::Fat32 {
Thunks<N>::Delete,
Thunks<N>::Mkdir,
Thunks<N>::Rename,
Thunks<N>::GetLabel,
};
}