bcachefs-tools/bcache-run.c

45 lines
712 B
C
Raw Normal View History

2016-03-12 09:18:42 +03:00
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <nih/option.h>
#include <uuid/uuid.h>
#include "bcache.h"
2016-08-24 06:50:31 +03:00
int cmd_run(int argc, char *argv[])
2016-03-12 09:18:42 +03:00
{
2016-08-24 06:50:31 +03:00
NihOption opts[] = {
NIH_OPTION_LAST
};
bch_nih_init(argc, argv, opts);
2016-03-12 09:18:42 +03:00
return 0;
}
2016-08-24 06:50:31 +03:00
int cmd_stop(int argc, char *argv[])
2016-03-12 09:18:42 +03:00
{
2016-08-24 06:50:31 +03:00
NihOption opts[] = {
NIH_OPTION_LAST
};
char **args = bch_nih_init(argc, argv, opts);
2016-03-12 09:18:42 +03:00
if (nr_args(args) != 1)
die("Please supply a filesystem");
struct bcache_handle fs = bcache_fs_open(args[0]);
if (ioctl(fs.fd, BCH_IOCTL_STOP))
die("BCH_IOCTL_STOP error: %s", strerror(errno));
return 0;
}