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

ref: 584549e4cfab9c1764e22e7b11ca94c8d36459f7 CTU-FEE-B0B35APO-Semestral-project/file-browser/src/device_mount.c -rw-r--r-- 669 bytes
584549e4 — František Boháček feat: add filoperation error get text 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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