summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem/fsp/fsp_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/filesystem/fsp/fsp_util.h')
-rw-r--r--src/core/hle/service/filesystem/fsp/fsp_util.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/hle/service/filesystem/fsp/fsp_util.h b/src/core/hle/service/filesystem/fsp/fsp_util.h
new file mode 100644
index 000000000..253f866db
--- /dev/null
+++ b/src/core/hle/service/filesystem/fsp/fsp_util.h
@@ -0,0 +1,22 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "core/hle/service/filesystem/filesystem.h"
+
+namespace Service::FileSystem {
+
+struct SizeGetter {
+ std::function<u64()> get_free_size;
+ std::function<u64()> get_total_size;
+
+ static SizeGetter FromStorageId(const FileSystemController& fsc, FileSys::StorageId id) {
+ return {
+ [&fsc, id] { return fsc.GetFreeSpaceSize(id); },
+ [&fsc, id] { return fsc.GetTotalSpaceSize(id); },
+ };
+ }
+};
+
+} // namespace Service::FileSystem