libctru  v2.4.1
archive.h
Go to the documentation of this file.
1 /**
2  * @file archive.h
3  * @brief FS_Archive driver
4  */
5 #pragma once
6 
7 #include <sys/types.h>
8 
9 #include <3ds/types.h>
10 #include <3ds/services/fs.h>
11 
12 #define ARCHIVE_DIRITER_MAGIC 0x68637261 /* "arch" */
13 
14 /*! Open directory struct */
15 typedef struct
16 {
17  u32 magic; /*! "arch" */
18  Handle fd; /*! CTRU handle */
19  ssize_t index; /*! Current entry index */
20  size_t size; /*! Current batch size */
21  FS_DirectoryEntry entry_data[32]; /*! Temporary storage for reading entries */
23 
24 /// Mounts the SD
26 
27 /// Mounts and opens an archive as deviceName
28 /// Returns either an archive open error code, or -1 for generic failure
29 Result archiveMount(FS_ArchiveID archiveID, FS_Path archivePath, const char *deviceName);
30 
31 /// Uses FSUSER_ControlArchive with control action ARCHIVE_ACTION_COMMIT_SAVE_DATA on the opened archive. Not done automatically at unmount.
32 /// Returns -1 if the specified device is not found
33 Result archiveCommitSaveData(const char *deviceName);
34 
35 /// Unmounts the specified device, closing its archive in the process
36 /// Returns -1 if the specified device was not found
37 Result archiveUnmount(const char *deviceName);
38 
39 /// Unmounts all devices and cleans up any resources used by the driver
41 
42 /// Get a file's mtime
43 Result archive_getmtime(const char *name, u64 *mtime);
Result archiveUnmount(const char *deviceName)
Unmounts the specified device, closing its archive in the process Returns -1 if the specified device ...
Result archiveMountSdmc(void)
Mounts the SD.
Result archiveCommitSaveData(const char *deviceName)
Uses FSUSER_ControlArchive with control action ARCHIVE_ACTION_COMMIT_SAVE_DATA on the opened archive.
Result archiveMount(FS_ArchiveID archiveID, FS_Path archivePath, const char *deviceName)
Mounts and opens an archive as deviceName Returns either an archive open error code,...
Result archive_getmtime(const char *name, u64 *mtime)
Get a file's mtime.
Result archiveUnmountAll(void)
Unmounts all devices and cleans up any resources used by the driver.
Filesystem Services.
FS_ArchiveID
Archive IDs.
Definition: fs.h:52
Directory entry.
Definition: fs.h:162
Filesystem path data, detailing the specific target of an operation.
Definition: fs.h:232
Open directory struct.
Definition: archive.h:16
size_t size
Current entry index.
Definition: archive.h:20
ssize_t index
CTRU handle.
Definition: archive.h:19
Handle fd
"arch"
Definition: archive.h:18
Various system types.
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint32_t u32
32-bit unsigned integer
Definition: types.h:23