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

ref: 58be27abc63c8043cb3e2ccfc48b6c1a9dfda047 CTU-FEE-B0B35APO-Semestral-project/file-browser/src/device_mount.c -rw-r--r-- 669 bytes
58be27ab — František Boháček feat: split text into multiple lines so it fits 4 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;
}