psl1ght
A free SDK for Sony's PS3 console
sysfs.h
1 #ifndef __LV2_SYSFS_H__
2 #define __LV2_SYSFS_H__
3 
4 #include <time.h>
5 #include <unistd.h>
6 #include <ppu-types.h>
7 
8 // Open Flags
9 #define SYS_O_RDONLY 000000
10 #define SYS_O_WRONLY 000001
11 #define SYS_O_RDWR 000002
12 #define SYS_O_ACCMODE 000003
13 #define SYS_O_CREAT 000100
14 #define SYS_O_EXCL 000200
15 #define SYS_O_TRUNC 001000
16 #define SYS_O_APPEND 002000
17 #define SYS_O_MSELF 010000
18 
19 #define SYS_FS_IO_BUFFER_PAGE_SIZE_64KB 2
20 #define SYS_FS_IO_BUFFER_PAGE_SIZE_1MB 4
21 
22 #ifdef __cplusplus
23  extern "C" {
24 #endif
25 
26 typedef struct _sys_fs_stat
27 {
28  s32 st_mode;
29  s32 st_uid;
30  s32 st_gid;
31  time_t st_atime;
32  time_t st_mtime;
33  time_t st_ctime;
34  u64 st_size;
35  u64 st_blksize;
36 } __attribute__((packed)) sysFSStat;
37 
38 typedef struct _sys_fs_dirent
39 {
40  u8 d_type;
41  u8 d_namlen;
42  char d_name[MAXPATHLEN + 1];
43 } sysFSDirent;
44 
45 typedef struct _sys_fs_utime
46 {
47  time_t actime;
48  time_t modtime;
49 } sysFSUtimbuf;
50 
51 typedef struct _sys_fs_aio
52 {
53  s32 fd;
54  u64 offset;
55  u32 buffer_addr;
56  u64 size;
57  u64 usrdata;
58 } sysFSAio;
59 
60 typedef void (*sysFsAioCallback)(sysFSAio *aio,s32 error,s32 xid,u64 size);
61 
62 s32 sysFsOpen(const char *path,s32 oflags,s32 *fd,const void *arg,u64 argsize);
63 s32 sysFsClose(s32 fd);
64 s32 sysFsRead(s32 fd,void *ptr,u64 len,u64 *read);
65 s32 sysFsWrite(s32 fd, const void* ptr, u64 size, u64* written);
66 s32 sysFsLseek(s32 fd, s64 offset, s32 whence, u64* position);
67 s32 sysFsStat(const char* path, sysFSStat* stat);
68 s32 sysFsFstat(s32 fd, sysFSStat* stat);
69 s32 sysFsChmod(const char* path, s32 mode);
70 s32 sysFsMkdir(const char* path, s32 mode);
71 s32 sysFsRmdir(const char *path);
72 s32 sysFsUnlink(const char *path);
73 
74 s32 sysFsOpendir(const char *path, s32 *fd);
75 s32 sysFsClosedir(s32 fd);
76 s32 sysFsReaddir(s32 fd, sysFSDirent* entry, u64* read);
77 
78 s32 sysFsAioInit(const char * path);
79 s32 sysFsAioFinish(const char * path);
80 s32 sysFsAioCancel(s32 id);
81 
82 s32 sysFsAioRead(sysFSAio *aio, s32 *id, sysFsAioCallback cb);
83 s32 sysFsAioWrite(sysFSAio *aio, s32 *id, sysFsAioCallback cb);
84 
85 s32 sysFsGetFreeSize(const char *path, u32 *blockSize, u64 *freeBlocks);
86 
87 s32 sysFsSetIoBuffer(s32 fd, size_t bufferSizeLimit, s32 pageType, sys_mem_container_t container);
88 s32 sysFsSetDefaultContainer(sys_mem_container_t container, size_t totalLimit);
89 s32 sysFsSetIoBufferFromDefaultContainer(s32 fd, size_t bufferSizeLimit, s32 pageType);
90 
91 #ifdef __cplusplus
92  }
93 #endif
94 
95 #endif
Definition: sysfs.h:45
Definition: sysfs.h:38
Definition: sysfs.h:51
Definition: sysfs.h:26