]> git.sesse.net Git - bcachefs-tools-debian/blob - bcache-run.c
Redo lots of stuff
[bcachefs-tools-debian] / bcache-run.c
1
2 #include <errno.h>
3 #include <stdbool.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7
8 #include <fcntl.h>
9 #include <sys/ioctl.h>
10 #include <unistd.h>
11
12 #include <nih/command.h>
13 #include <nih/option.h>
14
15 #include <uuid/uuid.h>
16
17 #include "bcache.h"
18 #include "bcache-run.h"
19
20 NihOption opts_run[] = {
21         NIH_OPTION_LAST
22 };
23
24 int cmd_run(NihCommand *command, char *const *args)
25 {
26         return 0;
27 }
28
29 NihOption opts_stop[] = {
30         NIH_OPTION_LAST
31 };
32
33 int cmd_stop(NihCommand *command, char *const *args)
34 {
35         if (nr_args(args) != 1)
36                 die("Please supply a filesystem");
37
38         struct bcache_handle fs = bcache_fs_open(args[0]);
39
40         if (ioctl(fs.fd, BCH_IOCTL_STOP))
41                 die("BCH_IOCTL_STOP error: %s", strerror(errno));
42
43         return 0;
44 }