Skip to content

Commit

Permalink
Merge pull request #604 from fjtrujy/fixUnnecesaryWrites
Browse files Browse the repository at this point in the history
Remove extra unaligned buffer as it solved using `sceSifGetOtherData`
  • Loading branch information
uyjulian authored Apr 20, 2024
2 parents 32c2772 + 09c6e2a commit 2ac2efe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
2 changes: 0 additions & 2 deletions common/include/fileXio.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ struct fxio_write_packet
int fd;
const void *buffer;
int size;
unsigned int unalignedDataLen;
unsigned char unalignedData[64];
};

struct fxio_lseek_packet
Expand Down
12 changes: 0 additions & 12 deletions ee/rpc/filexio/src/fileXio_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ int fileXioRead(int fd, void *buf, int size)
#ifdef F_fileXioWrite
int fileXioWrite(int fd, const void *buf, int size)
{
unsigned int miss;
int rv;
struct fxio_write_packet *packet=(struct fxio_write_packet*)__sbuff;

Expand All @@ -625,20 +624,9 @@ int fileXioWrite(int fd, const void *buf, int size)
_lock();
WaitSema(__fileXioCompletionSema);

if((unsigned int)buf & 0x3F)
{
miss = 64 - ((unsigned int)buf & 0x3F);
if(miss > (unsigned int)size) miss = size;
} else {
miss = 0;
}

packet->fd = fd;
packet->buffer = buf;
packet->size = size;
packet->unalignedDataLen = miss;

memcpy(packet->unalignedData, buf, miss);

if(!IS_UNCACHED_SEG(buf))
SifWriteBackDCache((void*)buf, size);
Expand Down
21 changes: 4 additions & 17 deletions iop/fs/filexio/src/fileXio_iop.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static rests_pkt rests;
static int fileXio_GetDeviceList_RPC(struct fileXioDevice* ee_devices, int eecount);
static int fileXio_CopyFile_RPC(const char *src, const char *dest, int mode);
static int fileXio_Read_RPC(int infd, char *read_buf, int read_size, void *intr_data);
static int fileXio_Write_RPC(int outfd, const char *write_buf, int write_size, int mis,u8 *misbuf);
static int fileXio_Write_RPC(int outfd, const char *write_buf, int write_size);
static int fileXio_GetDir_RPC(const char* pathname, struct fileXioDirEntry dirEntry[], unsigned int req_entries);
static int fileXio_Mount_RPC(const char* mountstring, const char* mountpoint, int flag);
static int fileXio_chstat_RPC(char *filename, void* eeptr, int mask);
Expand Down Expand Up @@ -302,7 +302,7 @@ static int fileXio_Read_RPC(int infd, char *read_buf, int read_size, void *intr_
return (total);
}

static int fileXio_Write_RPC(int outfd, const char *write_buf, int write_size, int mis,u8 *misbuf)
static int fileXio_Write_RPC(int outfd, const char *write_buf, int write_size)
{
SifRpcReceiveData_t rdata;
int left;
Expand All @@ -312,20 +312,8 @@ static int fileXio_Write_RPC(int outfd, const char *write_buf, int write_size, i

left = write_size;
total = 0;
if (mis > 0)
{
wlen=iomanX_write(outfd, misbuf, mis);
if (wlen != mis)
{
if (wlen > 0)
total += wlen;
return (total);
}
total += wlen;
}

left-=mis;
pos=(int)write_buf+mis;
pos=(int)write_buf;
while(left){
int writelen;
writelen = MIN(RWBufferSize, (unsigned int)left);
Expand Down Expand Up @@ -720,8 +708,7 @@ static void* fileXioRpc_Write(unsigned int* sbuff)
struct fxio_write_packet *packet=(struct fxio_write_packet*)sbuff;

M_DEBUG("Write Request fd:%d, size:%d\n", packet->fd, packet->size);
ret=fileXio_Write_RPC(packet->fd, packet->buffer, packet->size,
packet->unalignedDataLen, packet->unalignedData);
ret=fileXio_Write_RPC(packet->fd, packet->buffer, packet->size);
sbuff[0] = ret;
return sbuff;
}
Expand Down

0 comments on commit 2ac2efe

Please sign in to comment.