From deff0227a3d5004e863c2005fa0bf02183809dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Thu, 24 Jun 2021 07:53:50 +0200 Subject: [PATCH] feat: implement device mount using system --- file-browser/src/device_mount.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 file-browser/src/device_mount.c diff --git a/file-browser/src/device_mount.c b/file-browser/src/device_mount.c new file mode 100644 index 0000000..9cc9a8e --- /dev/null +++ b/file-browser/src/device_mount.c @@ -0,0 +1,21 @@ +#include "device_mount.h" +#include "file_access.h" +#include +#include +#include + +file_operation_error_t device_mount(char *device, char *target) { + // TODO: change to use mount(), not system() + char buffer[strlen(device) + strlen(target) + 20]; + snprintf(buffer, sizeof(buffer), "mount -t auto %s %s", device, target); + system(buffer); + return FILOPER_SUCCESS; +} + +file_operation_error_t device_umount(char *device, char *target) { + // TODO: change to use mount(), not system() + char buffer[strlen(device) + strlen(target) + 20]; + snprintf(buffer, sizeof(buffer), "umount %s", target); + system(buffer); + return FILOPER_SUCCESS; +} -- 2.49.0