~ruther/CTU-FEE-B0B35APO-Semestral-project

deff0227a3d5004e863c2005fa0bf02183809dfb — František Boháček 4 years ago d81506c
feat: implement device mount using system
1 files changed, 21 insertions(+), 0 deletions(-)

A file-browser/src/device_mount.c
A file-browser/src/device_mount.c => file-browser/src/device_mount.c +21 -0
@@ 0,0 1,21 @@
#include "device_mount.h"
#include "file_access.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

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;
}

Do not follow this link