dynamic_libs/source/fs_defs.h

93 lines
2.2 KiB
C
Raw Normal View History

#ifndef FS_DEFS_H
2017-04-30 03:34:09 +02:00
#define FS_DEFS_H
#ifdef __cplusplus
extern "C" {
#endif
2017-08-26 01:08:55 +02:00
#include "os_types.h"
/* FS defines and types */
#define FS_MAX_LOCALPATH_SIZE 511
#define FS_MAX_MOUNTPATH_SIZE 128
#define FS_MAX_FULLPATH_SIZE (FS_MAX_LOCALPATH_SIZE + FS_MAX_MOUNTPATH_SIZE)
#define FS_MAX_ARGPATH_SIZE FS_MAX_FULLPATH_SIZE
#define FS_STATUS_OK 0
2017-08-26 01:08:55 +02:00
#define FS_STATUS_EOF -2
2017-08-27 19:24:49 +02:00
#define FS_STATUS_FATAL_ERROR -0x400
#define FS_RET_UNSUPPORTED_CMD 0x0400
#define FS_RET_NO_ERROR 0x0000
#define FS_RET_ALL_ERROR (u32)(-1)
2017-09-30 13:25:58 +02:00
#define FS_IO_BUFFER_ALIGN 64
#define FS_STAT_FLAG_IS_DIRECTORY 0x80000000
/* max length of file/dir name */
#define FS_MAX_ENTNAME_SIZE 256
#define FS_SOURCETYPE_EXTERNAL 0
#define FS_SOURCETYPE_HFIO 1
#define FS_MOUNT_SOURCE_SIZE 0x300
#define FS_CLIENT_SIZE 0x1700
#define FS_CMD_BLOCK_SIZE 0xA80
2017-08-27 14:02:16 +02:00
typedef struct FSClient_ {
u8 buffer[FS_CLIENT_SIZE];
2018-03-11 16:46:31 +01:00
} FSClient;
2017-08-27 14:02:16 +02:00
typedef struct FSCmdBlock_ {
u8 buffer[FS_CMD_BLOCK_SIZE];
2017-08-27 14:02:16 +02:00
} FSCmdBlock;
2018-03-11 16:46:31 +01:00
typedef struct {
2017-09-17 00:02:00 +02:00
u32 flag;
u32 permission;
u32 owner_id;
u32 group_id;
u32 size;
u32 alloc_size;
u64 quota_size;
u32 ent_id;
u64 ctime;
u64 mtime;
u8 attributes[48];
} __attribute__((packed)) FSStat;
2018-03-11 16:46:31 +01:00
typedef struct {
FSStat stat;
char name[FS_MAX_ENTNAME_SIZE];
} FSDirEntry;
2017-09-17 00:02:00 +02:00
typedef void (*FSAsyncCallback)(FSClient * pClient, FSCmdBlock * pCmd, s32 result, void *context);
2018-03-11 16:46:31 +01:00
typedef struct {
2017-05-10 20:52:34 +02:00
FSAsyncCallback userCallback;
void *userContext;
2017-08-26 01:08:55 +02:00
OSMessageQueue *ioMsgQueue;
2017-05-10 20:52:34 +02:00
} FSAsyncParams;
2018-03-11 16:46:31 +01:00
typedef struct {
2017-08-26 01:08:55 +02:00
void* data; // pointer to a FSAsyncResult;
u32 unkwn1;
u32 unkwn2;
u32 unkwn3; // always 0x08
} __attribute__((packed)) FSMessage;
2018-03-11 16:46:31 +01:00
typedef struct FSAsyncResult_ {
2017-08-26 01:08:55 +02:00
FSAsyncParams userParams;
FSMessage ioMsg;
2017-08-27 14:02:16 +02:00
FSClient * client;
FSCmdBlock * block;
2017-08-26 01:08:55 +02:00
u32 result;
} FSAsyncResult;
#ifdef __cplusplus
}
#endif
2017-04-30 03:34:09 +02:00
#endif /* FS_DEFS_H */