2016-08-03 20:12:42 +02:00
|
|
|
#ifndef FS_DEFS_H
|
2017-04-30 03:34:09 +02:00
|
|
|
#define FS_DEFS_H
|
2016-08-03 20:12:42 +02:00
|
|
|
|
|
|
|
#include <gctypes.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-08-26 01:08:55 +02:00
|
|
|
#include "os_types.h"
|
2016-08-03 20:12:42 +02:00
|
|
|
|
|
|
|
/* 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
|
2016-08-03 20:12:42 +02:00
|
|
|
#define FS_RET_UNSUPPORTED_CMD 0x0400
|
|
|
|
#define FS_RET_NO_ERROR 0x0000
|
2017-04-10 11:04:06 +02:00
|
|
|
#define FS_RET_ALL_ERROR (u32)(-1)
|
2016-08-03 20:12:42 +02:00
|
|
|
|
|
|
|
#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_ {
|
2017-08-13 20:11:23 +02:00
|
|
|
u8 buffer[FS_CLIENT_SIZE];
|
2017-08-27 14:02:16 +02:00
|
|
|
}FSClient;
|
2017-08-13 20:11:23 +02:00
|
|
|
|
2017-08-27 14:02:16 +02:00
|
|
|
typedef struct FSCmdBlock_ {
|
2017-08-13 20:11:23 +02:00
|
|
|
u8 buffer[FS_CMD_BLOCK_SIZE];
|
2017-08-27 14:02:16 +02:00
|
|
|
} FSCmdBlock;
|
2017-08-13 20:11:23 +02:00
|
|
|
|
2016-08-03 20:12:42 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t flag;
|
|
|
|
uint32_t permission;
|
|
|
|
uint32_t owner_id;
|
|
|
|
uint32_t group_id;
|
|
|
|
uint32_t size;
|
|
|
|
uint32_t alloc_size;
|
|
|
|
uint64_t quota_size;
|
|
|
|
uint32_t ent_id;
|
|
|
|
uint64_t ctime;
|
|
|
|
uint64_t mtime;
|
|
|
|
uint8_t attributes[48];
|
|
|
|
} __attribute__((packed)) FSStat;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
FSStat stat;
|
|
|
|
char name[FS_MAX_ENTNAME_SIZE];
|
|
|
|
} FSDirEntry;
|
|
|
|
|
2017-08-27 14:02:16 +02:00
|
|
|
typedef void (*FSAsyncCallback)(FSClient * pClient, FSCmdBlock * pCmd, int result, void *context);
|
2017-05-10 20:52:34 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
FSAsyncCallback userCallback;
|
|
|
|
void *userContext;
|
2017-08-26 01:08:55 +02:00
|
|
|
OSMessageQueue *ioMsgQueue;
|
2017-05-10 20:52:34 +02:00
|
|
|
} FSAsyncParams;
|
|
|
|
|
2017-08-26 01:08:55 +02:00
|
|
|
typedef struct{
|
|
|
|
void* data; // pointer to a FSAsyncResult;
|
|
|
|
u32 unkwn1;
|
|
|
|
u32 unkwn2;
|
|
|
|
u32 unkwn3; // always 0x08
|
|
|
|
} __attribute__((packed)) FSMessage;
|
|
|
|
|
|
|
|
typedef struct FSAsyncResult_{
|
|
|
|
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;
|
2016-08-03 20:12:42 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-04-30 03:34:09 +02:00
|
|
|
#endif /* FS_DEFS_H */
|
2016-08-03 20:12:42 +02:00
|
|
|
|