Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 579856 | Differences between
and this patch

Collapse All | Expand All

(-)a/daemon/graphdriver/btrfs/btrfs.go (-3 / +8 lines)
Lines 7-12 package btrfs Link Here
7
#include <dirent.h>
7
#include <dirent.h>
8
#include <btrfs/ioctl.h>
8
#include <btrfs/ioctl.h>
9
#include <btrfs/ctree.h>
9
#include <btrfs/ctree.h>
10
11
static void set_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct, const char* value) {
12
    snprintf(btrfs_struct->name, BTRFS_SUBVOL_NAME_MAX, "%s", value);
13
}
10
*/
14
*/
11
import "C"
15
import "C"
12
16
Lines 159-167 func subvolSnapshot(src, dest, name string) error { Link Here
159
163
160
	var args C.struct_btrfs_ioctl_vol_args_v2
164
	var args C.struct_btrfs_ioctl_vol_args_v2
161
	args.fd = C.__s64(getDirFd(srcDir))
165
	args.fd = C.__s64(getDirFd(srcDir))
162
	for i, c := range []byte(name) {
166
163
		args.name[i] = C.char(c)
167
	var cs = C.CString(name)
164
	}
168
	C.set_name_btrfs_ioctl_vol_args_v2(&args, cs)
169
	C.free(unsafe.Pointer(cs))
165
170
166
	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2,
171
	_, _, errno := syscall.Syscall(syscall.SYS_IOCTL, getDirFd(destDir), C.BTRFS_IOC_SNAP_CREATE_V2,
167
		uintptr(unsafe.Pointer(&args)))
172
		uintptr(unsafe.Pointer(&args)))

Return to bug 579856