Skip to content

Commit 71b1127

Browse files
committed
Try to use generic functions for NOT_IMPLEMENTED and DUMMY_IMPLEMENTATION
1 parent 400d8fc commit 71b1127

File tree

38 files changed

+776
-1078
lines changed

38 files changed

+776
-1078
lines changed

ee/iopreboot/src/imgdrv/src/imgdrv.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
IRX_ID(MODNAME, 1, 1);
2323

2424
// Function prototypes
25-
static int imgdrv_dummy(void);
2625
static int imgdrv_read(iop_file_t *f, void *buf, int size);
2726
static int imgdrv_lseek(iop_file_t *f, int offset, int whence);
2827

@@ -41,14 +40,14 @@ typedef struct _iop_device_ops_short
4140
} iop_device_ops_short_t;
4241

4342
static iop_device_ops_short_t imgdrv_ops = {
44-
(void *)&imgdrv_dummy, // init
45-
(void *)&imgdrv_dummy, // deinit
46-
NULL, // format
47-
(void *)&imgdrv_dummy, // open
48-
(void *)&imgdrv_dummy, // close
49-
&imgdrv_read, // read
50-
NULL, // write
51-
&imgdrv_lseek, // lseek
43+
DUMMY_IMPLEMENTATION, // init
44+
DUMMY_IMPLEMENTATION, // deinit
45+
NOT_SUPPORTED, // format
46+
NOT_SUPPORTED, // open
47+
NOT_SUPPORTED, // close
48+
&imgdrv_read, // read
49+
NOT_SUPPORTED, // write
50+
&imgdrv_lseek, // lseek
5251
};
5352

5453
#define MAX_IMAGES 2
@@ -69,11 +68,6 @@ int _start(int argc, char *argv[])
6968
return (AddDrv(&img_device) < 0) ? MODULE_NO_RESIDENT_END : MODULE_RESIDENT_END;
7069
}
7170

72-
static int imgdrv_dummy(void)
73-
{
74-
return 0;
75-
}
76-
7771
static int imgdrv_read(iop_file_t *f, void *buf, int size)
7872
{
7973
int i;

iop/arcade/accdvd/src/cddrv.c

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ static int cddrv_read(iop_file_t *io, void *buf, int cnt);
1818
static int cddrv_write(iop_file_t *io, void *buf, int cnt);
1919
static int cddrv_lseek(iop_file_t *io, int offset, int whence);
2020
static int cddrv_ioctl(iop_file_t *io, int cmd, void *arg);
21-
static int cddrv_dummy();
2221

2322
static iop_device_ops_t Cddrv_ops = {
24-
&cddrv_adddrv,
25-
&cddrv_deldrv,
26-
&cddrv_dummy,
27-
&cddrv_open,
28-
&cddrv_close,
29-
&cddrv_read,
30-
&cddrv_write,
31-
&cddrv_lseek,
32-
&cddrv_ioctl,
33-
&cddrv_dummy,
34-
&cddrv_dummy,
35-
&cddrv_dummy,
36-
&cddrv_dummy,
37-
&cddrv_dummy,
38-
&cddrv_dummy,
39-
&cddrv_dummy,
40-
&cddrv_dummy};
23+
&cddrv_adddrv, // init
24+
&cddrv_deldrv, // deinit
25+
NOT_SUPPORTED, // format
26+
&cddrv_open, // open
27+
&cddrv_close, // close
28+
&cddrv_read, // read
29+
&cddrv_write, // write
30+
&cddrv_lseek, // lseek
31+
&cddrv_ioctl, // ioctl
32+
NOT_SUPPORTED, // remove
33+
NOT_SUPPORTED, // mkdir
34+
NOT_SUPPORTED, // rmdir
35+
NOT_SUPPORTED, // dopen
36+
NOT_SUPPORTED, // dclose
37+
NOT_SUPPORTED, // dread
38+
NOT_SUPPORTED, // getstat
39+
NOT_SUPPORTED, // chstat
40+
};
4141

4242
static iop_device_t Cddrv = {"cdrom", 16u, 0u, "ATAPI_C/DVD-ROM", &Cddrv_ops};
4343

@@ -158,11 +158,6 @@ static int cddrv_ioctl(iop_file_t *io, int cmd, void *arg)
158158
return -EINVAL;
159159
}
160160

