12 #include "kerncompat.h"
15 #define BLKGETSIZE64 0
16 #define BTRFS_IOC_SNAP_CREATE 0
17 #define BTRFS_VOL_NAME_MAX 255
18 struct btrfs_ioctl_vol_args { char name[BTRFS_VOL_NAME_MAX]; };
19 static inline int ioctl(int fd, int define, void *arg) { return 0; }
22 void print_usage(void)
24 printf("usage: btrfsctl [ -s snapshot_name ] dir\n");
28 int main(int ac, char **av)
33 struct btrfs_ioctl_vol_args args;
37 for (i = 1; i < ac - 1; i++) {
38 if (strcmp(av[i], "-s") == 0) {
39 if (i + 1 >= ac - 1) {
40 fprintf(stderr, "-s requires an arg");
44 if (strlen(name) >= BTRFS_VOL_NAME_MAX) {
45 fprintf(stderr, "snapshot name is too long\n");
51 printf("fname is %s\n", fname);
52 fd = open(fname, O_RDWR);
57 strcpy(args.name, name);
58 ret = ioctl(fd, BTRFS_IOC_SNAP_CREATE, &args);
59 printf("ioctl returns %d\n", ret);