Skip to content

Commit

Permalink
Try to use generic functions for NOT_IMPLEMENTED and DUMMY_IMPLEMENTA…
Browse files Browse the repository at this point in the history
…TION
  • Loading branch information
fjtrujy committed Nov 13, 2024
1 parent 57aab50 commit 5ebdaf8
Show file tree
Hide file tree
Showing 35 changed files with 761 additions and 958 deletions.
22 changes: 8 additions & 14 deletions ee/iopreboot/src/imgdrv/src/imgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
IRX_ID(MODNAME, 1, 1);

// Function prototypes
static int imgdrv_dummy(void);
static int imgdrv_read(iop_file_t *f, void *buf, int size);
static int imgdrv_lseek(iop_file_t *f, int offset, int whence);

Expand All @@ -41,14 +40,14 @@ typedef struct _iop_device_ops_short
} iop_device_ops_short_t;

static iop_device_ops_short_t imgdrv_ops = {
(void *)&imgdrv_dummy, // init
(void *)&imgdrv_dummy, // deinit
NULL, // format
(void *)&imgdrv_dummy, // open
(void *)&imgdrv_dummy, // close
&imgdrv_read, // read
NULL, // write
&imgdrv_lseek, // lseek
DUMMY_IMPLEMENTATION, // init
DUMMY_IMPLEMENTATION, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
&imgdrv_read, // read
NOT_SUPPORTED, // write
&imgdrv_lseek, // lseek
};

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

static int imgdrv_dummy(void)
{
return 0;
}

