Created
April 24, 2016 13:39
-
-
Save zined/f6c8517d7c83b5958cc2d9200b2e3fe3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- docker/daemon/graphdriver/btrfs/btrfs.go 2016-03-09 12:13:24.000000000 -0800 | |
+++ docker/daemon/graphdriver/btrfs/btrfs.go 2016-04-17 04:34:27.188376720 -0700 | |
@@ -7,6 +7,10 @@ package btrfs | |
#include <dirent.h> | |
#include <btrfs/ioctl.h> | |
#include <btrfs/ctree.h> | |
+ | |
+static void set_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct, const char* value) { | |
+ snprintf(btrfs_struct->name, BTRFS_SUBVOL_NAME_MAX, "%s", value); | |
+} | |
*/ | |
import "C" | |
@@ -160,9 +164,10 @@ func subvolSnapshot(src, dest, name stri | |
var args C.struct_btrfs_ioctl_vol_args_v2 | |
args.fd = C.__s64(getDirFd(srcDir)) | |
- for i, c := range []byte(name) { | |
- args.name[i] = C.char(c) | |
- } | |
+ | |
+ var cs = C.CString(name) | |
+ C.set_name_btrfs_ioctl_vol_args_v2(&args, cs) | |
+ C.free(unsafe.Pointer(cs)) | |
_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2, | |
uintptr(unsafe.Pointer(&args))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment