Skip to content

Commit

Permalink
Merge pull request #665 from uyjulian/iop_errno_updates
Browse files Browse the repository at this point in the history
Errno updates
  • Loading branch information
fjtrujy authored Oct 8, 2024
2 parents e8ae9b6 + 171e838 commit dbb7fa1
Show file tree
Hide file tree
Showing 22 changed files with 489 additions and 456 deletions.
344 changes: 183 additions & 161 deletions common/include/errno.h

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion common/include/libmc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define __LIBMC_COMMON_H__

#include <tamtypes.h>
#include <errno.h>

typedef struct _sceMcStDateTime
{
Expand Down Expand Up @@ -148,7 +149,9 @@ typedef struct
} mcRpcStat_t;

// in addition to errno
#define EFORMAT 140
#ifndef EFORMAT
#define EFORMAT 47
#endif

// MCMAN basic error codes
#define sceMcResSucceed 0
Expand Down
1 change: 1 addition & 0 deletions iop/arcade/accdvd/src/accdvd_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define _ACCDVD_INTERNAL_H

#include <accdvd.h>
#include <errno.h>
#include <irx_imports.h>

typedef acUint32 acd_lsn_t;
Expand Down
14 changes: 7 additions & 7 deletions iop/arcade/accdvd/src/cddrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ static int cddrv_open(iop_file_t *io, const char *name, int flg)

if ( io->unit )
{
return -6;
return -ENXIO;
}
if ( flg != 1 )
{
return -22;
return -EINVAL;
}
ret_v2 = cdfs_lookup(&dirent, name, strlen(name));
if ( ret_v2 >= 0 )
Expand All @@ -85,13 +85,13 @@ static int cddrv_open(iop_file_t *io, const char *name, int flg)
}
if ( (dirent.d_ftype & 2) != 0 )
{
return -21;
return -EISDIR;
}
v9 = (struct cdfs_file *)AllocSysMemory(1, 16, 0);
file = v9;
if ( !v9 )
{
return -12;
return -ENOMEM;
}
io->privdata = v9;
v9->f_lsn = dirent.d_lsn;
Expand Down Expand Up @@ -125,7 +125,7 @@ static int cddrv_write(iop_file_t *io, void *buf, int cnt)
(void)buf;
(void)cnt;

return -30;
return -EROFS;
}

static int cddrv_lseek(iop_file_t *io, int offset, int whence)
Expand Down Expand Up @@ -155,12 +155,12 @@ static int cddrv_ioctl(iop_file_t *io, int cmd, void *arg)
(void)cmd;
(void)arg;

return -22;
return -EINVAL;
}

static int cddrv_dummy()
{
return -22;
return -EINVAL;
}

int cddrv_module_start(int argc, char **argv)
Expand Down
29 changes: 15 additions & 14 deletions iop/cdvd/cdfs/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <iox_stat.h>
#include <loadcore.h>
#include <sysclib.h>
#include <errno.h>

#include "cdfs_iop.h"

Expand Down Expand Up @@ -93,12 +94,12 @@ static int fio_open(iop_file_t *f, const char *name, int mode)
// check if the file exists
if (!cdfs_findfile(name, &tocEntry)) {
printf("***** FILE %s CAN NOT FOUND ******\n\n", name);
return -1;
return -EPERM;
}

if (mode != O_RDONLY) {
printf("mode is different than O_RDONLY, expected %i, received %i\n\n", O_RDONLY, mode);
return -2;
return -ENOENT;
}

DPRINTF("CDFS: fio_open TocEntry info\n");
Expand All @@ -117,7 +118,7 @@ static int fio_open(iop_file_t *f, const char *name, int mode)

if (j >= MAX_FILES_OPENED) {
printf("File descriptor overflow!!\n\n");
return -3;
return -ESRCH;
}

fd_used[j] = 1;
Expand All @@ -142,7 +143,7 @@ static int fio_close(iop_file_t *f)

if (i >= MAX_FILES_OPENED) {
printf("fio_close: ERROR: File does not appear to be open!\n");
return -1;
return -EPERM;
}

fd_used[i] = 0;
Expand Down Expand Up @@ -170,7 +171,7 @@ static int fio_read(iop_file_t *f, void *buffer, int size)