static int imgdrv_read(iop_file_t *f, void *buf, int size)
{
int i;
Expand Down
34 changes: 17 additions & 17 deletions iop/arcade/accdvd/src/cddrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ static int cddrv_ioctl(iop_file_t *io, int cmd, void *arg);


static iop_device_ops_t Cddrv_ops = {
&cddrv_adddrv,
&cddrv_deldrv,
NOT_SUPPORTED,
&cddrv_open,
&cddrv_close,
&cddrv_read,
&cddrv_write,
&cddrv_lseek,
&cddrv_ioctl,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED
&cddrv_adddrv, // init
&cddrv_deldrv, // deinit
NOT_SUPPORTED, // format
&cddrv_open, // open
&cddrv_close, // close
&cddrv_read, // read
&cddrv_write, // write
&cddrv_lseek, // lseek
&cddrv_ioctl, // ioctl
NOT_SUPPORTED, // remove
NOT_SUPPORTED, // mkdir
NOT_SUPPORTED, // rmdir
NOT_SUPPORTED, // dopen
NOT_SUPPORTED, // dclose
NOT_SUPPORTED, // dread
NOT_SUPPORTED, // getstat
NOT_SUPPORTED, // chstat
};

static iop_device_t Cddrv = {"cdrom", 16u, 0u, "ATAPI_C/DVD-ROM", &Cddrv_ops};
Expand Down
36 changes: 17 additions & 19 deletions iop/arcade/acuart/src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
int acUartWrite(void *buf, int count);
int acUartRead(void *buf, int count);

int dummy() {return -ENOTSUP;}

static int acuart_read(iop_file_t *f, void *buffer, int size) {
(void)f;
return acUartRead(buffer, size);
Expand All @@ -17,23 +15,23 @@ static int acuart_write(iop_file_t *f, void *buffer, int size) {
}

static iop_device_ops_t uart_ops = {
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
&acuart_read,
&acuart_write,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
(void *)&dummy,
DUMMY_IMPLEMENTATION, // init
DUMMY_IMPLEMENTATION, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
&acuart_read, // read
&acuart_write, // write
NOT_SUPPORTED, // lseek
NOT_SUPPORTED, // ioctl
NOT_SUPPORTED, // remove
NOT_SUPPORTED, // mkdir
NOT_SUPPORTED, // rmdir
NOT_SUPPORTED, // dopen
NOT_SUPPORTED, // dclose
NOT_SUPPORTED, // dread
NOT_SUPPORTED, // getstat
NOT_SUPPORTED, // chstat
};

#define DEVNAME "tty"
Expand Down
34 changes: 17 additions & 17 deletions iop/cdvd/cdfs/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,23 +419,23 @@ static int fio_getstat(iop_file_t *fd, const char *name, io_stat_t *stat)
}

static iop_device_ops_t fio_ops = {
&fio_init,
&fio_deinit,
NOT_SUPPORTED,
&fio_open,
&fio_close,
&fio_read,
&fio_write,
&fio_lseek,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
&fio_openDir,
&fio_closeDir,
&fio_dread,
&fio_getstat,
NOT_SUPPORTED,
&fio_init, // init
&fio_deinit, // deinit
NOT_SUPPORTED, // format
&fio_open, // open
&fio_close, // close
&fio_read, // read
&fio_write, // write
&fio_lseek, // lseek
NOT_SUPPORTED, // ioctl
NOT_SUPPORTED, // remove
NOT_SUPPORTED, // mkdir
NOT_SUPPORTED, // rmdir
&fio_openDir, // dopen
&fio_closeDir, // dclose
&fio_dread, // dread
&fio_getstat, // getstat
NOT_SUPPORTED, // chstat
};

static iop_device_t fio_driver = {
Expand Down
60 changes: 27 additions & 33 deletions iop/cdvd/xesdrv/src/xesdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ static int esdrv_df_devctl(
iomanX_iop_file_t *f, const char *name, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
static int
esdrv_df_ioctl2(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
static s64 esdrv_df_null_long();
static int
esioctl2_func_1(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, void *buf, unsigned int buflen);
static int
Expand Down Expand Up @@ -220,33 +219,33 @@ struct DevctlCmdTbl_t
};

static iomanX_iop_device_ops_t DvrFuncTbl = {
&esdrv_df_init,
&esdrv_df_exit,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
&esdrv_df_ioctl,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
(void *)&esdrv_df_null_long,
&esdrv_df_devctl,
NOT_SUPPORTED,
NOT_SUPPORTED,
&esdrv_df_ioctl2,
&esdrv_df_init, // init
&esdrv_df_exit, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
NOT_SUPPORTED, // read
NOT_SUPPORTED, // write
NOT_SUPPORTED, // lseek
&esdrv_df_ioctl, // ioctl
NOT_SUPPORTED, // remove
NOT_SUPPORTED, // mkdir
NOT_SUPPORTED, // rmdir
NOT_SUPPORTED, // dopen
NOT_SUPPORTED, // dclose
NOT_SUPPORTED, // dread
NOT_SUPPORTED, // getstat
NOT_SUPPORTED, // chstat
NOT_SUPPORTED, // rename
NOT_SUPPORTED, // chdir
NOT_SUPPORTED, // sync
NOT_SUPPORTED, // mount
NOT_SUPPORTED, // umount
NOT_SUPPORTED_S64, // lseek64
&esdrv_df_devctl, // devctl
NOT_SUPPORTED, // symlink
NOT_SUPPORTED, // readlink
&esdrv_df_ioctl2, // ioctl2
};
static iomanX_iop_device_t ESDRV = {
.name = "es_drv",
Expand Down Expand Up @@ -371,11 +370,6 @@ esdrv_df_ioctl2(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, v
return -EINVAL;
}

static s64 esdrv_df_null_long()
{
return -EUNSUP;
}

static void EsAcsSetAaryptorIoMode(void)
{
es_regs->r_es0C = 0;
Expand Down
34 changes: 17 additions & 17 deletions iop/debug/iop_sbusdbg/src/sbus_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {

static iop_device_ops_t fsd_ops =
{
&ttyfs_init,
&ttyfs_deinit,
NOT_SUPPORTED,
&ttyfs_open,
&ttyfs_close,
NOT_SUPPORTED,
&ttyfs_write,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
&ttyfs_dopen,
&ttyfs_close,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
&ttyfs_init, // init
&ttyfs_deinit, // deinit
NOT_SUPPORTED, // format
&ttyfs_open, // open
&ttyfs_close, // close
NOT_SUPPORTED, // read
&ttyfs_write, // write
NOT_SUPPORTED, // lseek
NOT_SUPPORTED, // ioctl
NOT_SUPPORTED, // remove
NOT_SUPPORTED, // mkdir
NOT_SUPPORTED, // rmdir
&ttyfs_dopen, // dopen
&ttyfs_close, // dclose
NOT_SUPPORTED, // dread
NOT_SUPPORTED, // getstat
NOT_SUPPORTED, // chstat
};

static iop_device_t tty_fsd =
Expand Down
61 changes: 17 additions & 44 deletions iop/debug/ppctty/src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,6 @@ static int ttyfs_deinit()
return 0;
}

static int ttyfs_open(iop_file_t *file, const char *name, int flags)
{
(void)file;
(void)name;
(void)flags;

DPRINTF("FS Open()\n");
return 0;
}

static int ttyfs_dopen(iop_file_t *file, const char *name)
{
(void)file;
(void)name;

DPRINTF("FS Dopen()\n");
return 0;
}

static int ttyfs_close(iop_file_t *file)
{
(void)file;

DPRINTF("FS Close()\n");
return(0);
}

static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
char temp[65];
int bCount = 0;
Expand Down Expand Up @@ -101,23 +74,23 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {

static iop_device_ops_t fsd_ops =
{
&ttyfs_init,
&ttyfs_deinit,
NOT_SUPPORTED,
&ttyfs_open,
&ttyfs_close,
NOT_SUPPORTED,
&ttyfs_write,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
&ttyfs_dopen,
&ttyfs_close,
NOT_SUPPORTED,
NOT_SUPPORTED,
NOT_SUPPORTED,
&ttyfs_init, // init
&ttyfs_deinit, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED // close
NOT_SUPPORTED, // read
&ttyfs_write, // write
NOT_SUPPORTED, // lseek
NOT_SUPPORTED, // ioctl
NOT_SUPPORTED, // remove
NOT_SUPPORTED, // mkdir
NOT_SUPPORTED, // rmdir
NOT_SUPPORTED, // dopen
NOT_SUPPORTED, // dclose
NOT_SUPPORTED, // dread
NOT_SUPPORTED, // getstat
NOT_SUPPORTED, // chstat
};

static iop_device_t tty_fsd =
Expand Down
Loading

0 comments on commit 5ebdaf8

Please sign in to comment.