Skip to content

Commit

Permalink
fix: use original error return values for IO stub ops
Browse files Browse the repository at this point in the history
Except init/deinit and NULL pointers where applicable
  • Loading branch information
uyjulian committed Dec 12, 2024
1 parent 8c01ea0 commit d44e012
Show file tree
Hide file tree
Showing 35 changed files with 610 additions and 539 deletions.
14 changes: 8 additions & 6 deletions ee/iopreboot/src/imgdrv/src/imgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ typedef struct _iop_device_ops_short
int (*lseek)(iop_file_t *, int, int);
} iop_device_ops_short_t;

IOMAN_RETURN_VALUE_IMPL(0);

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

Expand Down
20 changes: 11 additions & 9 deletions iop/arcade/accdvd/src/cddrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,26 @@ static int cddrv_write(iop_file_t *io, void *buf, int cnt);
static int cddrv_lseek(iop_file_t *io, int offset, int whence);
static int cddrv_ioctl(iop_file_t *io, int cmd, void *arg);

IOMAN_RETURN_VALUE_IMPL(EINVAL);

static iop_device_ops_t Cddrv_ops = {
&cddrv_adddrv, // init
&cddrv_deldrv, // deinit
NOT_SUPPORTED, // format
IOMAN_RETURN_VALUE(EINVAL), // 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
IOMAN_RETURN_VALUE(EINVAL), // remove
IOMAN_RETURN_VALUE(EINVAL), // mkdir
IOMAN_RETURN_VALUE(EINVAL), // rmdir
IOMAN_RETURN_VALUE(EINVAL), // dopen
IOMAN_RETURN_VALUE(EINVAL), // dclose
IOMAN_RETURN_VALUE(EINVAL), // dread
IOMAN_RETURN_VALUE(EINVAL), // getstat
IOMAN_RETURN_VALUE(EINVAL), // chstat
};

static iop_device_t Cddrv = {"cdrom", 16u, 0u, "ATAPI_C/DVD-ROM", &Cddrv_ops};
Expand Down
33 changes: 18 additions & 15 deletions iop/arcade/acuart/src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,27 @@ static int acuart_write(iop_file_t *f, void *buffer, int size) {
return acUartWrite(buffer, size);
}

IOMAN_RETURN_VALUE_IMPL(0);
IOMAN_RETURN_VALUE_IMPL(ENOTSUP);

static iop_device_ops_t uart_ops = {
DUMMY_IMPLEMENTATION, // init
DUMMY_IMPLEMENTATION, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
IOMAN_RETURN_VALUE(0), // init
IOMAN_RETURN_VALUE(0), // deinit
IOMAN_RETURN_VALUE(ENOTSUP), // format
IOMAN_RETURN_VALUE(ENOTSUP), // open
IOMAN_RETURN_VALUE(ENOTSUP), // 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
IOMAN_RETURN_VALUE(ENOTSUP), // lseek
IOMAN_RETURN_VALUE(ENOTSUP), // ioctl
IOMAN_RETURN_VALUE(ENOTSUP), // remove
IOMAN_RETURN_VALUE(ENOTSUP), // mkdir
IOMAN_RETURN_VALUE(ENOTSUP), // rmdir
IOMAN_RETURN_VALUE(ENOTSUP), // dopen
IOMAN_RETURN_VALUE(ENOTSUP), // dclose
IOMAN_RETURN_VALUE(ENOTSUP), // dread
IOMAN_RETURN_VALUE(ENOTSUP), // getstat
IOMAN_RETURN_VALUE(ENOTSUP), // chstat
};

#define DEVNAME "tty"
Expand Down
14 changes: 8 additions & 6 deletions iop/cdvd/cdfs/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,24 +418,26 @@ static int fio_getstat(iop_file_t *fd, const char *name, io_stat_t *stat)
return ret;
}

IOMAN_RETURN_VALUE_IMPL(EIO);

static iop_device_ops_t fio_ops = {
&fio_init, // init
&fio_deinit, // deinit
NOT_SUPPORTED, // format
IOMAN_RETURN_VALUE(EIO), // 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
IOMAN_RETURN_VALUE(EIO), // ioctl
IOMAN_RETURN_VALUE(EIO), // remove
IOMAN_RETURN_VALUE(EIO), // mkdir
IOMAN_RETURN_VALUE(EIO), // rmdir
&fio_openDir, // dopen
&fio_closeDir, // dclose
&fio_dread, // dread
&fio_getstat, // getstat
NOT_SUPPORTED, // chstat
IOMAN_RETURN_VALUE(EIO), // chstat
};