if (i >= MAX_FILES_OPENED) {
printf("fio_read: ERROR: File does not appear to be open!\n");
return -1;
return -EPERM;
}

// A few sanity checks
Expand Down Expand Up @@ -231,7 +232,7 @@ static int fio_write(iop_file_t *f, void *buffer, int size)
return 0;
else {
printf("CDFS: dummy fio_write function called, this is not a re-writer xD");
return -1;
return -EPERM;
}
}

Expand All @@ -248,7 +249,7 @@ static int fio_lseek(iop_file_t *f, int offset, int whence)

if (i >= 16) {
DPRINTF("fio_lseek: ERROR: File does not appear to be open!\n");
return -1;
return -EPERM;
}

switch (whence) {
Expand Down Expand Up @@ -293,12 +294,12 @@ static int fio_openDir(iop_file_t *f, const char *path) {
}

if (j >= MAX_FOLDERS_OPENED)
return -3;
return -ESRCH;

fod_table[j].files = cdfs_getDir(path, NULL, CDFS_GET_FILES_AND_DIRS, fod_table[j].entries, MAX_FILES_PER_FOLDER);
if (fod_table[j].files < 0) {
printf("The path doesn't exist\n\n");
return -2;
return -ENOENT;
}

fod_table[j].filesIndex = 0;
Expand Down Expand Up @@ -337,7 +338,7 @@ static int fio_closeDir(iop_file_t *fd)

if (i >= MAX_FOLDERS_OPENED) {
printf("fio_close: ERROR: File does not appear to be open!\n");
return -1;
return -EPERM;
}

fod_used[i] = 0;
Expand All @@ -358,13 +359,13 @@ static int fio_dread(iop_file_t *fd, io_dirent_t *dirent)

if (i >= MAX_FOLDERS_OPENED) {
printf("fio_dread: ERROR: Folder does not appear to be open!\n\n");
return -1;
return -EPERM;
}

filesIndex = fod_table[i].filesIndex;
if (filesIndex >= fod_table[i].files) {
printf("fio_dread: No more items pending to read!\n\n");
return -1;
return -EPERM;
}

entry = fod_table[i].entries[filesIndex];
Expand Down Expand Up @@ -392,7 +393,7 @@ static int fio_dread(iop_file_t *fd, io_dirent_t *dirent)
static int fio_getstat(iop_file_t *fd, const char *name, io_stat_t *stat)
{
struct TocEntry entry;
int ret = -1;
int ret = -EPERM;

(void)fd;

Expand All @@ -419,7 +420,7 @@ static int fio_getstat(iop_file_t *fd, const char *name, io_stat_t *stat)

static int cdfs_dummy() {
DPRINTF("CDFS: dummy function called\n\n");
return -5;
return -EIO;
}

static iop_device_ops_t fio_ops = {
Expand Down
4 changes: 2 additions & 2 deletions iop/cdvd/xesdrv/src/xesdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ esdrv_df_ioctl2(iomanX_iop_file_t *f, int cmd, void *arg, unsigned int arglen, v

static int esdrv_df_null()
{
return -48;
return -EUNSUP;
}

static s64 esdrv_df_null_long()
{
return -48;
return -EUNSUP;
}

static void EsAcsSetAaryptorIoMode(void)
Expand Down
3 changes: 2 additions & 1 deletion iop/debug/iop_sbusdbg/src/sbus_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Of course this requires that the EE-side code accept this command and output the
#include <tamtypes.h>
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <sysclib.h>
#include <sysmem.h>
#include <excepman.h>
Expand All @@ -26,7 +27,7 @@ Of course this requires that the EE-side code accept this command and output the

extern void sbus_tty_puts(const char *str);

static int ttyfs_error() { return -1; }
static int ttyfs_error() { return -EPERM; }

static int ttyfs_init()
{
Expand Down
3 changes: 2 additions & 1 deletion iop/debug/ppctty/src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ IOP->PPC TTY
#include <tamtypes.h>
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <sysclib.h>
#include <sysmem.h>
#include <excepman.h>
Expand All @@ -25,7 +26,7 @@ static int tty_sema = -1;

extern void tty_puts(const char *str);

static int ttyfs_error() { return -1; }
static int ttyfs_error() { return -EPERM; }

static int ttyfs_init()
{
Expand Down
Loading

0 comments on commit dbb7fa1

Please sign in to comment.