Skip to content

Commit 39c21b7

Browse files
committed
Try to use generic functions for NOT_IMPLEMENTED and DUMMY_IMPLEMENTATION
1 parent ed5ead7 commit 39c21b7

File tree

35 files changed

+761
-958
lines changed

35 files changed

+761
-958
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: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ static int cddrv_ioctl(iop_file_t *io, int cmd, void *arg);
2121

2222

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

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

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 & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -419,23 +419,23 @@ static int fio_getstat(iop_file_t *fd, const char *name, io_stat_t *stat)
419419
}
420420

421421
static iop_device_ops_t fio_ops = {
422-
&fio_init,
423-
&fio_deinit,
424-
NOT_SUPPORTED,
425-
&fio_open,
426-
&fio_close,
427-
&fio_read,
428-
&fio_write,
429-
&fio_lseek,
430-
NOT_SUPPORTED,
431-
NOT_SUPPORTED,
432-
NOT_SUPPORTED,
433-
NOT_SUPPORTED,
434-
&fio_openDir,
435-
&fio_closeDir,
436-
&fio_dread,
437-
&fio_getstat,
438-
NOT_SUPPORTED,
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
439439
};
440440

441441
static iop_device_t fio_driver = {

iop/cdvd/xesdrv/src/xesdrv.c

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +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 s64 esdrv_df_null_long();
3231
static int
3332
esioctl2_func_1(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
3433
static int
@@ -220,33 +219,33 @@ struct DevctlCmdTbl_t
220219
};
221220

222221
static iomanX_iop_device_ops_t DvrFuncTbl = {
223-
&esdrv_df_init,
224-
&esdrv_df_exit,
225-
NOT_SUPPORTED,
226-
NOT_SUPPORTED,
227-
NOT_SUPPORTED,
228-
NOT_SUPPORTED,
229-
NOT_SUPPORTED,
230-
NOT_SUPPORTED,
231-
&esdrv_df_ioctl,
232-
NOT_SUPPORTED,
233-
NOT_SUPPORTED,
234-
NOT_SUPPORTED,
235-
NOT_SUPPORTED,
236-
NOT_SUPPORTED,
237-
NOT_SUPPORTED,
238-
NOT_SUPPORTED,
239-
NOT_SUPPORTED,
240-
NOT_SUPPORTED,
241-
NOT_SUPPORTED,
242-
NOT_SUPPORTED,
243-
NOT_SUPPORTED,
244-
NOT_SUPPORTED,
245-
(void *)&esdrv_df_null_long,
246-
&esdrv_df_devctl,
247-
NOT_SUPPORTED,
248-
NOT_SUPPORTED,
249-
&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
250249
};
251250
static iomanX_iop_device_t ESDRV = {
252251
.name = "es_drv",
@@ -371,11 +370,6 @@ esdrv_df_ioctl2(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, v
371370
return -EINVAL;
372371
}
373372

374-
static s64 esdrv_df_null_long()
375-
{
376-
return -EUNSUP;
377-
}
378-
379373
static void EsAcsSetAaryptorIoMode(void)
380374
{
381375
es_regs->r_es0C = 0;

iop/debug/iop_sbusdbg/src/sbus_tty.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,23 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
9494

9595
static iop_device_ops_t fsd_ops =
9696
{
97-
&ttyfs_init,
98-
&ttyfs_deinit,
99-
NOT_SUPPORTED,
100-
&ttyfs_open,
101-
&ttyfs_close,
102-
NOT_SUPPORTED,
103-
&ttyfs_write,
104-
NOT_SUPPORTED,
105-
NOT_SUPPORTED,
106-
NOT_SUPPORTED,
107-
NOT_SUPPORTED,
108-
NOT_SUPPORTED,
109-
&ttyfs_dopen,
110-
&ttyfs_close,
111-
NOT_SUPPORTED,
112-
NOT_SUPPORTED,
113-
NOT_SUPPORTED,
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
114114
};
115115

116116
static iop_device_t tty_fsd =

iop/debug/ppctty/src/tty.c

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,6 @@ static int ttyfs_deinit()
4444
return 0;
4545
}
4646

47-
static int ttyfs_open(iop_file_t *file, const char *name, int flags)
48-
{
49-
(void)file;
50-
(void)name;
51-
(void)flags;
52-
53-
DPRINTF("FS Open()\n");
54-
return 0;
55-
}
56-
57-
static int ttyfs_dopen(iop_file_t *file, const char *name)
58-
{
59-
(void)file;
60-
(void)name;
61-
62-
DPRINTF("FS Dopen()\n");
63-
return 0;
64-
}
65-
66-
static int ttyfs_close(iop_file_t *file)
67-
{
68-
(void)file;
69-
70-
DPRINTF("FS Close()\n");
71-
return(0);
72-
}
73-
7447
static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
7548
char temp[65];
7649
int bCount = 0;
@@ -101,23 +74,23 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
10174

10275
static iop_device_ops_t fsd_ops =
10376
{
104-
&ttyfs_init,
105-
&ttyfs_deinit,
106-
NOT_SUPPORTED,
107-
&ttyfs_open,
108-
&ttyfs_close,
109-
NOT_SUPPORTED,
110-
&ttyfs_write,
111-
NOT_SUPPORTED,
112-
NOT_SUPPORTED,
113-
NOT_SUPPORTED,
114-
NOT_SUPPORTED,
115-
NOT_SUPPORTED,
116-
&ttyfs_dopen,
117-
&ttyfs_close,
118-
NOT_SUPPORTED,
119-
NOT_SUPPORTED,
120-
NOT_SUPPORTED,
77+
&ttyfs_init, // init
78+
&ttyfs_deinit, // deinit
79+
NOT_SUPPORTED, // format
80+
NOT_SUPPORTED, // open
81+
NOT_SUPPORTED, // close
82+
NOT_SUPPORTED, // read
83+
&ttyfs_write, // write
84+
NOT_SUPPORTED, // lseek
85+
NOT_SUPPORTED, // ioctl
86+
NOT_SUPPORTED, // remove
87+
NOT_SUPPORTED, // mkdir
88+
NOT_SUPPORTED, // rmdir
89+
NOT_SUPPORTED, // dopen
90+
NOT_SUPPORTED, // dclose
91+
NOT_SUPPORTED, // dread
92+
NOT_SUPPORTED, // getstat
93+
NOT_SUPPORTED, // chstat
12194
};
12295

12396
static iop_device_t tty_fsd =

0 commit comments

Comments
 (0)