PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ioman_mod.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7# Copyright (c) 2004 adresd <adresd_ps2dev@yahoo.com>
8# Licenced under Academic Free License version 2.0
9# Review ps2sdk README & LICENSE files for further details.
10*/
11
17#ifndef __IOMAN_MOD_H__
18#define __IOMAN_MOD_H__
19
20#include <types.h>
21#include <irx.h>
22#include <io_common.h>
23#include <iox_stat.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29extern int io_open(const char *name, int mode);
30extern int io_close(int fd);
31extern int io_read(int fd, void *ptr, size_t size);
32extern int io_write(int fd, void *ptr, size_t size);
33extern int io_lseek(int fd, int pos, int mode);
34extern int io_ioctl(int fd, unsigned long arg, void *param);
35extern int io_remove(const char *name);
36extern int io_mkdir(const char *path);
37extern int io_rmdir(const char *path);
38extern int io_dopen(const char *path, int mode);
39extern int io_dclose(int fd);
40extern int io_dread(int fd, io_dirent_t *buf);
41extern int io_getstat(const char *name, io_stat_t *stat);
42extern int io_chstat(const char *name, io_stat_t *stat, unsigned int statmask);
43extern int io_format(const char *dev);
44
45/* Device drivers. */
46
47/* Device types. */
48#define IOP_DT_CHAR 0x01
49#define IOP_DT_CONS 0x02
50#define IOP_DT_BLOCK 0x04
51#define IOP_DT_RAW 0x08
52#define IOP_DT_FS 0x10
53
65
66typedef struct _iop_io_device {
67 const char *name;
68 unsigned int type;
70 unsigned int version;
71 const char *desc;
72 struct _iop_io_device_ops *ops;
74
75#define IOMAN_RETURN_VALUE_IMPL(val) \
76 static inline int my_ioman_retval_##val##_int(void) {return -val;} \
77 static inline signed long long my_ioman_retval_##val##_s64(void) {return -val;}
78#define IOMAN_RETURN_VALUE(val) ((void*)&my_ioman_retval_##val##_int)
79#define IOMAN_RETURN_VALUE_S64(val) ((void*)&my_ioman_retval_##val##_s64)
80
81typedef struct _iop_io_device_ops {
82 int (*io_init)(iop_io_device_t *);
83 int (*io_deinit)(iop_io_device_t *);
84 int (*io_format)(iop_io_file_t *);
85 int (*io_open)(iop_io_file_t *, const char *, int);
86 int (*io_close)(iop_io_file_t *);
87 int (*io_read)(iop_io_file_t *, void *, int);
88 int (*io_write)(iop_io_file_t *, void *, int);
89 int (*io_lseek)(iop_io_file_t *, int, int);
90 int (*io_ioctl)(iop_io_file_t *, unsigned long, void *);
91 int (*io_remove)(iop_io_file_t *, const char *);
92 int (*io_mkdir)(iop_io_file_t *, const char *);
93 int (*io_rmdir)(iop_io_file_t *, const char *);
94 int (*io_dopen)(iop_io_file_t *, const char *);
95 int (*io_dclose)(iop_io_file_t *);
96 int (*io_dread)(iop_io_file_t *, io_dirent_t *);
97 int (*io_getstat)(iop_io_file_t *, const char *, io_stat_t *);
98 int (*io_chstat)(iop_io_file_t *, const char *, io_stat_t *, unsigned int);
100
101extern int io_AddDrv(iop_io_device_t *device);
102extern int io_DelDrv(const char *name);
103
104#define ioman_mod_IMPORTS_start DECLARE_IMPORT_TABLE(ioman, 1, 1)
105#define ioman_mod_IMPORTS_end END_IMPORT_TABLE
106
107#define I_io_open DECLARE_IMPORT(4, io_open)
108#define I_io_close DECLARE_IMPORT(5, io_close)
109#define I_io_read DECLARE_IMPORT(6, io_read)
110#define I_io_write DECLARE_IMPORT(7, io_write)
111#define I_io_lseek DECLARE_IMPORT(8, io_lseek)
112#define I_io_ioctl DECLARE_IMPORT(9, io_ioctl)
113#define I_io_remove DECLARE_IMPORT(10, io_remove)
114#define I_io_mkdir DECLARE_IMPORT(11, io_mkdir)
115#define I_io_rmdir DECLARE_IMPORT(12, io_rmdir)
116#define I_io_dopen DECLARE_IMPORT(13, io_dopen)
117#define I_io_dclose DECLARE_IMPORT(14, io_dclose)
118#define I_io_dread DECLARE_IMPORT(15, io_dread)
119#define I_io_getstat DECLARE_IMPORT(16, io_getstat)
120#define I_io_chstat DECLARE_IMPORT(17, io_chstat)
121#define I_io_format DECLARE_IMPORT(18, io_format)
122#define I_io_AddDrv DECLARE_IMPORT(20, io_AddDrv);
123#define I_io_DelDrv DECLARE_IMPORT(21, io_DelDrv);
124
125#ifdef __cplusplus
126}
127#endif
128
129#endif /* __IOMAN_MOD_H__ */
struct _iop_io_file iop_io_file_t
struct _iop_io_device * device
Definition ioman_mod.h:61
unsigned int version
Definition ioman_mod.h:70
void * privdata
Definition ioman_mod.h:63