static iop_device_t fio_driver = {
Expand Down
46 changes: 24 additions & 22 deletions iop/cdvd/xesdrv/src/xesdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,33 +218,35 @@ struct DevctlCmdTbl_t
{0x5473, &esioctl2_func_10},
};

IOMANX_RETURN_VALUE_IMPL(ENOTSUP);

static iomanX_iop_device_ops_t DvrFuncTbl = {
&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
IOMANX_RETURN_VALUE(ENOTSUP), // format
IOMANX_RETURN_VALUE(ENOTSUP), // open
IOMANX_RETURN_VALUE(ENOTSUP), // close
IOMANX_RETURN_VALUE(ENOTSUP), // read
IOMANX_RETURN_VALUE(ENOTSUP), // write
IOMANX_RETURN_VALUE(ENOTSUP), // 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
IOMANX_RETURN_VALUE(ENOTSUP), // remove
IOMANX_RETURN_VALUE(ENOTSUP), // mkdir
IOMANX_RETURN_VALUE(ENOTSUP), // rmdir
IOMANX_RETURN_VALUE(ENOTSUP), // dopen
IOMANX_RETURN_VALUE(ENOTSUP), // dclose
IOMANX_RETURN_VALUE(ENOTSUP), // dread
IOMANX_RETURN_VALUE(ENOTSUP), // getstat
IOMANX_RETURN_VALUE(ENOTSUP), // chstat
IOMANX_RETURN_VALUE(ENOTSUP), // rename
IOMANX_RETURN_VALUE(ENOTSUP), // chdir
IOMANX_RETURN_VALUE(ENOTSUP), // sync
IOMANX_RETURN_VALUE(ENOTSUP), // mount
IOMANX_RETURN_VALUE(ENOTSUP), // umount
IOMANX_RETURN_VALUE_S64(ENOTSUP), // lseek64
&esdrv_df_devctl, // devctl
NOT_SUPPORTED, // symlink
NOT_SUPPORTED, // readlink
IOMANX_RETURN_VALUE(ENOTSUP), // symlink
IOMANX_RETURN_VALUE(ENOTSUP), // readlink
&esdrv_df_ioctl2, // ioctl2
};
static iomanX_iop_device_t ESDRV = {
Expand Down
22 changes: 12 additions & 10 deletions iop/debug/iop_sbusdbg/src/sbus_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,27 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
return(bCount);
}

IOMAN_RETURN_VALUE_IMPL(EPERM);

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

static iop_device_t tty_fsd =
Expand Down
31 changes: 17 additions & 14 deletions iop/debug/ppctty/src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,28 @@ static int ttyfs_write(iop_file_t *file, void *ptr, int size) {
return(bCount);
}

IOMAN_RETURN_VALUE_IMPL(0);
IOMAN_RETURN_VALUE_IMPL(EPERM);

static iop_device_ops_t fsd_ops =
{
&ttyfs_init, // init
&ttyfs_deinit, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
NOT_SUPPORTED, // read
IOMAN_RETURN_VALUE(EPERM), // format
IOMAN_RETURN_VALUE(0), // open
IOMAN_RETURN_VALUE(0), // close
IOMAN_RETURN_VALUE(EPERM), // 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
IOMAN_RETURN_VALUE(EPERM), // lseek
IOMAN_RETURN_VALUE(EPERM), // ioctl
IOMAN_RETURN_VALUE(EPERM), // remove
IOMAN_RETURN_VALUE(EPERM), // mkdir
IOMAN_RETURN_VALUE(EPERM), // rmdir
IOMAN_RETURN_VALUE(0), // dopen
IOMAN_RETURN_VALUE(0), // dclose
IOMAN_RETURN_VALUE(EPERM), // dread
IOMAN_RETURN_VALUE(EPERM), // getstat
IOMAN_RETURN_VALUE(EPERM), // chstat
};

static iop_device_t tty_fsd =
Expand Down
54 changes: 28 additions & 26 deletions iop/dev9/dev9/src/ps2dev9.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,35 +146,37 @@ static int dev9x_devctl(iop_file_t *f, const char *name, int cmd, void *args, un
}
}

IOMANX_RETURN_VALUE_IMPL(0);

