fc54adafab
compilation on Factory and Tumbleweed (which have btrfsprogs >= 4.5). + fix-btrfs-ioctl-structure.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=89
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
From a038cccf88998814249a7a40b71a33a680e3f02f Mon Sep 17 00:00:00 2001
|
|
From: Julio Montes <imc.coder@gmail.com>
|
|
Date: Fri, 1 Apr 2016 08:58:29 -0600
|
|
Subject: [PATCH] Fix compilation errors with btrfs-progs-4.5
|
|
|
|
btrfs-progs-4.5 introduces device delete by devid
|
|
for this reason btrfs_ioctl_vol_args_v2's name was encapsulated
|
|
in a union
|
|
|
|
this patch is for setting btrfs_ioctl_vol_args_v2's name
|
|
using a C function in order to preserve compatibility
|
|
with all btrfs-progs versions
|
|
|
|
Signed-off-by: Julio Montes <imc.coder@gmail.com>
|
|
Signed-off-by: Aleksa Sarai <asarai@suse.de>
|
|
---
|
|
daemon/graphdriver/btrfs/btrfs.go | 11 ++++++++---
|
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
|
|
|
Index: docker-1.10.3/daemon/graphdriver/btrfs/btrfs.go
|
|
===================================================================
|
|
--- docker-1.10.3.orig/daemon/graphdriver/btrfs/btrfs.go
|
|
+++ docker-1.10.3/daemon/graphdriver/btrfs/btrfs.go
|
|
@@ -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)))
|