From 52686826d1dfbfd748d976ac08f6859a5073d0bf Mon Sep 17 00:00:00 2001 From: yellows8 Date: Fri, 12 Oct 2018 22:13:14 -0400 Subject: [PATCH] Added fsdevGetDeviceFileSystem(). --- nx/include/switch/runtime/devices/fs_dev.h | 3 +++ nx/source/runtime/devices/fs_dev.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/nx/include/switch/runtime/devices/fs_dev.h b/nx/include/switch/runtime/devices/fs_dev.h index ac37e977..b80467db 100644 --- a/nx/include/switch/runtime/devices/fs_dev.h +++ b/nx/include/switch/runtime/devices/fs_dev.h @@ -36,6 +36,9 @@ int fsdevUnmountDevice(const char *name); /// This is not used automatically at device unmount. Result fsdevCommitDevice(const char *name); +/// Returns the FsFileSystem for the specified device. Returns NULL when the specified device isn't found. +FsFileSystem* fsdevGetDeviceFileSystem(const char *name); + /// Returns the FsFileSystem for the default device (SD card), if mounted. Used internally by romfs_dev. FsFileSystem* fsdevGetDefaultFileSystem(void); diff --git a/nx/source/runtime/devices/fs_dev.c b/nx/source/runtime/devices/fs_dev.c index ae5d3478..69064419 100644 --- a/nx/source/runtime/devices/fs_dev.c +++ b/nx/source/runtime/devices/fs_dev.c @@ -456,6 +456,17 @@ Result fsdevUnmountAll(void) return 0; } +FsFileSystem* fsdevGetDeviceFileSystem(const char *name) +{ + fsdev_fsdevice *device; + + device = fsdevFindDevice(name); + if(device==NULL) + return NULL; + + return &device->fs; +} + FsFileSystem* fsdevGetDefaultFileSystem(void) { if(!fsdev_initialised) return NULL;