161-
static int cddrv_dummy()
162-
{
163-
return -EINVAL;
164-
}
165-
166161
int cddrv_module_start(int argc, char **argv)
167162
{
168163
int v2;

iop/arcade/acuart/src/tty.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
int acUartWrite(void *buf, int count);
66
int acUartRead(void *buf, int count);
77

8-
int dummy() {return -ENOTSUP;}
9-
108
static int acuart_read(iop_file_t *f, void *buffer, int size) {
119
(void)f;
1210
return acUartRead(buffer, size);
@@ -17,23 +15,23 @@ static int acuart_write(iop_file_t *f, void *buffer, int size) {
1715
}
1816

1917
static iop_device_ops_t uart_ops = {
20-
(void *)&dummy,
21-
(void *)&dummy,
22-
(void *)&dummy,
23-
(void *)&dummy,
24-
(void *)&dummy,
25-
&acuart_read,
26-
&acuart_write,
27-
(void *)&dummy,
28-
(void *)&dummy,
29-
(void *)&dummy,
30-
(void *)&dummy,
31-
(void *)&dummy,
32-
(void *)&dummy,
33-
(void *)&dummy,
34-
(void *)&dummy,
35-
(void *)&dummy,
36-
(void *)&dummy,
18+
DUMMY_IMPLEMENTATION, // init
19+
DUMMY_IMPLEMENTATION, // deinit
20+
NOT_SUPPORTED, // format
21+
NOT_SUPPORTED, // open
22+
NOT_SUPPORTED, // close
23+
&acuart_read, // read
24+
&acuart_write, // write
25+
NOT_SUPPORTED, // lseek
26+
NOT_SUPPORTED, // ioctl
27+
NOT_SUPPORTED, // remove
28+
NOT_SUPPORTED, // mkdir
29+
NOT_SUPPORTED, // rmdir
30+
NOT_SUPPORTED, // dopen
31+
NOT_SUPPORTED, // dclose
32+
NOT_SUPPORTED, // dread
33+
NOT_SUPPORTED, // getstat
34+
NOT_SUPPORTED, // chstat
3735
};
3836

3937
#define DEVNAME "tty"

iop/cdvd/cdfs/src/main.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -418,29 +418,24 @@ static int fio_getstat(iop_file_t *fd, const char *name, io_stat_t *stat)
418418
return ret;
419419
}
420420

421-
static int cdfs_dummy() {
422-
DPRINTF("CDFS: dummy function called\n\n");
423-
return -EIO;
424-
}
425-
426421
static iop_device_ops_t fio_ops = {
427-
&fio_init,
428-
&fio_deinit,
429-
(void *)&cdfs_dummy,
430-
&fio_open,
431-
&fio_close,
432-
&fio_read,
433-
&fio_write,
434-
&fio_lseek,
435-
(void *)&cdfs_dummy,
436-
(void *)&cdfs_dummy,
437-
(void *)&cdfs_dummy,
438-
(void *)&cdfs_dummy,
439-
&fio_openDir,
440-
&fio_closeDir,
441-
&fio_dread,
442-
&fio_getstat,
443-
(void *)&cdfs_dummy,
422+
&fio_init, // init
423+
&fio_deinit, // deinit
424+
NOT_SUPPORTED, // format
425+
&fio_open, // open
426+
&fio_close, // close
427+
&fio_read, // read
428+
&fio_write, // write
429+
&fio_lseek, // lseek
430+
NOT_SUPPORTED, // ioctl
431+
NOT_SUPPORTED, // remove
432+
NOT_SUPPORTED, // mkdir
433+
NOT_SUPPORTED, // rmdir
434+
&fio_openDir, // dopen
435+
&fio_closeDir, // dclose
436+
&fio_dread, // dread
437+
&fio_getstat, // getstat
438+
NOT_SUPPORTED, // chstat
444439
};
445440

446441
static iop_device_t fio_driver = {

iop/cdvd/xesdrv/src/xesdrv.c

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ static int esdrv_df_devctl(
2828
iomanX_iop_file_t *f, const char *name, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
2929
static int
3030
esdrv_df_ioctl2(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
31-
static int esdrv_df_null();
32-
static s64 esdrv_df_null_long();
3331
static int
3432
esioctl2_func_1(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
3533
static int
@@ -221,33 +219,33 @@ struct DevctlCmdTbl_t
221219
};
222220

223221
static iomanX_iop_device_ops_t DvrFuncTbl = {
224-
&esdrv_df_init,
225-
&esdrv_df_exit,
226-
(void *)&esdrv_df_null,
227-
(void *)&esdrv_df_null,
228-
(void *)&esdrv_df_null,
229-
(void *)&esdrv_df_null,
230-
(void *)&esdrv_df_null,
231-
(void *)&esdrv_df_null,
232-
&esdrv_df_ioctl,
233-
(void *)&esdrv_df_null,
234-
(void *)&esdrv_df_null,
235-
(void *)&esdrv_df_null,
236-
(void *)&esdrv_df_null,
237-
(void *)&esdrv_df_null,
238-
(void *)&esdrv_df_null,
239-
(void *)&esdrv_df_null,
240-
(void *)&esdrv_df_null,
241-
(void *)&esdrv_df_null,
242-
(void *)&esdrv_df_null,
243-
(void *)&esdrv_df_null,
244-
(void *)&esdrv_df_null,
245-
(void *)&esdrv_df_null,
246-
(void *)&esdrv_df_null_long,
247-
&esdrv_df_devctl,
248-
(void *)&esdrv_df_null,
249-
(void *)&esdrv_df_null,
250-
&esdrv_df_ioctl2,
222+
&esdrv_df_init, // init
223+
&esdrv_df_exit, // deinit
224+
NOT_SUPPORTED, // format
225+
NOT_SUPPORTED, // open
226+
NOT_SUPPORTED, // close
227+
NOT_SUPPORTED, // read
228+
NOT_SUPPORTED, // write
229+
NOT_SUPPORTED, // lseek
230+
&esdrv_df_ioctl, // ioctl
231+
NOT_SUPPORTED, // remove
232+
NOT_SUPPORTED, // mkdir
233+
NOT_SUPPORTED, // rmdir
234+
NOT_SUPPORTED, // dopen
235+
NOT_SUPPORTED, // dclose
236+
NOT_SUPPORTED, // dread
237+
NOT_SUPPORTED, // getstat
238+
NOT_SUPPORTED, // chstat
239+
NOT_SUPPORTED, // rename
240+
NOT_SUPPORTED, // chdir
241+
NOT_SUPPORTED, // sync
242+
NOT_SUPPORTED, // mount
243+
NOT_SUPPORTED, // umount
244+
NOT_SUPPORTED_S64, // lseek64
245+
&esdrv_df_devctl, // devctl
246+
NOT_SUPPORTED, // symlink
247+
NOT_SUPPORTED, // readlink
248+
&esdrv_df_ioctl2, // ioctl2
251249
};
252250
static iomanX_iop_device_t ESDRV = {
253251
.name = "es_drv",
@@ -372,16 +370,6 @@ esdrv_df_ioctl2(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, v
372370
return -EINVAL;
373371
}
374372

375-
static int esdrv_df_null()
376-
{
377-
return -EUNSUP;
378-
}
379-
380-
static s64 esdrv_df_null_long()
381-
{
382-
return -EUNSUP;
383-
}
384-
385373
static void EsAcsSetAaryptorIoMode(void)
386374
{
387375
es_regs->r_es0C = 0;

iop/debug/iop_sbusdbg/src/sbus_tty.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ Of course this requires that the EE-side code accept this command and output the
2727

2828
extern void sbus_tty_puts(const char *str);
2929

30-
static int ttyfs_error() { return -EPERM; }
31-
3230
static int ttyfs_init()
3331
{
3432
//DBG_puts("SIOTTY: FS Init()\n");
@@ -96,23 +94,23 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
9694

9795
static iop_device_ops_t fsd_ops =
9896
{
99-
&ttyfs_init,
100-
&ttyfs_deinit,
101-
(void *)&ttyfs_error,
102-
&ttyfs_open,
103-
&ttyfs_close,
104-
(void *)&ttyfs_error,
105-
&ttyfs_write,
106-
(void *)&ttyfs_error,
107-
(void *)&ttyfs_error,
108-
(void *)&ttyfs_error,
109-
(void *)&ttyfs_error,
110-
(void *)&ttyfs_error,
111-
&ttyfs_dopen,
112-
&ttyfs_close,
113-
(void *)&ttyfs_error,
114-
(void *)&ttyfs_error,
115-
(void *)&ttyfs_error,
97+
&ttyfs_init, // init
98+
&ttyfs_deinit, // deinit
99+
NOT_SUPPORTED, // format
100+
&ttyfs_open, // open
101+
&ttyfs_close, // close
102+
NOT_SUPPORTED, // read
103+
&ttyfs_write, // write
104+
NOT_SUPPORTED, // lseek
105+
NOT_SUPPORTED, // ioctl
106+
NOT_SUPPORTED, // remove
107+
NOT_SUPPORTED, // mkdir
108+
NOT_SUPPORTED, // rmdir
109+
&ttyfs_dopen, // dopen
110+
&ttyfs_close, // dclose
111+
NOT_SUPPORTED, // dread
112+
NOT_SUPPORTED, // getstat
113+
NOT_SUPPORTED, // chstat
116114
};
117115

118116
static iop_device_t tty_fsd =

0 commit comments

Comments
 (0)