From bf0df0c3692307c85d9e8fa9c1beb73c9f2399de Mon Sep 17 00:00:00 2001 From: XorTroll <33005497+XorTroll@users.noreply.github.com> Date: Wed, 14 Aug 2019 15:50:26 +0200 Subject: [PATCH] Add fsdevDeleteDevice This way one can unmount filesystems without closing them (in case they would be used later without fsdev/stdio) --- nx/source/runtime/devices/fs_dev.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nx/source/runtime/devices/fs_dev.c b/nx/source/runtime/devices/fs_dev.c index b5a54a1e..a4504e2f 100644 --- a/nx/source/runtime/devices/fs_dev.c +++ b/nx/source/runtime/devices/fs_dev.c @@ -335,7 +335,6 @@ static int _fsdevUnmountDeviceStruct(fsdev_fsdevice *device) strncat(name, ":", sizeof(name)-strlen(name)-1); RemoveDevice(name); - fsFsClose(&device->fs); if(device->id == fsdev_fsdevice_default) fsdev_fsdevice_default = -1; @@ -349,7 +348,7 @@ static int _fsdevUnmountDeviceStruct(fsdev_fsdevice *device) return 0; } -int fsdevUnmountDevice(const char *name) +int fsdevDeleteDevice(const char *name) { fsdev_fsdevice *device; @@ -360,6 +359,21 @@ int fsdevUnmountDevice(const char *name) return _fsdevUnmountDeviceStruct(device); } +int fsdevUnmountDevice(const char *name) +{ + fsdev_fsdevice *device; + + device = fsdevFindDevice(name); + if(device==NULL) + return -1; + + int ret = _fsdevUnmountDeviceStruct(device); + if(ret==0) + fsFsClose(&device->fs); + + return ret; +} + Result fsdevCommitDevice(const char *name) { fsdev_fsdevice *device;