PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ioman.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# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16#ifndef __IOMAN_H__
17#define __IOMAN_H__
18
19#include <types.h>
20#include <irx.h>
21#include <io_common.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27int open(const char *name, int mode);
28int close(int fd);
29int read(int fd, void *ptr, size_t size);
30int write(int fd, void *ptr, size_t size);
31int lseek(int fd, int pos, int mode);
32int ioctl(int fd, int command, void *arg);
33int remove(const char *name);
34int mkdir(const char *path);
35int rmdir(const char *path);
36int dopen(const char *path, int mode);
37int dclose(int fd);
38int dread(int fd, io_dirent_t *buf);
39int getstat(const char *name, io_stat_t *stat);
40int chstat(const char *name, io_stat_t *stat, unsigned int statmask);
41int format(const char *dev);
42
43/* Device drivers. */
44
45/* Device types. */
46#define IOP_DT_CHAR 0x01
47#define IOP_DT_CONS 0x02
48#define IOP_DT_BLOCK 0x04
49#define IOP_DT_RAW 0x08
50#define IOP_DT_FS 0x10
51
53typedef struct _iop_file {
55 int mode;
57 int unit;
61 void *privdata;
63
64typedef struct _iop_device {
65 const char *name;
66 unsigned int type;
68 unsigned int version;
69 const char *desc;
70 struct _iop_device_ops *ops;
72
73typedef struct _iop_device_ops {
74 int (*init)(iop_device_t *);
75 int (*deinit)(iop_device_t *);
76 int (*format)(iop_file_t *);
77 int (*open)(iop_file_t *, const char *, int);
78 int (*close)(iop_file_t *);
79 int (*read)(iop_file_t *, void *, int);
80 int (*write)(iop_file_t *, void *, int);
81 int (*lseek)(iop_file_t *, int, int);
82 int (*ioctl)(iop_file_t *, int, void *);
83 int (*remove)(iop_file_t *, const char *);
84 int (*mkdir)(iop_file_t *, const char *);
85 int (*rmdir)(iop_file_t *, const char *);
86 int (*dopen)(iop_file_t *, const char *);
87 int (*dclose)(iop_file_t *);
88 int (*dread)(iop_file_t *, io_dirent_t *);
89 int (*getstat)(iop_file_t *, const char *, io_stat_t *);
90 int (*chstat)(iop_file_t *, const char *, io_stat_t *, unsigned int);
92
93int AddDrv(iop_device_t *device);
94int DelDrv(const char *name);
95
96#define ioman_IMPORTS_start DECLARE_IMPORT_TABLE(ioman, 1, 1)
97#define ioman_IMPORTS_end END_IMPORT_TABLE
98
99#define I_open DECLARE_IMPORT(4, open)
100#define I_close DECLARE_IMPORT(5, close)
101#define I_read DECLARE_IMPORT(6, read)
102#define I_write DECLARE_IMPORT(7, write)
103#define I_lseek DECLARE_IMPORT(8, lseek)
104#define I_ioctl DECLARE_IMPORT(9, ioctl)
105#define I_remove DECLARE_IMPORT(10, remove)
106#define I_mkdir DECLARE_IMPORT(11, mkdir)
107#define I_rmdir DECLARE_IMPORT(12, rmdir)
108#define I_dopen DECLARE_IMPORT(13, dopen)
109#define I_dclose DECLARE_IMPORT(14, dclose)
110#define I_dread DECLARE_IMPORT(15, dread)
111#define I_getstat DECLARE_IMPORT(16, getstat)
112#define I_chstat DECLARE_IMPORT(17, chstat)
113#define I_format DECLARE_IMPORT(18, format)
114#define I_AddDrv DECLARE_IMPORT(20, AddDrv);
115#define I_DelDrv DECLARE_IMPORT(21, DelDrv);
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif /* __IOMAN_H__ */
unsigned int version
Definition ioman.h:68
struct _iop_device * device
Definition ioman.h:59
void * privdata
Definition ioman.h:61
int unit
Definition ioman.h:57
int mode
Definition ioman.h:55
struct _iop_file iop_file_t