 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Fri Nov 04, 2005 8:14 am Post subject: hdd listing |
|
|
I am trying to list the partitions on the hd but it is not working correctly. The sizes and number of partitions looks correct but the names dont work.
Can someone please help me and tell where I am going wrong.
Here is some test code:
| Code: | #include <tamtypes.h>
#include <sifrpc.h>
#include <debug.h>
#include <loadfile.h>
#include <iopheap.h>
#include <iopcontrol.h>
#include <kernel.h>
#include <fileXio_rpc.h>
#include <libhdd.h>
#include <string.h>
#define RESET_IOP
extern u8 *iomanx_irx;
extern int size_iomanx_irx;
extern u8 *filexio_irx;
extern int size_filexio_irx;
extern u8 *ps2dev9_irx;
extern int size_ps2dev9_irx;
extern u8 *ps2atad_irx;
extern int size_ps2atad_irx;
extern u8 *ps2hdd_irx;
extern int size_ps2hdd_irx;
int main()
{
#ifdef RESET_IOP
SifInitRpc(0);
SifIopReset("rom0:UDNL rom0:EELOADCNF", 0);
while (SifIopSync())
;
#endif
SifInitRpc(0);
init_scr();
scr_printf("HDD Test\n");
int ret;
ret = SifExecModuleBuffer(&iomanx_irx, size_iomanx_irx, 0, NULL, &ret);
scr_printf("Loaded iomanX.irx %d\n", ret);
ret = SifExecModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, &ret);
scr_printf("Loaded ps2dev9.irx %d\n", ret);
ret = SifExecModuleBuffer(&ps2atad_irx, size_ps2atad_irx, 0, NULL, &ret);
scr_printf("Loaded ps2atad.irx %d\n", ret);
ret = SifExecModuleBuffer(&ps2hdd_irx, size_ps2hdd_irx, 0, NULL, &ret);
scr_printf("Loaded ps2hdd.irx %d\n", ret);
ret = SifExecModuleBuffer(&filexio_irx, size_filexio_irx, 0, NULL, &ret);
scr_printf("Loaded fileXio.irx %d\n", ret);
ret = fileXioInit();
scr_printf("fileXioInit %d\n", ret);
int fd;
fd = fileXioDopen("hdd0:/");
scr_printf("fileXioDopen %d\n", ret);
while (1)
{
iox_dirent_t l_dir_entry __attribute__((aligned(64)));
ret = fileXioDread(fd, &l_dir_entry);
if (ret == 0)
break;
if (( l_dir_entry.stat.attr & ATTR_SUB_PARTITION) ||
( l_dir_entry.stat.mode == FS_TYPE_EMPTY) ||
( l_dir_entry.stat.mode == 0x1337) ||
(strncmp(l_dir_entry.name, "__", 2) == 0))
continue;
scr_printf("fileXioDread %d\t", ret);
scr_printf("\"%s\"%c\t%x\t%x\t%d\n",
l_dir_entry.name,
FIO_S_ISDIR(l_dir_entry.stat.mode) ? '/' : ' ',
l_dir_entry.stat.mode,
l_dir_entry.stat.attr,
l_dir_entry.stat.size);
}
ret = fileXioDclose(fd);
scr_printf("fileXioDclose %d\n", ret);
return 0;
}
|
|
|
| Back to top |
|
 |
EEUG
Joined: 13 May 2005 Posts: 136 Location: The Netherlands
|
Posted: Fri Nov 04, 2005 4:04 pm Post subject: |
|
|
| ...iomanX module from SVN is the reason for that. SMS uses one from ps2link's distribution, so if you take it from there then your problem will be solved :)... |
|
| Back to top |
|
 |
EP
Joined: 05 Nov 2005 Posts: 39
|
Posted: Sat Nov 05, 2005 1:21 pm Post subject: |
|
|
OK I had done some investigating on the issue with iomanX.irx. I can safely say that it is do to some changes that herben submitted back in February. I recompiled the module using the older source for iomanX.c file dated October 11, 2004. Maybe it could be possible to fix the partition display mess another way but I'm still not sure.
Location of the file in the sdk is for those that are interested: ps2sdk/iop/system/iomanx/src/iomanx.c
In other words, use Rev 629 of iomanX.c instead of Rev 799 or Rev 864. Compile the iomanX.irx module and that should resolve the issue. |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Mon Nov 07, 2005 9:04 am Post subject: |
|
|
Thanks guys. I am going to have a closer look at the sources.
I can see the change is the introduction of iox_dirent_t. This has some extra fields. It appears the extra fields are never used though. Does anybody see any need for iox_dirent_t? Should I remove it and go back to io_dirent_t?
I shall have a closer look tonight. |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Mon Nov 07, 2005 9:14 am Post subject: |
|
|
Ok, I think the dread function in iomanx.c needs to be changed to this:
| Code: | int dread(int fd, void *buf)
{
iox_dirent_t *iox_dirent = (iox_dirent_t *) buf;
iop_file_t *f = get_file(fd);
int res;
if (f == NULL || !(f->mode & 8))
return -EBADF;
/* If this is a legacy device (such as mc:) then we need to convert the mode
variable of the stat structure to iomanX's extended format. */
if ((f->device->type & 0xf0000000) != IOP_DT_FSEXT)
{
io_dirent_t io_dirent;
res = f->device->ops->dread(f, &io_dirent);
iox_dirent->stat.mode = mode2modex(io_dirent.stat.mode);
iox_dirent->stat.attr = io_dirent.stat.attr;
iox_dirent->stat.size = io_dirent.stat.size;
memcpy(iox_dirent->stat.ctime, io_dirent.stat.ctime, sizeof(io_dirent.stat.ctime));
memcpy(iox_dirent->stat.atime, io_dirent.stat.atime, sizeof(io_dirent.stat.atime));
memcpy(iox_dirent->stat.mtime, io_dirent.stat.mtime, sizeof(io_dirent.stat.mtime));
iox_dirent->stat.hisize = io_dirent.stat.hisize;
strncpy(iox_dirent->name, io_dirent.name, sizeof(iox_dirent->name));
}
else
res = f->device->ops->dread(f, iox_dirent);
return res;
}
|
I shall test it out tonight. |
|
| Back to top |
|
 |
EP
Joined: 05 Nov 2005 Posts: 39
|
Posted: Mon Nov 07, 2005 3:02 pm Post subject: |
|
|
Thanks radad, works fine. Tested my new compiles of uLaunchELF and ps2link with those changes to iomanX.
Turns out that iomanX file was the root cause of the problem I was having with ps2link. I guess I should have known.
Hope those changes can be approved and added it to SVN. |
|
| Back to top |
|
 |
radad
Joined: 19 May 2004 Posts: 246 Location: Melbourne, Australia
|
Posted: Tue Nov 08, 2005 8:09 am Post subject: |
|
|
I tried it out last night and my above test now works. It also works in ps2link as EP pointed out.
Can someone please check this in? Or can I have write permission to svn and I will check it in myself. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|