LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
iosupport.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------
2#ifndef __iosupp_h__
3#define __iosupp_h__
4//---------------------------------------------------------------------------------
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#include <reent.h>
11#include <sys/stat.h>
12#include <sys/statvfs.h>
13
14enum {
18 STD_MAX = 16
19};
20
21
22typedef struct {
23 int device;
25} __handle;
26
27/* Directory iterator for mantaining state between dir* calls */
28typedef struct {
29 int device;
30 void *dirStruct;
31} DIR_ITER;
32
33typedef struct {
34 const char *name;
36 int (*open_r)(struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
37 int (*close_r)(struct _reent *r, int fd);
38 ssize_t (*write_r)(struct _reent *r, int fd, const char *ptr, size_t len);
39 ssize_t (*read_r)(struct _reent *r, int fd, char *ptr, size_t len);
40 off_t (*seek_r)(struct _reent *r, int fd, off_t pos, int dir);
41 int (*fstat_r)(struct _reent *r, int fd, struct stat *st);
42 int (*stat_r)(struct _reent *r, const char *file, struct stat *st);
43 int (*link_r)(struct _reent *r, const char *existing, const char *newLink);
44 int (*unlink_r)(struct _reent *r, const char *name);
45 int (*chdir_r)(struct _reent *r, const char *name);
46 int (*rename_r) (struct _reent *r, const char *oldName, const char *newName);
47 int (*mkdir_r) (struct _reent *r, const char *path, int mode);
48
50
51 DIR_ITER* (*diropen_r)(struct _reent *r, DIR_ITER *dirState, const char *path);
52 int (*dirreset_r)(struct _reent *r, DIR_ITER *dirState);
53 int (*dirnext_r)(struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *filestat);
54 int (*dirclose_r)(struct _reent *r, DIR_ITER *dirState);
55 int (*statvfs_r)(struct _reent *r, const char *path, struct statvfs *buf);
56 int (*ftruncate_r)(struct _reent *r, int fd, off_t len);
57 int (*fsync_r)(struct _reent *r, int fd);
58
60
61 int (*chmod_r)(struct _reent *r, const char *path, mode_t mode);
62 int (*fchmod_r)(struct _reent *r, int fd, mode_t mode);
63
65
66extern const devoptab_t *devoptab_list[];
67
68typedef struct {
69 void *(*sbrk_r) (struct _reent *ptr, ptrdiff_t incr);
70 int (*lock_init) (int *lock,int recursive);
71 int (*lock_close) (int *lock);
72 int (*lock_release) (int *lock);
73 int (*lock_acquire) (int *lock);
74 void (*malloc_lock) (struct _reent *ptr);
75 void (*malloc_unlock) (struct _reent *ptr);
76 void (*exit) ( int rc );
77 int (*gettod_r) (struct _reent *ptr, struct timeval *tp, struct timezone *tz);
79
81
82int AddDevice( const devoptab_t* device);
83int FindDevice(const char* name);
84int RemoveDevice(const char* name);
85void setDefaultDevice( int device );
86const devoptab_t* GetDeviceOpTab (const char *name);
87
88#ifdef __cplusplus
89}
90#endif
91
92//---------------------------------------------------------------------------------
93#endif // __iosupp_h__
94//---------------------------------------------------------------------------------
void lock(unsigned int *lock)
@ STD_IN
Definition: iosupport.h:15
@ STD_MAX
Definition: iosupport.h:18
@ STD_ERR
Definition: iosupport.h:17
@ STD_OUT
Definition: iosupport.h:16
__syscalls_t __syscalls
void setDefaultDevice(int device)
Definition: newlib.c:396
int RemoveDevice(const char *name)
Definition: newlib.c:467
int AddDevice(const devoptab_t *device)
Definition: newlib.c:482
const devoptab_t * devoptab_list[]
Definition: newlib.c:432
int FindDevice(const char *name)
Definition: newlib.c:443
const devoptab_t * GetDeviceOpTab(const char *name)
Definition: newlib.c:506
int dir
Definition: iso9660.c:535
u32 ptr
Definition: iso9660.c:536
int stat(const char *file, struct stat *st)
Definition: newlib.c:643
int device
Definition: iosupport.h:29
void * dirStruct
Definition: iosupport.h:30
int device
Definition: iosupport.h:23
void * fileStruct
Definition: iosupport.h:24
void * deviceData
Definition: iosupport.h:59
int structSize
Definition: iosupport.h:35
int dirStateSize
Definition: iosupport.h:49
const char * name
Definition: iosupport.h:34