Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iomanX use stack instead of static data for temporary file structs #681

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iop/system/iomanx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

IOP_BIN ?= iomanX.irx

IOP_CFLAGS += -DIOMANX_OLD_NAME_ADDDELDRV=0 -DIOMANX_OLD_NAME_COMPATIBILITY=0 -DIOMANX_ENABLE_LEGACY_IOMAN_HOOK
IOP_CFLAGS += -DIOMANX_OLD_NAME_ADDDELDRV=0 -DIOMANX_OLD_NAME_COMPATIBILITY=0 -DIOMANX_ENABLE_LEGACY_IOMAN_HOOK -DIOMAN_USE_FILE_STRUCT_TEMP_STACK

IOP_OBJS = iomanX.o ioman_sbv.o exports.o imports.o

Expand Down
63 changes: 63 additions & 0 deletions iop/system/iomanx/src/iomanX.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,17 @@ int iomanX_remove(const char *name)
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(name, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand All @@ -633,10 +640,17 @@ static int xx_stat(int op, const char *name, iox_stat_t *stat, unsigned int stat
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(name, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand Down Expand Up @@ -702,10 +716,17 @@ int iomanX_format(const char *dev, const char *blockdev, void *arg, int arglen)
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(dev, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand All @@ -722,10 +743,17 @@ static int xx_rename(int op, const char *oldname, const char *newname)
const char *parsefile_res_new;
iomanX_iop_device_t *device_new;
int unit_new;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(oldname, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand Down Expand Up @@ -783,10 +811,17 @@ static int xx_dir(int op, const char *name, int mode)
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(name, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand Down Expand Up @@ -822,10 +857,17 @@ int iomanX_mount(const char *fsname, const char *devname, int flag, void *arg, i
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(fsname, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand All @@ -842,10 +884,17 @@ int iomanX_umount(const char *fsname)
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(fsname, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand All @@ -860,10 +909,17 @@ int iomanX_devctl(const char *name, int cmd, void *arg, unsigned int arglen, voi
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(name, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand All @@ -878,10 +934,17 @@ int iomanX_readlink(const char *path, char *buf, unsigned int buflen)
{
iomanX_iop_file_t *f;
const char *parsefile_res;
#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
iomanX_iop_file_t f_stk;
#endif

#ifdef IOMAN_USE_FILE_STRUCT_TEMP_STACK
f = &f_stk;
#else
f = new_iob();
if ( !f )
return handle_result(-EMFILE, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
#endif
parsefile_res = parsefile(path, &(f->device), &(f->unit));
if ( !parsefile_res )
return handle_result(-ENODEV, f, HANDLE_RESULT_CLEAR_INFO_ON_ERROR);
Expand Down