[PATCH] skope: fix build with btrfs-progs 6.1


Bruce Ashfield
 

On Tue, Jan 10, 2023 at 10:43 AM Jose Quaresma <quaresma.jose@...> wrote:


Bruce Ashfield <bruce.ashfield@...> escreveu no dia terça, 10/01/2023 à(s) 15:39:

This is one of the breakages I warned about earlier, I have a version
bump in master-next, and pending fix that I'm about to push.

If those don't sort it out, I'll have a closer look at this.

I have tried on my side bumping to v1.10.0 as well but this patch is still needed.
Right, that's what I meant that I also have a similar storage patch
that I was testing. It is broken across packages with btrfs go
interfaces, so I was attempting a single solution.

Bruce

Thanks for looking at this.

Jose


Bruce

On Tue, Jan 10, 2023 at 10:15 AM Jose Quaresma <quaresma.jose@...> wrote:

| # 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@...>
---
...ound_field_rename_in_btrfs-progs_6_1.patch | 38 +++++++++++++++++++
recipes-containers/skopeo/skopeo_git.bb | 1 +
2 files changed, 39 insertions(+)
create mode 100644 recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch

diff --git a/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
new file mode 100644
index 0000000..cd3c70f
--- /dev/null
+++ b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
@@ -0,0 +1,38 @@
+From 246ba3062e8b551026aef2708eee747014ce5c52 Mon Sep 17 00:00:00 2001
+From: Rui Chen <rui@...>
+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@...>
+
+Upstream-Status: Backport [https://github.com/containers/storage/commit/246ba3062e8b551026aef2708eee747014ce5c52]
+Signed-off-by: Jose Quaresma <jose.quaresma@...>
+---
+ 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)))
diff --git a/recipes-containers/skopeo/skopeo_git.bb b/recipes-containers/skopeo/skopeo_git.bb
index a2fff2c..3eaddfd 100644
--- a/recipes-containers/skopeo/skopeo_git.bb
+++ b/recipes-containers/skopeo/skopeo_git.bb
@@ -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 = "b95e081162382f9a28f400bee10046ce72b957fe"
--
2.34.1




--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


--
Best regards,

José Quaresma


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


Jose Quaresma
 


Bruce Ashfield <bruce.ashfield@...> escreveu no dia terça, 10/01/2023 à(s) 15:39:
This is one of the breakages I warned about earlier, I have a version
bump in master-next, and pending fix that I'm about to push.

If those don't sort it out, I'll have a closer look at this.

I have tried on my side bumping to v1.10.0 as well but this patch is still needed.

Thanks for looking at this.

Jose


Bruce

On Tue, Jan 10, 2023 at 10:15 AM Jose Quaresma <quaresma.jose@...> wrote:
>
> | # 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@...>
> ---
>  ...ound_field_rename_in_btrfs-progs_6_1.patch | 38 +++++++++++++++++++
>  recipes-containers/skopeo/skopeo_git.bb       |  1 +
>  2 files changed, 39 insertions(+)
>  create mode 100644 recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
>
> diff --git a/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
> new file mode 100644
> index 0000000..cd3c70f
> --- /dev/null
> +++ b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
> @@ -0,0 +1,38 @@
> +From 246ba3062e8b551026aef2708eee747014ce5c52 Mon Sep 17 00:00:00 2001
> +From: Rui Chen <rui@...>
> +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@...>
> +
> +Upstream-Status: Backport [https://github.com/containers/storage/commit/246ba3062e8b551026aef2708eee747014ce5c52]
> +Signed-off-by: Jose Quaresma <jose.quaresma@...>
> +---
> + 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)))
> diff --git a/recipes-containers/skopeo/skopeo_git.bb b/recipes-containers/skopeo/skopeo_git.bb
> index a2fff2c..3eaddfd 100644
> --- a/recipes-containers/skopeo/skopeo_git.bb
> +++ b/recipes-containers/skopeo/skopeo_git.bb
> @@ -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 = "b95e081162382f9a28f400bee10046ce72b957fe"
> --
> 2.34.1
>
>
>
>


--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


--
Best regards,

José Quaresma


Bruce Ashfield
 

This is one of the breakages I warned about earlier, I have a version
bump in master-next, and pending fix that I'm about to push.

If those don't sort it out, I'll have a closer look at this.

Bruce

On Tue, Jan 10, 2023 at 10:15 AM Jose Quaresma <quaresma.jose@...> wrote:

| # 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@...>
---
...ound_field_rename_in_btrfs-progs_6_1.patch | 38 +++++++++++++++++++
recipes-containers/skopeo/skopeo_git.bb | 1 +
2 files changed, 39 insertions(+)
create mode 100644 recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch

diff --git a/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
new file mode 100644
index 0000000..cd3c70f
--- /dev/null
+++ b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
@@ -0,0 +1,38 @@
+From 246ba3062e8b551026aef2708eee747014ce5c52 Mon Sep 17 00:00:00 2001
+From: Rui Chen <rui@...>
+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@...>
+
+Upstream-Status: Backport [https://github.com/containers/storage/commit/246ba3062e8b551026aef2708eee747014ce5c52]
+Signed-off-by: Jose Quaresma <jose.quaresma@...>
+---
+ 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)))
diff --git a/recipes-containers/skopeo/skopeo_git.bb b/recipes-containers/skopeo/skopeo_git.bb
index a2fff2c..3eaddfd 100644
--- a/recipes-containers/skopeo/skopeo_git.bb
+++ b/recipes-containers/skopeo/skopeo_git.bb
@@ -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 = "b95e081162382f9a28f400bee10046ce72b957fe"
--
2.34.1



--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


Jose Quaresma
 

| # 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@...>
---
...ound_field_rename_in_btrfs-progs_6_1.patch | 38 +++++++++++++++++++
recipes-containers/skopeo/skopeo_git.bb | 1 +
2 files changed, 39 insertions(+)
create mode 100644 recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch

diff --git a/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
new file mode 100644
index 0000000..cd3c70f
--- /dev/null
+++ b/recipes-containers/skopeo/files/0002-fix_workaround_field_rename_in_btrfs-progs_6_1.patch
@@ -0,0 +1,38 @@
+From 246ba3062e8b551026aef2708eee747014ce5c52 Mon Sep 17 00:00:00 2001
+From: Rui Chen <rui@...>
+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@...>
+
+Upstream-Status: Backport [https://github.com/containers/storage/commit/246ba3062e8b551026aef2708eee747014ce5c52]
+Signed-off-by: Jose Quaresma <jose.quaresma@...>
+---
+ 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)))
diff --git a/recipes-containers/skopeo/skopeo_git.bb b/recipes-containers/skopeo/skopeo_git.bb
index a2fff2c..3eaddfd 100644
--- a/recipes-containers/skopeo/skopeo_git.bb
+++ b/recipes-containers/skopeo/skopeo_git.bb
@@ -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 = "b95e081162382f9a28f400bee10046ce72b957fe"
--
2.34.1