PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ps2_fio.c File Reference
#include <types.h>
#include <defs.h>
#include <irx.h>
#include <loadcore.h>
#include <ioman_mod.h>
#include <iomanX.h>
#include <thbase.h>
#include <thsemap.h>
#include <stdio.h>
#include <sysclib.h>
#include <errno.h>
#include <ps2ip.h>
#include <iopmgr.h>
#include "ps2_fio.h"
#include "ps2fs.h"
#include "byteorder.h"
#include "devscan.h"
#include "debug_printf.h"
+ Include dependency graph for ps2_fio.c:

Go to the source code of this file.

Data Structures

struct  fd_table_t
 

Macros

#define PACKET_MAXSIZE   4096
 
#define FIOTRAN_MAXSIZE   65535
 
#define FDH_MAX   50
 
#define fdh_get(a)   (&fd_info_list[a])
 
#define fdh_getused(a)   (fd_info_list[a].used)
 
#define fdh_getfdtype(a)   (fd_info_list[a].devtype)
 
#define fdh_getrealfd(a)   (fd_info_list[a].realfd)
 
#define PFS_ZONE_SIZE   8192
 
#define PFS_FRAGMENT   0x00000000
 

Functions

int fsysUnmount (void)
 
static char ps2netfs_send_packet[PACKET_MAXSIZE] __attribute__ ((aligned(16)))
 
static void fdh_setup ()
 
static int fdh_getfd (int devtype, int fd)
 
static void fdh_freefd (int fd)
 
static int convmode_to_iomanx (int stat)
 
static int convmode_from_iomanx (int stat)
 
int ps2netfs_close_socket (void)
 
void ps2netfs_close_fsys (void)
 
static int ps2netfs_lwip_send (int sock, void *buf, int len, int flag)
 
int ps2netfs_recv_bytes (int sock, char *buf, int bytes)
 
int ps2netfs_accept_pktunknown (int sock, char *buf)
 
static int ps2netfs_op_info (char *buf, int len)
 
static int ps2netfs_op_fstype (char *buf, int len)
 
static int ps2netfs_op_devlist (char *buf, int len)
 
static int ps2netfs_op_open (char *buf, int len)
 
static int ps2netfs_op_close (char *buf, int len)
 
static int ps2netfs_op_read (char *buf, int len)
 
static int ps2netfs_op_write (char *buf, int len)
 
static int ps2netfs_op_lseek (char *buf, int len)
 
static int ps2netfs_op_ioctl (char *buf, int len)
 
static int ps2netfs_op_remove (char *buf, int len)
 
static int ps2netfs_op_mkdir (char *buf, int len)
 
static int ps2netfs_op_rmdir (char *buf, int len)
 
static int ps2netfs_op_dopen (char *buf, int len)
 
static int ps2netfs_op_dclose (char *buf, int len)
 
static int ps2netfs_op_dread (char *buf, int len)
 
static int ps2netfs_op_getstat (char *buf, int len)
 
static int ps2netfs_op_chstat (char *buf, int len)
 
static int ps2netfs_op_format (char *buf, int len)
 
static int ps2netfs_op_rename (char *buf, int len)
 
static int ps2netfs_op_chdir (char *buf, int len)
 
static int ps2netfs_op_sync (char *buf, int len)
 
static int ps2netfs_op_mount (char *buf, int len)
 
static int ps2netfs_op_umount (char *buf, int len)
 
static int ps2netfs_op_lseek64 (char *buf, int len)
 
static int ps2netfs_op_devctl (char *buf, int len)
 
static int ps2netfs_op_symlink (char *buf, int len)
 
static int ps2netfs_op_readlink (char *buf, int len)
 
static int ps2netfs_op_ioctl2 (char *buf, int len)
 
static void ps2netfs_Listener (int sock)
 
int ps2netfs_serv (void *argv)
 
int ps2netfs_Init (void)
 
int ps2fs_Destroy (void)
 

Variables

static int ps2netfs_sock = -1
 
static int ps2netfs_active = 0
 
static int ps2netfs_sema
 
static int ps2netfs_pid = 0
 
static char ps2netfs_fiobuffer [FIOTRAN_MAXSIZE+1]
 
static fd_table_t fd_info_list [FDH_MAX+1]
 

Detailed Description

iop tcp fs driver.

Definition in file ps2_fio.c.

Macro Definition Documentation

◆ PACKET_MAXSIZE

#define PACKET_MAXSIZE   4096

Definition at line 42 of file ps2_fio.c.

◆ FIOTRAN_MAXSIZE

#define FIOTRAN_MAXSIZE   65535

Definition at line 53 of file ps2_fio.c.

◆ FDH_MAX

#define FDH_MAX   50

Definition at line 69 of file ps2_fio.c.

◆ fdh_get

#define fdh_get (   a)    (&fd_info_list[a])

Get fd list entry.

Definition at line 128 of file ps2_fio.c.

◆ fdh_getused

#define fdh_getused (   a)    (fd_info_list[a].used)

Get fd list entry used value.

Definition at line 130 of file ps2_fio.c.

◆ fdh_getfdtype

#define fdh_getfdtype (   a)    (fd_info_list[a].devtype)

Get fd list entry type value.

Definition at line 132 of file ps2_fio.c.

◆ fdh_getrealfd

#define fdh_getrealfd (   a)    (fd_info_list[a].realfd)

Get fd list entry ps2 file descriptor value.

Definition at line 134 of file ps2_fio.c.

◆ PFS_FRAGMENT

#define PFS_FRAGMENT   0x00000000

Definition at line 1309 of file ps2_fio.c.

Function Documentation

◆ ps2netfs_lwip_send()

static int ps2netfs_lwip_send ( int  sock,
void *  buf,
int  len,
int  flag 
)
inlinestatic

Definition at line 200 of file ps2_fio.c.

◆ ps2netfs_recv_bytes()

int ps2netfs_recv_bytes ( int  sock,
char *  buf,
int  bytes 
)

Do repetetive recv() calls until 'bytes' bytes are received or error returned

Definition at line 219 of file ps2_fio.c.

Referenced by ps2netfs_accept_pktunknown(), and ps2netfs_op_write().

◆ ps2netfs_accept_pktunknown()

int ps2netfs_accept_pktunknown ( int  sock,
char *  buf 
)

Receive a 'packet' of unknown type, max size 4096 bytes

Definition at line 244 of file ps2_fio.c.

References ps2netfs_recv_bytes().

Referenced by ps2netfs_Listener().

◆ ps2netfs_op_format()

static int ps2netfs_op_format ( char *  buf,
int  len 
)
static

Definition at line 1310 of file ps2_fio.c.

Variable Documentation

◆ ps2netfs_sock

int ps2netfs_sock = -1
static

Definition at line 47 of file ps2_fio.c.

◆ ps2netfs_active

int ps2netfs_active = 0
static

Definition at line 48 of file ps2_fio.c.

◆ ps2netfs_sema

int ps2netfs_sema
static

Definition at line 50 of file ps2_fio.c.

◆ ps2netfs_pid

int ps2netfs_pid = 0
static

Definition at line 51 of file ps2_fio.c.

◆ ps2netfs_fiobuffer

char ps2netfs_fiobuffer[FIOTRAN_MAXSIZE+1]
static

Definition at line 54 of file ps2_fio.c.

◆ fd_info_list

fd_table_t fd_info_list[FDH_MAX+1]
static

Definition at line 70 of file ps2_fio.c.