Add IOCTL_FSA_FLUSHVOLUME

This commit is contained in:
GaryOderNichts 2021-04-04 04:20:32 +02:00 committed by Maschell
parent 8a8afd4135
commit bd3d993a7f
3 changed files with 25 additions and 0 deletions

View File

@ -57,6 +57,20 @@ int FSA_Unmount(int fd, char *path, u32 flags) {
return ret;
}
int FSA_FlushVolume(int fd, char* volume_path)
{
u8* iobuf = allocIobuf();
u32* inbuf = (u32*)iobuf;
u32* outbuf = (u32*)&iobuf[0x520];
strncpy((char*)&inbuf[0x01], volume_path, 0x27F);
int ret = svcIoctl(fd, 0x1B, inbuf, 0x520, outbuf, 0x293);
freeIobuf(iobuf);
return ret;
}
int FSA_MakeDir(int fd, char *path, u32 flags) {
u8 *iobuf = allocIobuf();
u32 *inbuf = (u32 *) iobuf;

View File

@ -31,6 +31,8 @@ int FSA_Mount(int fd, char *device_path, char *volume_path, u32 flags, char *arg
int FSA_Unmount(int fd, char *path, u32 flags);
int FSA_FlushVolume(int fd, char* volume_path);
int FSA_GetDeviceInfo(int fd, char *device_path, int type, u32 *out_data);
int FSA_MakeDir(int fd, char *path, u32 flags);

View File

@ -73,6 +73,7 @@
#define IOCTL_FSA_RAW_WRITE 0x56
#define IOCTL_FSA_RAW_CLOSE 0x57
#define IOCTL_FSA_CHANGEMODE 0x58
#define IOCTL_FSA_FLUSHVOLUME 0x59
static int ipcNodeKilled;
static u8 threadStack[0x1000] __attribute__((aligned(0x20)));
@ -361,6 +362,14 @@ static int ipc_ioctl(ipcmessage *message) {
message->ioctl.buffer_io[0] = FSA_ChangeMode(fd, path, mode);
break;
}
case IOCTL_FSA_FLUSHVOLUME:
{
int fd = message->ioctl.buffer_in[0];
char *path = ((char *)message->ioctl.buffer_in) + message->ioctl.buffer_in[1];
message->ioctl.buffer_io[0] = FSA_FlushVolume(fd, path);
break;
}
default:
res = IOS_ERROR_INVALID_ARG;
break;