mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
fs/fs_dev/romfs_dev: Updated various types to use s64. Removed the inval param from fsDirRead since it doesn't exist. Renamed fileSize in FsDirectoryEntry to file_size and updated the type. Renamed FsFileSystemQueryType to FsFileSystemQueryId, and renamed FsFileSystemQueryType_SetArchiveBit to FsFileSystemQueryId_SetConcatenationFileAttribute. Renamed fsFsSetArchiveBit to fsFsSetConcatenationFileAttribute. Renamed fsdevSetArchiveBit to fsdevSetConcatenationFileAttribute. Minor other changes.
This commit is contained in:
parent
3925e92828
commit
8fe48e8eac
@ -53,8 +53,8 @@ FsFileSystem* fsdevGetDeviceFileSystem(const char *name);
|
|||||||
/// Writes the FS-path to outpath (which has buffer size FS_MAX_PATH), for the input path (as used in stdio). The FsFileSystem is also written to device when not NULL.
|
/// Writes the FS-path to outpath (which has buffer size FS_MAX_PATH), for the input path (as used in stdio). The FsFileSystem is also written to device when not NULL.
|
||||||
int fsdevTranslatePath(const char *path, FsFileSystem** device, char *outpath);
|
int fsdevTranslatePath(const char *path, FsFileSystem** device, char *outpath);
|
||||||
|
|
||||||
/// This calls fsFsSetArchiveBit on the filesystem specified by the input path (as used in stdio).
|
/// This calls fsFsSetConcatenationFileAttribute on the filesystem specified by the input path (as used in stdio).
|
||||||
Result fsdevSetArchiveBit(const char *path);
|
Result fsdevSetConcatenationFileAttribute(const char *path);
|
||||||
|
|
||||||
/// This calls fsFsCreateFile on the filesystem specified by the input path (as used in stdio).
|
/// This calls fsFsCreateFile on the filesystem specified by the input path (as used in stdio).
|
||||||
Result fsdevCreateFile(const char* path, size_t size, u32 flags);
|
Result fsdevCreateFile(const char* path, size_t size, u32 flags);
|
||||||
|
@ -58,7 +58,7 @@ typedef struct {
|
|||||||
u8 pad[3];
|
u8 pad[3];
|
||||||
s8 type; ///< See FsDirEntryType.
|
s8 type; ///< See FsDirEntryType.
|
||||||
u8 pad2[3]; ///< ?
|
u8 pad2[3]; ///< ?
|
||||||
u64 fileSize; ///< File size.
|
s64 file_size; ///< File size.
|
||||||
} FsDirectoryEntry;
|
} FsDirectoryEntry;
|
||||||
|
|
||||||
/// SaveDataAttribute
|
/// SaveDataAttribute
|
||||||
@ -273,8 +273,8 @@ typedef enum {
|
|||||||
} FsFileSystemType;
|
} FsFileSystemType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FsFileSystemQueryType_SetArchiveBit = 0,
|
FsFileSystemQueryId_SetConcatenationFileAttribute = 0,
|
||||||
} FsFileSystemQueryType;
|
} FsFileSystemQueryId;
|
||||||
|
|
||||||
/// FsPriority
|
/// FsPriority
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -346,8 +346,8 @@ Result fsSetGlobalAccessLogMode(u32 mode);
|
|||||||
Result fsGetGlobalAccessLogMode(u32* out_mode);
|
Result fsGetGlobalAccessLogMode(u32* out_mode);
|
||||||
|
|
||||||
// Wrapper(s) for fsCreateSaveDataFileSystemBySystemSaveDataId.
|
// Wrapper(s) for fsCreateSaveDataFileSystemBySystemSaveDataId.
|
||||||
Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid, u64 owner_id, u64 size, u64 journal_size, u32 flags);
|
Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid, u64 owner_id, s64 size, s64 journal_size, u32 flags);
|
||||||
Result fsCreate_SystemSaveData(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, u64 size, u64 journal_size, u32 flags);
|
Result fsCreate_SystemSaveData(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, s64 size, s64 journal_size, u32 flags);
|
||||||
|
|
||||||
/// Wrapper(s) for fsOpenSaveDataFileSystem.
|
/// Wrapper(s) for fsOpenSaveDataFileSystem.
|
||||||
/// See FsSave for program_id and uid.
|
/// See FsSave for program_id and uid.
|
||||||
@ -358,7 +358,7 @@ Result fsOpen_SaveData(FsFileSystem* out, u64 application_id, AccountUid uid);
|
|||||||
Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid);
|
Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid);
|
||||||
|
|
||||||
// IFileSystem
|
// IFileSystem
|
||||||
Result fsFsCreateFile(FsFileSystem* fs, const char* path, u64 size, u32 option);
|
Result fsFsCreateFile(FsFileSystem* fs, const char* path, s64 size, u32 option);
|
||||||
Result fsFsDeleteFile(FsFileSystem* fs, const char* path);
|
Result fsFsDeleteFile(FsFileSystem* fs, const char* path);
|
||||||
Result fsFsCreateDirectory(FsFileSystem* fs, const char* path);
|
Result fsFsCreateDirectory(FsFileSystem* fs, const char* path);
|
||||||
Result fsFsDeleteDirectory(FsFileSystem* fs, const char* path);
|
Result fsFsDeleteDirectory(FsFileSystem* fs, const char* path);
|
||||||
@ -369,44 +369,44 @@ Result fsFsGetEntryType(FsFileSystem* fs, const char* path, FsDirEntryType* out)
|
|||||||
Result fsFsOpenFile(FsFileSystem* fs, const char* path, u32 mode, FsFile* out);
|
Result fsFsOpenFile(FsFileSystem* fs, const char* path, u32 mode, FsFile* out);
|
||||||
Result fsFsOpenDirectory(FsFileSystem* fs, const char* path, u32 mode, FsDir* out);
|
Result fsFsOpenDirectory(FsFileSystem* fs, const char* path, u32 mode, FsDir* out);
|
||||||
Result fsFsCommit(FsFileSystem* fs);
|
Result fsFsCommit(FsFileSystem* fs);
|
||||||
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, u64* out);
|
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, s64* out);
|
||||||
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, u64* out);
|
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, s64* out);
|
||||||
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRaw *out); ///< [3.0.0+]
|
Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRaw *out); ///< [3.0.0+]
|
||||||
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path); ///< [3.0.0+]
|
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path); ///< [3.0.0+]
|
||||||
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryType query_type); ///< [4.0.0+]
|
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryId query_id); ///< [4.0.0+]
|
||||||
void fsFsClose(FsFileSystem* fs);
|
void fsFsClose(FsFileSystem* fs);
|
||||||
|
|
||||||
/// Uses \ref fsFsQueryEntry to set the archive bit on the specified absolute directory path.
|
/// Uses \ref fsFsQueryEntry to set the archive bit on the specified absolute directory path.
|
||||||
/// This will cause HOS to treat the directory as if it were a file containing the directory's concatenated contents.
|
/// This will cause HOS to treat the directory as if it were a file containing the directory's concatenated contents.
|
||||||
Result fsFsSetArchiveBit(FsFileSystem* fs, const char *path);
|
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path);
|
||||||
|
|
||||||
// IFile
|
// IFile
|
||||||
Result fsFileRead(FsFile* f, u64 off, void* buf, u64 read_size, u32 option, u64* bytes_read);
|
Result fsFileRead(FsFile* f, s64 off, void* buf, u64 read_size, u32 option, u64* bytes_read);
|
||||||
Result fsFileWrite(FsFile* f, u64 off, const void* buf, u64 write_size, u32 option);
|
Result fsFileWrite(FsFile* f, s64 off, const void* buf, u64 write_size, u32 option);
|
||||||
Result fsFileFlush(FsFile* f);
|
Result fsFileFlush(FsFile* f);
|
||||||
Result fsFileSetSize(FsFile* f, u64 sz);
|
Result fsFileSetSize(FsFile* f, s64 sz);
|
||||||
Result fsFileGetSize(FsFile* f, u64* out);
|
Result fsFileGetSize(FsFile* f, s64* out);
|
||||||
Result fsFileOperateRange(FsFile* f, FsOperationId op_id, u64 off, u64 len, FsRangeInfo* out); ///< [4.0.0+]
|
Result fsFileOperateRange(FsFile* f, FsOperationId op_id, s64 off, s64 len, FsRangeInfo* out); ///< [4.0.0+]
|
||||||
void fsFileClose(FsFile* f);
|
void fsFileClose(FsFile* f);
|
||||||
|
|
||||||
// IDirectory
|
// IDirectory
|
||||||
Result fsDirRead(FsDir* d, u64 inval, u64* total_entries, size_t max_entries, FsDirectoryEntry *buf);
|
Result fsDirRead(FsDir* d, s64* total_entries, size_t max_entries, FsDirectoryEntry *buf);
|
||||||
Result fsDirGetEntryCount(FsDir* d, u64* count);
|
Result fsDirGetEntryCount(FsDir* d, s64* count);
|
||||||
void fsDirClose(FsDir* d);
|
void fsDirClose(FsDir* d);
|
||||||
|
|
||||||
// IStorage
|
// IStorage
|
||||||
Result fsStorageRead(FsStorage* s, u64 off, void* buf, u64 read_size);
|
Result fsStorageRead(FsStorage* s, s64 off, void* buf, u64 read_size);
|
||||||
Result fsStorageWrite(FsStorage* s, u64 off, const void* buf, u64 write_size);
|
Result fsStorageWrite(FsStorage* s, s64 off, const void* buf, u64 write_size);
|
||||||
Result fsStorageFlush(FsStorage* s);
|
Result fsStorageFlush(FsStorage* s);
|
||||||
Result fsStorageSetSize(FsStorage* s, u64 sz);
|
Result fsStorageSetSize(FsStorage* s, s64 sz);
|
||||||
Result fsStorageGetSize(FsStorage* s, u64* out);
|
Result fsStorageGetSize(FsStorage* s, s64* out);
|
||||||
Result fsStorageOperateRange(FsStorage* s, FsOperationId op_id, u64 off, u64 len, FsRangeInfo* out); ///< [4.0.0+]
|
Result fsStorageOperateRange(FsStorage* s, FsOperationId op_id, s64 off, s64 len, FsRangeInfo* out); ///< [4.0.0+]
|
||||||
void fsStorageClose(FsStorage* s);
|
void fsStorageClose(FsStorage* s);
|
||||||
|
|
||||||
// ISaveDataInfoReader
|
// ISaveDataInfoReader
|
||||||
|
|
||||||
/// Read FsSaveDataInfo data into the buf array.
|
/// Read FsSaveDataInfo data into the buf array.
|
||||||
Result fsSaveDataInfoReaderRead(FsSaveDataInfoReader *s, FsSaveDataInfo* buf, size_t max_entries, u64* total_entries);
|
Result fsSaveDataInfoReaderRead(FsSaveDataInfoReader *s, FsSaveDataInfo* buf, size_t max_entries, s64* total_entries);
|
||||||
void fsSaveDataInfoReaderClose(FsSaveDataInfoReader *s);
|
void fsSaveDataInfoReaderClose(FsSaveDataInfoReader *s);
|
||||||
|
|
||||||
// IEventNotifier
|
// IEventNotifier
|
||||||
|
@ -57,7 +57,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
FsFile fd;
|
FsFile fd;
|
||||||
int flags; /*! Flags used in open(2) */
|
int flags; /*! Flags used in open(2) */
|
||||||
u64 offset; /*! Current file offset */
|
s64 offset; /*! Current file offset */
|
||||||
FsTimeStampRaw timestamps;
|
FsTimeStampRaw timestamps;
|
||||||
} fsdev_file_t;
|
} fsdev_file_t;
|
||||||
|
|
||||||
@ -397,14 +397,14 @@ Result fsdevCommitDevice(const char *name)
|
|||||||
return fsFsCommit(&device->fs);
|
return fsFsCommit(&device->fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsdevSetArchiveBit(const char *path) {
|
Result fsdevSetConcatenationFileAttribute(const char *path) {
|
||||||
char *fs_path = __nx_dev_path_buf;
|
char *fs_path = __nx_dev_path_buf;
|
||||||
fsdev_fsdevice *device = NULL;
|
fsdev_fsdevice *device = NULL;
|
||||||
|
|
||||||
if(fsdev_getfspath(_REENT, path, &device, fs_path)==-1)
|
if(fsdev_getfspath(_REENT, path, &device, fs_path)==-1)
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
return MAKERESULT(Module_Libnx, LibnxError_NotFound);
|
||||||
|
|
||||||
return fsFsSetArchiveBit(&device->fs, fs_path);
|
return fsFsSetConcatenationFileAttribute(&device->fs, fs_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsdevCreateFile(const char* path, size_t size, u32 flags) {
|
Result fsdevCreateFile(const char* path, size_t size, u32 flags) {
|
||||||
@ -911,7 +911,7 @@ fsdev_seek(struct _reent *r,
|
|||||||
int whence)
|
int whence)
|
||||||
{
|
{
|
||||||
Result rc;
|
Result rc;
|
||||||
u64 offset;
|
s64 offset;
|
||||||
|
|
||||||
/* get pointer to our data */
|
/* get pointer to our data */
|
||||||
fsdev_file_t *file = (fsdev_file_t*)fd;
|
fsdev_file_t *file = (fsdev_file_t*)fd;
|
||||||
@ -973,7 +973,7 @@ fsdev_fstat(struct _reent *r,
|
|||||||
struct stat *st)
|
struct stat *st)
|
||||||
{
|
{
|
||||||
Result rc;
|
Result rc;
|
||||||
u64 size;
|
s64 size;
|
||||||
fsdev_file_t *file = (fsdev_file_t*)fd;
|
fsdev_file_t *file = (fsdev_file_t*)fd;
|
||||||
|
|
||||||
rc = fsFileGetSize(&file->fd, &size);
|
rc = fsFileGetSize(&file->fd, &size);
|
||||||
@ -1318,7 +1318,7 @@ fsdev_dirnext(struct _reent *r,
|
|||||||
struct stat *filestat)
|
struct stat *filestat)
|
||||||
{
|
{
|
||||||
Result rc;
|
Result rc;
|
||||||
u64 entries;
|
s64 entries;
|
||||||
ssize_t units;
|
ssize_t units;
|
||||||
FsDirectoryEntry *entry;
|
FsDirectoryEntry *entry;
|
||||||
|
|
||||||
@ -1341,7 +1341,7 @@ fsdev_dirnext(struct _reent *r,
|
|||||||
|
|
||||||
/* fetch the next batch */
|
/* fetch the next batch */
|
||||||
memset(entry_data, 0, sizeof(FsDirectoryEntry)*max_entries);
|
memset(entry_data, 0, sizeof(FsDirectoryEntry)*max_entries);
|
||||||
rc = fsDirRead(&dir->fd, 0, &entries, max_entries, entry_data);
|
rc = fsDirRead(&dir->fd, &entries, max_entries, entry_data);
|
||||||
if(R_SUCCEEDED(rc))
|
if(R_SUCCEEDED(rc))
|
||||||
{
|
{
|
||||||
if(entries == 0)
|
if(entries == 0)
|
||||||
@ -1367,7 +1367,7 @@ fsdev_dirnext(struct _reent *r,
|
|||||||
else if(entry->type == FsDirEntryType_File)
|
else if(entry->type == FsDirEntryType_File)
|
||||||
{
|
{
|
||||||
filestat->st_mode = S_IFREG;
|
filestat->st_mode = S_IFREG;
|
||||||
filestat->st_size = entry->fileSize;
|
filestat->st_size = entry->file_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1440,7 +1440,7 @@ fsdev_statvfs(struct _reent *r,
|
|||||||
Result rc=0;
|
Result rc=0;
|
||||||
char *fs_path = __nx_dev_path_buf;
|
char *fs_path = __nx_dev_path_buf;
|
||||||
fsdev_fsdevice *device = r->deviceData;
|
fsdev_fsdevice *device = r->deviceData;
|
||||||
u64 freespace = 0, total_space = 0;
|
s64 freespace = 0, total_space = 0;
|
||||||
|
|
||||||
if(fsdev_getfspath(r, path, &device, fs_path)==-1)
|
if(fsdev_getfspath(r, path, &device, fs_path)==-1)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -64,7 +64,7 @@ static romfs_file *romFS_file(romfs_mount *mount, u32 off)
|
|||||||
|
|
||||||
static ssize_t _romfs_read(romfs_mount *mount, u64 offset, void* buffer, u64 size)
|
static ssize_t _romfs_read(romfs_mount *mount, u64 offset, void* buffer, u64 size)
|
||||||
{
|
{
|
||||||
u64 pos = mount->offset + offset;
|
s64 pos = mount->offset + offset;
|
||||||
u64 read = 0;
|
u64 read = 0;
|
||||||
Result rc = 0;
|
Result rc = 0;
|
||||||
if(mount->fd_type == RomfsSource_FsFile)
|
if(mount->fd_type == RomfsSource_FsFile)
|
||||||
|
@ -446,7 +446,7 @@ Result fsGetGlobalAccessLogMode(u32* out_mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrapper(s) for fsCreateSaveDataFileSystemBySystemSaveDataId.
|
// Wrapper(s) for fsCreateSaveDataFileSystemBySystemSaveDataId.
|
||||||
Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid, u64 owner_id, u64 size, u64 journal_size, u32 flags) {
|
Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, AccountUid uid, u64 owner_id, s64 size, s64 journal_size, u32 flags) {
|
||||||
FsSaveDataAttribute attr = {
|
FsSaveDataAttribute attr = {
|
||||||
.uid = uid,
|
.uid = uid,
|
||||||
.system_save_data_id = system_save_data_id,
|
.system_save_data_id = system_save_data_id,
|
||||||
@ -463,7 +463,7 @@ Result fsCreate_SystemSaveDataWithOwner(FsSaveDataSpaceId save_data_space_id, u6
|
|||||||
return fsCreateSaveDataFileSystemBySystemSaveDataId(&attr, &create);
|
return fsCreateSaveDataFileSystemBySystemSaveDataId(&attr, &create);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsCreate_SystemSaveData(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, u64 size, u64 journal_size, u32 flags) {
|
Result fsCreate_SystemSaveData(FsSaveDataSpaceId save_data_space_id, u64 system_save_data_id, s64 size, s64 journal_size, u32 flags) {
|
||||||
return fsCreate_SystemSaveDataWithOwner(save_data_space_id, system_save_data_id, (AccountUid){}, 0, size, journal_size, flags);
|
return fsCreate_SystemSaveDataWithOwner(save_data_space_id, system_save_data_id, (AccountUid){}, 0, size, journal_size, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +494,7 @@ Result fsOpen_SystemSaveData(FsFileSystem* out, FsSaveDataSpaceId save_data_spac
|
|||||||
// IFileSystem
|
// IFileSystem
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Result fsFsCreateFile(FsFileSystem* fs, const char* path, u64 size, u32 option) {
|
Result fsFsCreateFile(FsFileSystem* fs, const char* path, s64 size, u32 option) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 option;
|
u32 option;
|
||||||
u64 size;
|
u64 size;
|
||||||
@ -585,12 +585,12 @@ static Result _fsFsCmdWithInPathAndOutU64(FsFileSystem* fs, const char* path, u6
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, u64* out) {
|
Result fsFsGetFreeSpace(FsFileSystem* fs, const char* path, s64* out) {
|
||||||
return _fsFsCmdWithInPathAndOutU64(fs, path, out, 11);
|
return _fsFsCmdWithInPathAndOutU64(fs, path, (u64*)out, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, u64* out) {
|
Result fsFsGetTotalSpace(FsFileSystem* fs, const char* path, s64* out) {
|
||||||
return _fsFsCmdWithInPathAndOutU64(fs, path, out, 12);
|
return _fsFsCmdWithInPathAndOutU64(fs, path, (u64*)out, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path) {
|
Result fsFsCleanDirectoryRecursively(FsFileSystem* fs, const char* path) {
|
||||||
@ -610,14 +610,14 @@ Result fsFsGetFileTimeStampRaw(FsFileSystem* fs, const char* path, FsTimeStampRa
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryType query_type) {
|
Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *in, size_t in_size, const char* path, FsFileSystemQueryId query_id) {
|
||||||
if (hosversionBefore(4,0,0))
|
if (hosversionBefore(4,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
char send_path[FS_MAX_PATH] = {0};
|
char send_path[FS_MAX_PATH] = {0};
|
||||||
strncpy(send_path, path, sizeof(send_path)-1);
|
strncpy(send_path, path, sizeof(send_path)-1);
|
||||||
|
|
||||||
return _fsObjectDispatchIn(&fs->s, 15, query_type,
|
return _fsObjectDispatchIn(&fs->s, 15, query_id,
|
||||||
.buffer_attrs = {
|
.buffer_attrs = {
|
||||||
SfBufferAttr_HipcPointer | SfBufferAttr_In,
|
SfBufferAttr_HipcPointer | SfBufferAttr_In,
|
||||||
SfBufferAttr_HipcMapAlias | SfBufferAttr_In | SfBufferAttr_HipcMapTransferAllowsNonSecure,
|
SfBufferAttr_HipcMapAlias | SfBufferAttr_In | SfBufferAttr_HipcMapTransferAllowsNonSecure,
|
||||||
@ -631,8 +631,8 @@ Result fsFsQueryEntry(FsFileSystem* fs, void *out, size_t out_size, const void *
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFsSetArchiveBit(FsFileSystem* fs, const char *path) {
|
Result fsFsSetConcatenationFileAttribute(FsFileSystem* fs, const char *path) {
|
||||||
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryType_SetArchiveBit);
|
return fsFsQueryEntry(fs, NULL, 0, NULL, 0, path, FsFileSystemQueryId_SetConcatenationFileAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsFsClose(FsFileSystem* fs) {
|
void fsFsClose(FsFileSystem* fs) {
|
||||||
@ -643,11 +643,11 @@ void fsFsClose(FsFileSystem* fs) {
|
|||||||
// IFile
|
// IFile
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Result fsFileRead(FsFile* f, u64 off, void* buf, u64 read_size, u32 option, u64* bytes_read) {
|
Result fsFileRead(FsFile* f, s64 off, void* buf, u64 read_size, u32 option, u64* bytes_read) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 option;
|
u32 option;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 offset;
|
s64 offset;
|
||||||
u64 read_size;
|
u64 read_size;
|
||||||
} in = { option, 0, off, read_size };
|
} in = { option, 0, off, read_size };
|
||||||
|
|
||||||
@ -657,11 +657,11 @@ Result fsFileRead(FsFile* f, u64 off, void* buf, u64 read_size, u32 option, u64*
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFileWrite(FsFile* f, u64 off, const void* buf, u64 write_size, u32 option) {
|
Result fsFileWrite(FsFile* f, s64 off, const void* buf, u64 write_size, u32 option) {
|
||||||
const struct {
|
const struct {
|
||||||
u32 option;
|
u32 option;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 offset;
|
s64 offset;
|
||||||
u64 write_size;
|
u64 write_size;
|
||||||
} in = { option, 0, off, write_size };
|
} in = { option, 0, off, write_size };
|
||||||
|
|
||||||
@ -675,23 +675,23 @@ Result fsFileFlush(FsFile* f) {
|
|||||||
return _fsCmdNoIO(&f->s, 2);
|
return _fsCmdNoIO(&f->s, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFileSetSize(FsFile* f, u64 sz) {
|
Result fsFileSetSize(FsFile* f, s64 sz) {
|
||||||
return _fsObjectDispatchIn(&f->s, 3, sz);
|
return _fsObjectDispatchIn(&f->s, 3, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFileGetSize(FsFile* f, u64* out) {
|
Result fsFileGetSize(FsFile* f, s64* out) {
|
||||||
return _fsObjectDispatchOut(&f->s, 4, *out);
|
return _fsObjectDispatchOut(&f->s, 4, *out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsFileOperateRange(FsFile* f, FsOperationId op_id, u64 off, u64 len, FsRangeInfo* out) {
|
Result fsFileOperateRange(FsFile* f, FsOperationId op_id, s64 off, s64 len, FsRangeInfo* out) {
|
||||||
if (hosversionBefore(4,0,0))
|
if (hosversionBefore(4,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u32 op_id;
|
u32 op_id;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 off;
|
s64 off;
|
||||||
u64 len;
|
s64 len;
|
||||||
} in = { op_id, 0, off, len };
|
} in = { op_id, 0, off, len };
|
||||||
|
|
||||||
return _fsObjectDispatchInOut(&f->s, 5, in, *out);
|
return _fsObjectDispatchInOut(&f->s, 5, in, *out);
|
||||||
@ -706,14 +706,14 @@ void fsDirClose(FsDir* d) {
|
|||||||
_fsObjectClose(&d->s);
|
_fsObjectClose(&d->s);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsDirRead(FsDir* d, u64 inval, u64* total_entries, size_t max_entries, FsDirectoryEntry *buf) {
|
Result fsDirRead(FsDir* d, s64* total_entries, size_t max_entries, FsDirectoryEntry *buf) {
|
||||||
return _fsObjectDispatchInOut(&d->s, 0, inval, *total_entries,
|
return _fsObjectDispatchOut(&d->s, 0, *total_entries,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
.buffers = { { buf, sizeof(FsDirectoryEntry)*max_entries } },
|
.buffers = { { buf, max_entries*sizeof(FsDirectoryEntry) } },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsDirGetEntryCount(FsDir* d, u64* count) {
|
Result fsDirGetEntryCount(FsDir* d, s64* count) {
|
||||||
return _fsObjectDispatchOut(&d->s, 1, *count);
|
return _fsObjectDispatchOut(&d->s, 1, *count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,9 +721,9 @@ Result fsDirGetEntryCount(FsDir* d, u64* count) {
|
|||||||
// IStorage
|
// IStorage
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
Result fsStorageRead(FsStorage* s, u64 off, void* buf, u64 read_size) {
|
Result fsStorageRead(FsStorage* s, s64 off, void* buf, u64 read_size) {
|
||||||
const struct {
|
const struct {
|
||||||
u64 offset;
|
s64 offset;
|
||||||
u64 read_size;
|
u64 read_size;
|
||||||
} in = { off, read_size };
|
} in = { off, read_size };
|
||||||
|
|
||||||
@ -733,9 +733,9 @@ Result fsStorageRead(FsStorage* s, u64 off, void* buf, u64 read_size) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsStorageWrite(FsStorage* s, u64 off, const void* buf, u64 write_size) {
|
Result fsStorageWrite(FsStorage* s, s64 off, const void* buf, u64 write_size) {
|
||||||
const struct {
|
const struct {
|
||||||
u64 offset;
|
s64 offset;
|
||||||
u64 write_size;
|
u64 write_size;
|
||||||
} in = { off, write_size };
|
} in = { off, write_size };
|
||||||
|
|
||||||
@ -749,23 +749,23 @@ Result fsStorageFlush(FsStorage* s) {
|
|||||||
return _fsCmdNoIO(&s->s, 2);
|
return _fsCmdNoIO(&s->s, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsStorageSetSize(FsStorage* s, u64 sz) {
|
Result fsStorageSetSize(FsStorage* s, s64 sz) {
|
||||||
return _fsObjectDispatchIn(&s->s, 3, sz);
|
return _fsObjectDispatchIn(&s->s, 3, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsStorageGetSize(FsStorage* s, u64* out) {
|
Result fsStorageGetSize(FsStorage* s, s64* out) {
|
||||||
return _fsObjectDispatchOut(&s->s, 4, *out);
|
return _fsObjectDispatchOut(&s->s, 4, *out);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result fsStorageOperateRange(FsStorage* s, FsOperationId op_id, u64 off, u64 len, FsRangeInfo* out) {
|
Result fsStorageOperateRange(FsStorage* s, FsOperationId op_id, s64 off, s64 len, FsRangeInfo* out) {
|
||||||
if (hosversionBefore(4,0,0))
|
if (hosversionBefore(4,0,0))
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
|
||||||
const struct {
|
const struct {
|
||||||
u32 op_id;
|
u32 op_id;
|
||||||
u32 pad;
|
u32 pad;
|
||||||
u64 off;
|
s64 off;
|
||||||
u64 len;
|
s64 len;
|
||||||
} in = { op_id, 0, off, len };
|
} in = { op_id, 0, off, len };
|
||||||
|
|
||||||
return _fsObjectDispatchInOut(&s->s, 5, in, *out);
|
return _fsObjectDispatchInOut(&s->s, 5, in, *out);
|
||||||
@ -780,10 +780,10 @@ void fsStorageClose(FsStorage* s) {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Actually called ReadSaveDataInfo
|
// Actually called ReadSaveDataInfo
|
||||||
Result fsSaveDataInfoReaderRead(FsSaveDataInfoReader *s, FsSaveDataInfo* buf, size_t max_entries, u64* total_entries) {
|
Result fsSaveDataInfoReaderRead(FsSaveDataInfoReader *s, FsSaveDataInfo* buf, size_t max_entries, s64* total_entries) {
|
||||||
return _fsObjectDispatchOut(&s->s, 0, *total_entries,
|
return _fsObjectDispatchOut(&s->s, 0, *total_entries,
|
||||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||||
.buffers = { { buf, sizeof(FsSaveDataInfo)*max_entries } },
|
.buffers = { { buf, max_entries*sizeof(FsSaveDataInfo) } },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user