skopeo: fix build with btrfs-progs 6.1

| # github.com/containers/storage/drivers/btrfs
| vendor/github.com/containers/storage/drivers/btrfs/btrfs.go:387:11: args.lim.max_referenced undefined (type _Ctype_struct_btrfs_qgroup_limit has no field or method max_referenced)
| recipe skopeo-v1.8.0+gitAUTOINC+b95e081162-r0: task do_compile: Failed

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Jose Quaresma 2023-01-10 15:14:32 +00:00 committed by Bruce Ashfield
parent a49eaf45a4
commit 67e8b34d99
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From 246ba3062e8b551026aef2708eee747014ce5c52 Mon Sep 17 00:00:00 2001
From: Rui Chen <rui@chenrui.dev>
Date: Wed, 28 Dec 2022 18:26:39 -0500
Subject: [PATCH] fix: workaround field rename in btrfs-progs 6.1
same as kdave/btrfs-progs@0345143
Signed-off-by: Rui Chen <rui@chenrui.dev>
Upstream-Status: Backport [https://github.com/containers/storage/commit/246ba3062e8b551026aef2708eee747014ce5c52]
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
drivers/btrfs/btrfs.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/btrfs/btrfs.go b/drivers/btrfs/btrfs.go
index e8b16b858e..3d9053297b 100644
--- a/drivers/btrfs/btrfs.go
+++ b/drivers/btrfs/btrfs.go
@@ -6,6 +6,9 @@ package btrfs
/*
#include <stdlib.h>
#include <dirent.h>
+
+// keep struct field name compatible with btrfs-progs < 6.1.
+#define max_referenced max_rfer
#include <btrfs/ioctl.h>
#include <btrfs/ctree.h>
@@ -382,7 +385,7 @@ func subvolLimitQgroup(path string, size uint64) error {
defer closeDir(dir)
var args C.struct_btrfs_ioctl_qgroup_limit_args
- args.lim.max_referenced = C.__u64(size)
+ args.lim.max_rfer = C.__u64(size)
args.lim.flags = C.BTRFS_QGROUP_LIMIT_MAX_RFER
_, _, errno := unix.Syscall(unix.SYS_IOCTL, getDirFd(dir), C.BTRFS_IOC_QGROUP_LIMIT,
uintptr(unsafe.Pointer(&args)))

View File

@ -24,6 +24,7 @@ SRC_URI = " \
file://storage.conf \
file://registries.conf \
file://0001-makefile-add-GOBUILDFLAGS-to-go-build-call.patch \
file://0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch;patchdir=src/import/vendor/github.com/containers/storage \
"
SRCREV = "4517ea0b7be6a6743d854e05cd24f7354a487b60"