static iop_device_ops_t dev9x_ops =
{
DUMMY_IMPLEMENTATION, // init
DUMMY_IMPLEMENTATION, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
NOT_SUPPORTED, // read
NOT_SUPPORTED, // 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
NOT_SUPPORTED, // rename
NOT_SUPPORTED, // chdir
NOT_SUPPORTED, // sync
NOT_SUPPORTED, // mount
NOT_SUPPORTED, // umount
NOT_SUPPORTED_S64, // lseek64
IOMANX_RETURN_VALUE(0), // init
IOMANX_RETURN_VALUE(0), // deinit
IOMANX_RETURN_VALUE(0), // format
IOMANX_RETURN_VALUE(0), // open
IOMANX_RETURN_VALUE(0), // close
IOMANX_RETURN_VALUE(0), // read
IOMANX_RETURN_VALUE(0), // write
IOMANX_RETURN_VALUE(0), // lseek
IOMANX_RETURN_VALUE(0), // ioctl
IOMANX_RETURN_VALUE(0), // remove
IOMANX_RETURN_VALUE(0), // mkdir
IOMANX_RETURN_VALUE(0), // rmdir
IOMANX_RETURN_VALUE(0), // dopen
IOMANX_RETURN_VALUE(0), // dclose
IOMANX_RETURN_VALUE(0), // dread
IOMANX_RETURN_VALUE(0), // getstat
IOMANX_RETURN_VALUE(0), // chstat
IOMANX_RETURN_VALUE(0), // rename
IOMANX_RETURN_VALUE(0), // chdir
IOMANX_RETURN_VALUE(0), // sync
IOMANX_RETURN_VALUE(0), // mount
IOMANX_RETURN_VALUE(0), // umount
IOMANX_RETURN_VALUE_S64(0), // lseek64
&dev9x_devctl, // devctl
NOT_SUPPORTED, // symlink
NOT_SUPPORTED, // readlink
NOT_SUPPORTED, // ioctl2
IOMANX_RETURN_VALUE(0), // symlink
IOMANX_RETURN_VALUE(0), // readlink
IOMANX_RETURN_VALUE(0), // ioctl2
};

static iop_device_t dev9x_device =
Expand Down
46 changes: 24 additions & 22 deletions iop/dvrp/dvr/src/dvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,36 @@ struct DevctlCmdTbl_t
{0x5650, &dvrioctl2_rec_pictclip},
};

IOMANX_RETURN_VALUE_IMPL(EUNSUP);

static iomanX_iop_device_ops_t DvrFuncTbl =
{
&dvr_df_init, // init
&dvr_df_exit, // deinit
NOT_SUPPORTED, // format
NOT_SUPPORTED, // open
NOT_SUPPORTED, // close
NOT_SUPPORTED, // read
NOT_SUPPORTED, // write
NOT_SUPPORTED, // lseek
IOMANX_RETURN_VALUE(EUNSUP), // format
IOMANX_RETURN_VALUE(EUNSUP), // open
IOMANX_RETURN_VALUE(EUNSUP), // close
IOMANX_RETURN_VALUE(EUNSUP), // read
IOMANX_RETURN_VALUE(EUNSUP), // write
IOMANX_RETURN_VALUE(EUNSUP), // lseek
&dvr_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
IOMANX_RETURN_VALUE(EUNSUP), // remove
IOMANX_RETURN_VALUE(EUNSUP), // mkdir
IOMANX_RETURN_VALUE(EUNSUP), // rmdir
IOMANX_RETURN_VALUE(EUNSUP), // dopen
IOMANX_RETURN_VALUE(EUNSUP), // dclose
IOMANX_RETURN_VALUE(EUNSUP), // dread
IOMANX_RETURN_VALUE(EUNSUP), // getstat
IOMANX_RETURN_VALUE(EUNSUP), // chstat
IOMANX_RETURN_VALUE(EUNSUP), // rename
IOMANX_RETURN_VALUE(EUNSUP), // chdir
IOMANX_RETURN_VALUE(EUNSUP), // sync
IOMANX_RETURN_VALUE(EUNSUP), // mount
IOMANX_RETURN_VALUE(EUNSUP), // umount
IOMANX_RETURN_VALUE_S64(EUNSUP), // lseek64
&dvr_df_devctl, // devctl
NOT_SUPPORTED, // symlink
NOT_SUPPORTED, // readlink
IOMANX_RETURN_VALUE(EUNSUP), // symlink
IOMANX_RETURN_VALUE(EUNSUP), // readlink
&dvr_df_ioctl2, // ioctl2
};
char TEVENT_BUF[6144];
Expand Down
Loading

0 comments on commit d44e012

Please sign in to comment.