From 4ad3a4b8935893a7b305e09c87c56008b3ca9b53f451bd6baabb6ea63a2b90c2 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 22 May 2024 19:51:46 +0000 Subject: [PATCH 1/4] Accepting request 1175940 from home:cyphar:docker Update containerd v1.7.17, and add missing CVE references. - CVE-2023-45288 bsc#1221400 - GHSA-jq35-85cj-fj4p bsc#1224323 OBS-URL: https://build.opensuse.org/request/show/1175940 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=175 --- _service | 6 +++--- containerd-1.7.15_926c9586.obscpio | 3 --- containerd-1.7.17_3a4de459a689.obscpio | 3 +++ containerd.changes | 11 +++++++++++ containerd.obsinfo | 6 +++--- containerd.spec | 6 +++--- 6 files changed, 23 insertions(+), 12 deletions(-) delete mode 100644 containerd-1.7.15_926c9586.obscpio create mode 100644 containerd-1.7.17_3a4de459a689.obscpio diff --git a/_service b/_service index a3b9ed0..7e0e404 100644 --- a/_service +++ b/_service @@ -3,11 +3,11 @@ https://github.com/containerd/containerd.git git containerd - 1.7.15_%h - v1.7.15 + 1.7.17_%h + v1.7.17 .git - + *.tar diff --git a/containerd-1.7.15_926c9586.obscpio b/containerd-1.7.15_926c9586.obscpio deleted file mode 100644 index 74d13b4..0000000 --- a/containerd-1.7.15_926c9586.obscpio +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e754984125ba0bcca511ad458e79b8dc941ee18bdfa9ce8f1e3ec25505e9f194 -size 50414093 diff --git a/containerd-1.7.17_3a4de459a689.obscpio b/containerd-1.7.17_3a4de459a689.obscpio new file mode 100644 index 0000000..62518a6 --- /dev/null +++ b/containerd-1.7.17_3a4de459a689.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b376a2339a0751ec75a7e7a9f8607f563a07cb7c93c09cf9badfda5fa64600e +size 50037773 diff --git a/containerd.changes b/containerd.changes index dce3482..52679a3 100644 --- a/containerd.changes +++ b/containerd.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed May 22 19:31:04 UTC 2024 - Aleksa Sarai + +- Update to containerd v1.7.17. Upstream release notes: + + +- Update to containerd v1.7.16. Upstream release notes: + + CVE-2023-45288 bsc#1221400 + ------------------------------------------------------------------- Sun Apr 21 15:57:05 UTC 2024 - Eyad Issa @@ -21,6 +31,7 @@ Sun Apr 21 15:57:05 UTC 2024 - Eyad Issa - Update to containerd v1.7.11. Upstream release notes: + GHSA-jq35-85cj-fj4p bsc#1224323 ------------------------------------------------------------------- Mon Feb 26 11:04:13 UTC 2024 - Dominique Leuenberger diff --git a/containerd.obsinfo b/containerd.obsinfo index bfcddd1..ac91bf2 100644 --- a/containerd.obsinfo +++ b/containerd.obsinfo @@ -1,4 +1,4 @@ name: containerd -version: 1.7.15_926c9586 -mtime: 1712336502 -commit: 926c9586fe4a6236699318391cd44976a98e31f1 +version: 1.7.17_3a4de459a689 +mtime: 1715895967 +commit: 3a4de459a68952ffb703bbe7f2290861a75b6b67 diff --git a/containerd.spec b/containerd.spec index d30c684..acb8ee5 100644 --- a/containerd.spec +++ b/containerd.spec @@ -23,14 +23,14 @@ %endif # MANUAL: Update the git_version. -%define git_version 926c9586fe4a6236699318391cd44976a98e31f1 -%define git_short 926c9586 +%define git_version 3a4de459a68952ffb703bbe7f2290861a75b6b67 +%define git_short 3a4de459a689 %global provider_prefix github.com/containerd/containerd %global import_path %{provider_prefix} Name: containerd -Version: 1.7.15 +Version: 1.7.17 Release: 0 Summary: Standalone OCI Container Daemon License: Apache-2.0 From 3164ac7fc027565c5b5a82d869a0a71b5bbe8f5fd9cb220912448294287e941c Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 22 May 2024 20:01:47 +0000 Subject: [PATCH 2/4] Accepting request 1175949 from home:cyphar:docker - Rebase patches: * 0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch OBS-URL: https://build.opensuse.org/request/show/1175949 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=176 --- ...rt-btrfs-depend-on-kernel-UAPI-inste.patch | 285 ++++++++---------- containerd.changes | 2 + 2 files changed, 123 insertions(+), 164 deletions(-) diff --git a/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch b/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch index 9aad47a..13ab77e 100644 --- a/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch +++ b/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch @@ -1,6 +1,6 @@ -From 4c4982da6ba4822ce8ea33a8054fac51465b0c7c Mon Sep 17 00:00:00 2001 +From 0a038dd20742bcc5e244d92af75399b0c3cdc030 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai -Date: Tue, 28 Nov 2023 22:54:03 +1100 +Date: Wed, 22 May 2024 12:58:32 -0700 Subject: [PATCH] BUILD: SLE12: revert "btrfs: depend on kernel UAPI instead of libbtrfs" @@ -15,7 +15,7 @@ for SLE-12. Signed-off-by: Aleksa Sarai --- go.mod | 2 +- - go.sum | 3 +- + go.sum | 4 +- snapshots/btrfs/btrfs.go | 2 +- .../containerd/btrfs/{v2 => }/.gitignore | 0 .../containerd/btrfs/{v2 => }/LICENSE | 0 @@ -28,58 +28,58 @@ Signed-off-by: Aleksa Sarai .../containerd/btrfs/{v2 => }/helpers.go | 29 +- .../containerd/btrfs/{v2 => }/info.go | 0 .../containerd/btrfs/{v2 => }/ioctl.go | 0 - vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 18 -- + vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 17 - vendor/golang.org/x/sys/cpu/byteorder.go | 66 ---- vendor/golang.org/x/sys/cpu/cpu.go | 290 ------------------ - vendor/golang.org/x/sys/cpu/cpu_aix.go | 34 -- + vendor/golang.org/x/sys/cpu/cpu_aix.go | 33 -- vendor/golang.org/x/sys/cpu/cpu_arm.go | 73 ----- vendor/golang.org/x/sys/cpu/cpu_arm64.go | 172 ----------- - vendor/golang.org/x/sys/cpu/cpu_arm64.s | 32 -- - vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 12 - - vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 22 -- - vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 17 - - .../golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 12 - - .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 23 -- - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 39 --- - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 33 -- - vendor/golang.org/x/sys/cpu/cpu_linux.go | 16 - + vendor/golang.org/x/sys/cpu/cpu_arm64.s | 31 -- + vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 11 - + vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 -- + vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 15 - + .../golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 11 - + .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 -- + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 37 --- + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 31 -- + vendor/golang.org/x/sys/cpu/cpu_linux.go | 15 - vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 --- .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 111 ------- - .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 24 -- - .../golang.org/x/sys/cpu/cpu_linux_noinit.go | 10 - - .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 32 -- + .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 22 -- + .../golang.org/x/sys/cpu/cpu_linux_noinit.go | 9 - + .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 30 -- .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 40 --- - vendor/golang.org/x/sys/cpu/cpu_loong64.go | 13 - - vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 16 - - vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 12 - + vendor/golang.org/x/sys/cpu/cpu_loong64.go | 12 - + vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 15 - + vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 11 - .../golang.org/x/sys/cpu/cpu_netbsd_arm64.go | 173 ----------- .../golang.org/x/sys/cpu/cpu_openbsd_arm64.go | 65 ---- .../golang.org/x/sys/cpu/cpu_openbsd_arm64.s | 11 - - vendor/golang.org/x/sys/cpu/cpu_other_arm.go | 10 - - .../golang.org/x/sys/cpu/cpu_other_arm64.go | 10 - - .../golang.org/x/sys/cpu/cpu_other_mips64x.go | 13 - - .../golang.org/x/sys/cpu/cpu_other_ppc64x.go | 15 - - .../golang.org/x/sys/cpu/cpu_other_riscv64.go | 12 - - vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 17 - - vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 12 - + vendor/golang.org/x/sys/cpu/cpu_other_arm.go | 9 - + .../golang.org/x/sys/cpu/cpu_other_arm64.go | 9 - + .../golang.org/x/sys/cpu/cpu_other_mips64x.go | 11 - + .../golang.org/x/sys/cpu/cpu_other_ppc64x.go | 12 - + .../golang.org/x/sys/cpu/cpu_other_riscv64.go | 11 - + vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 16 - + vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 11 - vendor/golang.org/x/sys/cpu/cpu_s390x.go | 172 ----------- - vendor/golang.org/x/sys/cpu/cpu_s390x.s | 58 ---- - vendor/golang.org/x/sys/cpu/cpu_wasm.go | 18 -- - vendor/golang.org/x/sys/cpu/cpu_x86.go | 152 --------- - vendor/golang.org/x/sys/cpu/cpu_x86.s | 28 -- + vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 ---- + vendor/golang.org/x/sys/cpu/cpu_wasm.go | 17 - + vendor/golang.org/x/sys/cpu/cpu_x86.go | 151 --------- + vendor/golang.org/x/sys/cpu/cpu_x86.s | 26 -- vendor/golang.org/x/sys/cpu/cpu_zos.go | 10 - vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go | 25 -- - vendor/golang.org/x/sys/cpu/endian_big.go | 11 - - vendor/golang.org/x/sys/cpu/endian_little.go | 11 - + vendor/golang.org/x/sys/cpu/endian_big.go | 10 - + vendor/golang.org/x/sys/cpu/endian_little.go | 10 - vendor/golang.org/x/sys/cpu/hwcap_linux.go | 71 ----- vendor/golang.org/x/sys/cpu/parse.go | 43 --- - .../x/sys/cpu/proc_cpuinfo_linux.go | 54 ---- + .../x/sys/cpu/proc_cpuinfo_linux.go | 53 ---- vendor/golang.org/x/sys/cpu/runtime_auxv.go | 16 - - .../x/sys/cpu/runtime_auxv_go121.go | 19 -- - .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 -- - .../x/sys/cpu/syscall_aix_ppc64_gc.go | 36 --- + .../x/sys/cpu/runtime_auxv_go121.go | 18 -- + .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 26 -- + .../x/sys/cpu/syscall_aix_ppc64_gc.go | 35 --- vendor/modules.txt | 7 +- - 65 files changed, 54 insertions(+), 2330 deletions(-) + 65 files changed, 55 insertions(+), 2287 deletions(-) rename vendor/github.com/containerd/btrfs/{v2 => }/.gitignore (100%) rename vendor/github.com/containerd/btrfs/{v2 => }/LICENSE (100%) rename vendor/github.com/containerd/btrfs/{v2 => }/Makefile (100%) @@ -143,12 +143,12 @@ Signed-off-by: Aleksa Sarai delete mode 100644 vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go diff --git a/go.mod b/go.mod -index 8fa8e5afc0d5..a0c927917263 100644 +index 8028c97c1b0c..865356aced28 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( - github.com/Microsoft/hcsshim v0.11.4 - github.com/container-orchestrated-devices/container-device-interface v0.5.4 + github.com/Microsoft/go-winio v0.6.2 + github.com/Microsoft/hcsshim v0.11.5 github.com/containerd/aufs v1.0.0 - github.com/containerd/btrfs/v2 v2.0.0 + github.com/containerd/btrfs v1.0.0 @@ -156,17 +156,17 @@ index 8fa8e5afc0d5..a0c927917263 100644 github.com/containerd/console v1.0.3 github.com/containerd/continuity v0.4.2 diff --git a/go.sum b/go.sum -index cd0adb193879..21693007e7bc 100644 +index 4695f33f521e..7a8a8d9f0121 100644 --- a/go.sum +++ b/go.sum -@@ -187,9 +187,8 @@ github.com/containerd/aufs v1.0.0 h1:2oeJiwX5HstO7shSrPZjrohJZLzK36wvpdmzDRkL/LY +@@ -133,8 +133,8 @@ github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9N + github.com/containerd/aufs v1.0.0 h1:2oeJiwX5HstO7shSrPZjrohJZLzK36wvpdmzDRkL/LY= github.com/containerd/aufs v1.0.0/go.mod h1:kL5kd6KM5TzQjR79jljyi4olc1Vrx6XBlcyj3gNv2PU= github.com/containerd/btrfs v0.0.0-20201111183144-404b9149801e/go.mod h1:jg2QkJcsabfHugurUvvPhS3E08Oxiuh5W/g1ybB4e0E= - github.com/containerd/btrfs v0.0.0-20210316141732-918d888fb676/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -+github.com/containerd/btrfs v1.0.0 h1:osn1exbzdub9L5SouXO5swW4ea/xVdJZ3wokxN5GrnA= - github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= -github.com/containerd/btrfs/v2 v2.0.0 h1:FN4wsx7KQrYoLXN7uLP0vBV4oVWHOIKDRQ1G2Z0oL5M= -github.com/containerd/btrfs/v2 v2.0.0/go.mod h1:swkD/7j9HApWpzl8OHfrHNxppPd9l44DFZdF94BUj9k= ++github.com/containerd/btrfs v1.0.0 h1:osn1exbzdub9L5SouXO5swW4ea/xVdJZ3wokxN5GrnA= ++github.com/containerd/btrfs v1.0.0/go.mod h1:zMcX3qkXTAi9GI50+0HOeuV8LU2ryCE/V2vG/ZBiTss= github.com/containerd/cgroups v0.0.0-20190717030353-c4b9ac5c7601/go.mod h1:X9rLEHIqSf/wfK8NsPqxJmeZgW4pcfzdXITDrUSJ6uI= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59/go.mod h1:pA0z1pT8KYB3TCXK/ocprsh7MAkoW8bZVzPdih9snmM= @@ -585,16 +585,15 @@ rename from vendor/github.com/containerd/btrfs/v2/ioctl.go rename to vendor/github.com/containerd/btrfs/ioctl.go diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s deleted file mode 100644 -index db9171c2e491..000000000000 +index 269e173ca469..000000000000 --- a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s +++ /dev/null -@@ -1,18 +0,0 @@ +@@ -1,17 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gc --// +build gc - -#include "textflag.h" - @@ -977,16 +976,15 @@ index 4756ad5f7951..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix.go b/vendor/golang.org/x/sys/cpu/cpu_aix.go deleted file mode 100644 -index 8aaeef545a76..000000000000 +index 9bf0c32eb6ad..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_aix.go +++ /dev/null -@@ -1,34 +0,0 @@ +@@ -1,33 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build aix --// +build aix - -package cpu - @@ -1274,16 +1272,15 @@ index f3eb993bf24b..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/vendor/golang.org/x/sys/cpu/cpu_arm64.s deleted file mode 100644 -index c61f95a05a73..000000000000 +index fcb9a3888205..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ /dev/null -@@ -1,32 +0,0 @@ +@@ -1,31 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gc --// +build gc - -#include "textflag.h" - @@ -1312,16 +1309,15 @@ index c61f95a05a73..000000000000 - RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go deleted file mode 100644 -index ccf542a73da8..000000000000 +index a8acd3e3285d..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ /dev/null -@@ -1,12 +0,0 @@ +@@ -1,11 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gc --// +build gc - -package cpu - @@ -1330,16 +1326,15 @@ index ccf542a73da8..000000000000 -func getpfr0() uint64 diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go deleted file mode 100644 -index 0af2f248412d..000000000000 +index c8ae6ddc156f..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go +++ /dev/null -@@ -1,22 +0,0 @@ +@@ -1,21 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gc --// +build gc - -package cpu - @@ -1358,17 +1353,15 @@ index 0af2f248412d..000000000000 -func klmdQuery() queryResult diff --git a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go deleted file mode 100644 -index fa7cdb9bcd5f..000000000000 +index 910728fb163f..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gc_x86.go +++ /dev/null -@@ -1,17 +0,0 @@ +@@ -1,15 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (386 || amd64 || amd64p32) && gc --// +build 386 amd64 amd64p32 --// +build gc - -package cpu - @@ -1381,16 +1374,15 @@ index fa7cdb9bcd5f..000000000000 -func xgetbv() (eax, edx uint32) diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go deleted file mode 100644 -index 2aff31891162..000000000000 +index 7f1946780bd3..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +++ /dev/null -@@ -1,12 +0,0 @@ +@@ -1,11 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gccgo --// +build gccgo - -package cpu - @@ -1399,16 +1391,15 @@ index 2aff31891162..000000000000 -func getpfr0() uint64 { return 0 } diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go deleted file mode 100644 -index 4bfbda61993d..000000000000 +index 9526d2ce3a95..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_s390x.go +++ /dev/null -@@ -1,23 +0,0 @@ +@@ -1,22 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gccgo --// +build gccgo - -package cpu - @@ -1428,17 +1419,15 @@ index 4bfbda61993d..000000000000 -func klmdQuery() queryResult { panic("not implemented for gccgo") } diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c deleted file mode 100644 -index 6cc73109f595..000000000000 +index 3f73a05dcf32..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c +++ /dev/null -@@ -1,39 +0,0 @@ +@@ -1,37 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (386 || amd64 || amd64p32) && gccgo --// +build 386 amd64 amd64p32 --// +build gccgo - -#include -#include @@ -1473,17 +1462,15 @@ index 6cc73109f595..000000000000 -#pragma GCC pop_options diff --git a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go b/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go deleted file mode 100644 -index 863d415ab498..000000000000 +index 99c60fe9f9c6..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go +++ /dev/null -@@ -1,33 +0,0 @@ +@@ -1,31 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (386 || amd64 || amd64p32) && gccgo --// +build 386 amd64 amd64p32 --// +build gccgo - -package cpu - @@ -1512,16 +1499,15 @@ index 863d415ab498..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux.go b/vendor/golang.org/x/sys/cpu/cpu_linux.go deleted file mode 100644 -index 159a686f6f7a..000000000000 +index 743eb54354b5..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux.go +++ /dev/null -@@ -1,16 +0,0 @@ +@@ -1,15 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !386 && !amd64 && !amd64p32 && !arm64 --// +build !386,!amd64,!amd64p32,!arm64 - -package cpu - @@ -1696,17 +1682,15 @@ index a968b80fa6ab..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go deleted file mode 100644 -index 6000db4cdd1b..000000000000 +index 4686c1d541d8..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_mips64x.go +++ /dev/null -@@ -1,24 +0,0 @@ +@@ -1,22 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux && (mips64 || mips64le) --// +build linux --// +build mips64 mips64le - -package cpu - @@ -1726,33 +1710,30 @@ index 6000db4cdd1b..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go b/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go deleted file mode 100644 -index f4992b1a5938..000000000000 +index cd63e7335573..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_noinit.go +++ /dev/null -@@ -1,10 +0,0 @@ +@@ -1,9 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x --// +build linux,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le,!s390x - -package cpu - -func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go deleted file mode 100644 -index 021356d6deb0..000000000000 +index 197188e67f34..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_linux_ppc64x.go +++ /dev/null -@@ -1,32 +0,0 @@ +@@ -1,30 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux && (ppc64 || ppc64le) --// +build linux --// +build ppc64 ppc64le - -package cpu - @@ -1826,16 +1807,15 @@ index 1517ac61d31b..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_loong64.go b/vendor/golang.org/x/sys/cpu/cpu_loong64.go deleted file mode 100644 -index 0f57b05bdbe5..000000000000 +index 558635850c78..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_loong64.go +++ /dev/null -@@ -1,13 +0,0 @@ +@@ -1,12 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build loong64 --// +build loong64 - -package cpu - @@ -1845,16 +1825,15 @@ index 0f57b05bdbe5..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_mips64x.go deleted file mode 100644 -index f4063c66423b..000000000000 +index fedb00cc4cb9..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_mips64x.go +++ /dev/null -@@ -1,16 +0,0 @@ +@@ -1,15 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build mips64 || mips64le --// +build mips64 mips64le - -package cpu - @@ -1867,16 +1846,15 @@ index f4063c66423b..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go b/vendor/golang.org/x/sys/cpu/cpu_mipsx.go deleted file mode 100644 -index 07c4e36d8f55..000000000000 +index ffb4ec7eb39e..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_mipsx.go +++ /dev/null -@@ -1,12 +0,0 @@ +@@ -1,11 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build mips || mipsle --// +build mips mipsle - -package cpu - @@ -2152,49 +2130,45 @@ index 054ba05d607b..000000000000 -DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm.go deleted file mode 100644 -index d7b4fb4ccc24..000000000000 +index e9ecf2a45674..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm.go +++ /dev/null -@@ -1,10 +0,0 @@ +@@ -1,9 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !linux && arm --// +build !linux,arm - -package cpu - -func archInit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go b/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go deleted file mode 100644 -index f3cde129b634..000000000000 +index 5341e7f88d71..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_other_arm64.go +++ /dev/null -@@ -1,10 +0,0 @@ +@@ -1,9 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !linux && !netbsd && !openbsd && arm64 --// +build !linux,!netbsd,!openbsd,arm64 - -package cpu - -func doinit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go deleted file mode 100644 -index 0dafe9644a5a..000000000000 +index 5f8f2419ab85..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go +++ /dev/null -@@ -1,13 +0,0 @@ +@@ -1,11 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !linux && (mips64 || mips64le) --// +build !linux --// +build mips64 mips64le - -package cpu - @@ -2203,18 +2177,15 @@ index 0dafe9644a5a..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go deleted file mode 100644 -index 060d46b6eacc..000000000000 +index 89608fba2763..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_other_ppc64x.go +++ /dev/null -@@ -1,15 +0,0 @@ +@@ -1,12 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !aix && !linux && (ppc64 || ppc64le) --// +build !aix --// +build !linux --// +build ppc64 ppc64le - -package cpu - @@ -2224,16 +2195,15 @@ index 060d46b6eacc..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go deleted file mode 100644 -index dd10eb79feef..000000000000 +index 5ab87808f710..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_other_riscv64.go +++ /dev/null -@@ -1,12 +0,0 @@ +@@ -1,11 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !linux && riscv64 --// +build !linux,riscv64 - -package cpu - @@ -2242,16 +2212,15 @@ index dd10eb79feef..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go b/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go deleted file mode 100644 -index 4e8acd16583d..000000000000 +index c14f12b14942..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_ppc64x.go +++ /dev/null -@@ -1,17 +0,0 @@ +@@ -1,16 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build ppc64 || ppc64le --// +build ppc64 ppc64le - -package cpu - @@ -2265,16 +2234,15 @@ index 4e8acd16583d..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go b/vendor/golang.org/x/sys/cpu/cpu_riscv64.go deleted file mode 100644 -index ff7da60eb8d7..000000000000 +index 7f0c79c004b4..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_riscv64.go +++ /dev/null -@@ -1,12 +0,0 @@ +@@ -1,11 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build riscv64 --// +build riscv64 - -package cpu - @@ -2461,16 +2429,15 @@ index 5881b8833f5a..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_s390x.s b/vendor/golang.org/x/sys/cpu/cpu_s390x.s deleted file mode 100644 -index 96f81e209717..000000000000 +index 1fb4b701334c..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_s390x.s +++ /dev/null -@@ -1,58 +0,0 @@ +@@ -1,57 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build gc --// +build gc - -#include "textflag.h" - @@ -2525,16 +2492,15 @@ index 96f81e209717..000000000000 - RET diff --git a/vendor/golang.org/x/sys/cpu/cpu_wasm.go b/vendor/golang.org/x/sys/cpu/cpu_wasm.go deleted file mode 100644 -index 7747d888a692..000000000000 +index 384787ea3062..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_wasm.go +++ /dev/null -@@ -1,18 +0,0 @@ +@@ -1,17 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build wasm --// +build wasm - -package cpu - @@ -2549,16 +2515,15 @@ index 7747d888a692..000000000000 -func archInit() {} diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go deleted file mode 100644 -index 2dcde8285d59..000000000000 +index c29f5e4c5a6e..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ /dev/null -@@ -1,152 +0,0 @@ +@@ -1,151 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build 386 || amd64 || amd64p32 --// +build 386 amd64 amd64p32 - -package cpu - @@ -2707,17 +2672,15 @@ index 2dcde8285d59..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.s b/vendor/golang.org/x/sys/cpu/cpu_x86.s deleted file mode 100644 -index 39acab2ff5c2..000000000000 +index 7d7ba33efb85..000000000000 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.s +++ /dev/null -@@ -1,28 +0,0 @@ +@@ -1,26 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (386 || amd64 || amd64p32) && gc --// +build 386 amd64 amd64p32 --// +build gc - -#include "textflag.h" - @@ -2788,16 +2751,15 @@ index ccb1b708aba9..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/endian_big.go b/vendor/golang.org/x/sys/cpu/endian_big.go deleted file mode 100644 -index 93ce03a34605..000000000000 +index 7fe04b0a13b1..000000000000 --- a/vendor/golang.org/x/sys/cpu/endian_big.go +++ /dev/null -@@ -1,11 +0,0 @@ +@@ -1,10 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 --// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 - -package cpu - @@ -2805,16 +2767,15 @@ index 93ce03a34605..000000000000 -const IsBigEndian = true diff --git a/vendor/golang.org/x/sys/cpu/endian_little.go b/vendor/golang.org/x/sys/cpu/endian_little.go deleted file mode 100644 -index 55db853efbec..000000000000 +index 48eccc4c7996..000000000000 --- a/vendor/golang.org/x/sys/cpu/endian_little.go +++ /dev/null -@@ -1,11 +0,0 @@ +@@ -1,10 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm --// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh wasm - -package cpu - @@ -2948,16 +2909,15 @@ index 762b63d6882c..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go b/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go deleted file mode 100644 -index d87bd6b3eb05..000000000000 +index 4cd64c7042bc..000000000000 --- a/vendor/golang.org/x/sys/cpu/proc_cpuinfo_linux.go +++ /dev/null -@@ -1,54 +0,0 @@ +@@ -1,53 +0,0 @@ -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build linux && arm64 --// +build linux,arm64 - -package cpu - @@ -3030,16 +2990,15 @@ index 5f92ac9a2e2b..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go b/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go deleted file mode 100644 -index b975ea2a04ef..000000000000 +index 4c9788ea8ee8..000000000000 --- a/vendor/golang.org/x/sys/cpu/runtime_auxv_go121.go +++ /dev/null -@@ -1,19 +0,0 @@ +@@ -1,18 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.21 --// +build go1.21 - -package cpu - @@ -3055,10 +3014,10 @@ index b975ea2a04ef..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go b/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go deleted file mode 100644 -index 96134157a10d..000000000000 +index 1b9ccb091a57..000000000000 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go +++ /dev/null -@@ -1,27 +0,0 @@ +@@ -1,26 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. @@ -3070,7 +3029,6 @@ index 96134157a10d..000000000000 -// gccgo's libgo and thus must not used a CGo method. - -//go:build aix && gccgo --// +build aix,gccgo - -package cpu - @@ -3088,10 +3046,10 @@ index 96134157a10d..000000000000 -} diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go deleted file mode 100644 -index 904be42ffdce..000000000000 +index e8b6cdbe9a7c..000000000000 --- a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go +++ /dev/null -@@ -1,36 +0,0 @@ +@@ -1,35 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. @@ -3101,7 +3059,6 @@ index 904be42ffdce..000000000000 -// (See golang.org/issue/32102) - -//go:build aix && ppc64 && gc --// +build aix,ppc64,gc - -package cpu - @@ -3129,10 +3086,10 @@ index 904be42ffdce..000000000000 - return -} diff --git a/vendor/modules.txt b/vendor/modules.txt -index fd5a3491d305..764f922ba25c 100644 +index 9d97f2a203b2..937ca9b44ded 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt -@@ -87,9 +87,9 @@ github.com/container-orchestrated-devices/container-device-interface/specs-go +@@ -85,9 +85,9 @@ github.com/cilium/ebpf/link ## explicit; go 1.13 github.com/containerd/aufs github.com/containerd/aufs/plugin @@ -3145,14 +3102,14 @@ index fd5a3491d305..764f922ba25c 100644 # github.com/containerd/cgroups v1.1.0 ## explicit; go 1.17 github.com/containerd/cgroups/stats/v1 -@@ -530,7 +530,6 @@ golang.org/x/sync/errgroup +@@ -532,7 +532,6 @@ golang.org/x/sync/errgroup golang.org/x/sync/semaphore - # golang.org/x/sys v0.13.0 - ## explicit; go 1.17 + # golang.org/x/sys v0.18.0 + ## explicit; go 1.18 -golang.org/x/sys/cpu - golang.org/x/sys/execabs golang.org/x/sys/plan9 golang.org/x/sys/unix + golang.org/x/sys/windows -- -2.43.0 +2.45.1 diff --git a/containerd.changes b/containerd.changes index 52679a3..42b9115 100644 --- a/containerd.changes +++ b/containerd.changes @@ -3,6 +3,8 @@ Wed May 22 19:31:04 UTC 2024 - Aleksa Sarai - Update to containerd v1.7.17. Upstream release notes: +- Rebase patches: + * 0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch - Update to containerd v1.7.16. Upstream release notes: From a89afd5b9cbe8cf00eb5f8791854dbeee6bbdf5110329158472ed9c322f1a16c Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 22 May 2024 21:24:18 +0000 Subject: [PATCH 3/4] Accepting request 1175963 from home:cyphar:docker Fix patch. OBS-URL: https://build.opensuse.org/request/show/1175963 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=177 --- ...rt-btrfs-depend-on-kernel-UAPI-inste.patch | 2473 ++++++++++++++--- 1 file changed, 2111 insertions(+), 362 deletions(-) diff --git a/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch b/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch index 13ab77e..61700a6 100644 --- a/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch +++ b/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch @@ -17,43 +17,54 @@ Signed-off-by: Aleksa Sarai go.mod | 2 +- go.sum | 4 +- snapshots/btrfs/btrfs.go | 2 +- - .../containerd/btrfs/{v2 => }/.gitignore | 0 - .../containerd/btrfs/{v2 => }/LICENSE | 0 - .../containerd/btrfs/{v2 => }/Makefile | 0 - .../containerd/btrfs/{v2 => }/README.md | 15 - - .../containerd/btrfs/{v2 => }/btrfs.c | 12 +- - .../containerd/btrfs/{v2 => }/btrfs.go | 47 +-- - .../containerd/btrfs/{v2 => }/btrfs.h | 22 +- - .../containerd/btrfs/{v2 => }/doc.go | 0 - .../containerd/btrfs/{v2 => }/helpers.go | 29 +- - .../containerd/btrfs/{v2 => }/info.go | 0 - .../containerd/btrfs/{v2 => }/ioctl.go | 0 + vendor/github.com/containerd/btrfs/.gitignore | 28 ++ + vendor/github.com/containerd/btrfs/LICENSE | 201 +++++++++ + vendor/github.com/containerd/btrfs/Makefile | 34 ++ + vendor/github.com/containerd/btrfs/README.md | 46 ++ + vendor/github.com/containerd/btrfs/btrfs.c | 33 ++ + vendor/github.com/containerd/btrfs/btrfs.go | 412 ++++++++++++++++++ + vendor/github.com/containerd/btrfs/btrfs.h | 37 ++ + vendor/github.com/containerd/btrfs/doc.go | 18 + + vendor/github.com/containerd/btrfs/helpers.go | 102 +++++ + vendor/github.com/containerd/btrfs/info.go | 45 ++ + vendor/github.com/containerd/btrfs/ioctl.go | 27 ++ + .../github.com/containerd/btrfs/v2/.gitignore | 28 -- + vendor/github.com/containerd/btrfs/v2/LICENSE | 201 --------- + .../github.com/containerd/btrfs/v2/Makefile | 34 -- + .../github.com/containerd/btrfs/v2/README.md | 61 --- + vendor/github.com/containerd/btrfs/v2/btrfs.c | 29 -- + .../github.com/containerd/btrfs/v2/btrfs.go | 411 ----------------- + vendor/github.com/containerd/btrfs/v2/btrfs.h | 39 -- + vendor/github.com/containerd/btrfs/v2/doc.go | 18 - + .../github.com/containerd/btrfs/v2/helpers.go | 119 ----- + vendor/github.com/containerd/btrfs/v2/info.go | 45 -- + .../github.com/containerd/btrfs/v2/ioctl.go | 27 -- vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 17 - - vendor/golang.org/x/sys/cpu/byteorder.go | 66 ---- - vendor/golang.org/x/sys/cpu/cpu.go | 290 ------------------ + vendor/golang.org/x/sys/cpu/byteorder.go | 66 --- + vendor/golang.org/x/sys/cpu/cpu.go | 290 ------------ vendor/golang.org/x/sys/cpu/cpu_aix.go | 33 -- - vendor/golang.org/x/sys/cpu/cpu_arm.go | 73 ----- - vendor/golang.org/x/sys/cpu/cpu_arm64.go | 172 ----------- + vendor/golang.org/x/sys/cpu/cpu_arm.go | 73 ---- + vendor/golang.org/x/sys/cpu/cpu_arm64.go | 172 -------- vendor/golang.org/x/sys/cpu/cpu_arm64.s | 31 -- vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 11 - - vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 -- + vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 - vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 15 - .../golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 11 - - .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 -- - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 37 --- + .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 - + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 37 -- vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 31 -- vendor/golang.org/x/sys/cpu/cpu_linux.go | 15 - - vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 --- - .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 111 ------- - .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 22 -- + vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 -- + .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 111 ----- + .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 22 - .../golang.org/x/sys/cpu/cpu_linux_noinit.go | 9 - .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 30 -- - .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 40 --- + .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 40 -- vendor/golang.org/x/sys/cpu/cpu_loong64.go | 12 - vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 15 - vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 11 - - .../golang.org/x/sys/cpu/cpu_netbsd_arm64.go | 173 ----------- - .../golang.org/x/sys/cpu/cpu_openbsd_arm64.go | 65 ---- + .../golang.org/x/sys/cpu/cpu_netbsd_arm64.go | 173 -------- + .../golang.org/x/sys/cpu/cpu_openbsd_arm64.go | 65 --- .../golang.org/x/sys/cpu/cpu_openbsd_arm64.s | 11 - vendor/golang.org/x/sys/cpu/cpu_other_arm.go | 9 - .../golang.org/x/sys/cpu/cpu_other_arm64.go | 9 - @@ -62,35 +73,46 @@ Signed-off-by: Aleksa Sarai .../golang.org/x/sys/cpu/cpu_other_riscv64.go | 11 - vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 16 - vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 11 - - vendor/golang.org/x/sys/cpu/cpu_s390x.go | 172 ----------- - vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 ---- + vendor/golang.org/x/sys/cpu/cpu_s390x.go | 172 -------- + vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 --- vendor/golang.org/x/sys/cpu/cpu_wasm.go | 17 - - vendor/golang.org/x/sys/cpu/cpu_x86.go | 151 --------- + vendor/golang.org/x/sys/cpu/cpu_x86.go | 151 ------- vendor/golang.org/x/sys/cpu/cpu_x86.s | 26 -- vendor/golang.org/x/sys/cpu/cpu_zos.go | 10 - vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go | 25 -- vendor/golang.org/x/sys/cpu/endian_big.go | 10 - vendor/golang.org/x/sys/cpu/endian_little.go | 10 - - vendor/golang.org/x/sys/cpu/hwcap_linux.go | 71 ----- - vendor/golang.org/x/sys/cpu/parse.go | 43 --- - .../x/sys/cpu/proc_cpuinfo_linux.go | 53 ---- + vendor/golang.org/x/sys/cpu/hwcap_linux.go | 71 --- + vendor/golang.org/x/sys/cpu/parse.go | 43 -- + .../x/sys/cpu/proc_cpuinfo_linux.go | 53 --- vendor/golang.org/x/sys/cpu/runtime_auxv.go | 16 - - .../x/sys/cpu/runtime_auxv_go121.go | 18 -- + .../x/sys/cpu/runtime_auxv_go121.go | 18 - .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 26 -- - .../x/sys/cpu/syscall_aix_ppc64_gc.go | 35 --- + .../x/sys/cpu/syscall_aix_ppc64_gc.go | 35 -- vendor/modules.txt | 7 +- - 65 files changed, 55 insertions(+), 2287 deletions(-) - rename vendor/github.com/containerd/btrfs/{v2 => }/.gitignore (100%) - rename vendor/github.com/containerd/btrfs/{v2 => }/LICENSE (100%) - rename vendor/github.com/containerd/btrfs/{v2 => }/Makefile (100%) - rename vendor/github.com/containerd/btrfs/{v2 => }/README.md (81%) - rename vendor/github.com/containerd/btrfs/{v2 => }/btrfs.c (82%) - rename vendor/github.com/containerd/btrfs/{v2 => }/btrfs.go (88%) - rename vendor/github.com/containerd/btrfs/{v2 => }/btrfs.h (71%) - rename vendor/github.com/containerd/btrfs/{v2 => }/doc.go (100%) - rename vendor/github.com/containerd/btrfs/{v2 => }/helpers.go (76%) - rename vendor/github.com/containerd/btrfs/{v2 => }/info.go (100%) - rename vendor/github.com/containerd/btrfs/{v2 => }/ioctl.go (100%) + 76 files changed, 990 insertions(+), 3222 deletions(-) + create mode 100644 vendor/github.com/containerd/btrfs/.gitignore + create mode 100644 vendor/github.com/containerd/btrfs/LICENSE + create mode 100644 vendor/github.com/containerd/btrfs/Makefile + create mode 100644 vendor/github.com/containerd/btrfs/README.md + create mode 100644 vendor/github.com/containerd/btrfs/btrfs.c + create mode 100644 vendor/github.com/containerd/btrfs/btrfs.go + create mode 100644 vendor/github.com/containerd/btrfs/btrfs.h + create mode 100644 vendor/github.com/containerd/btrfs/doc.go + create mode 100644 vendor/github.com/containerd/btrfs/helpers.go + create mode 100644 vendor/github.com/containerd/btrfs/info.go + create mode 100644 vendor/github.com/containerd/btrfs/ioctl.go + delete mode 100644 vendor/github.com/containerd/btrfs/v2/.gitignore + delete mode 100644 vendor/github.com/containerd/btrfs/v2/LICENSE + delete mode 100644 vendor/github.com/containerd/btrfs/v2/Makefile + delete mode 100644 vendor/github.com/containerd/btrfs/v2/README.md + delete mode 100644 vendor/github.com/containerd/btrfs/v2/btrfs.c + delete mode 100644 vendor/github.com/containerd/btrfs/v2/btrfs.go + delete mode 100644 vendor/github.com/containerd/btrfs/v2/btrfs.h + delete mode 100644 vendor/github.com/containerd/btrfs/v2/doc.go + delete mode 100644 vendor/github.com/containerd/btrfs/v2/helpers.go + delete mode 100644 vendor/github.com/containerd/btrfs/v2/info.go + delete mode 100644 vendor/github.com/containerd/btrfs/v2/ioctl.go delete mode 100644 vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s delete mode 100644 vendor/golang.org/x/sys/cpu/byteorder.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu.go @@ -183,29 +205,1355 @@ index a6a41e68e3cd..5cef986b5e7b 100644 "github.com/containerd/continuity/fs" "github.com/containerd/containerd/log" -diff --git a/vendor/github.com/containerd/btrfs/v2/.gitignore b/vendor/github.com/containerd/btrfs/.gitignore -similarity index 100% -rename from vendor/github.com/containerd/btrfs/v2/.gitignore -rename to vendor/github.com/containerd/btrfs/.gitignore -diff --git a/vendor/github.com/containerd/btrfs/v2/LICENSE b/vendor/github.com/containerd/btrfs/LICENSE -similarity index 100% -rename from vendor/github.com/containerd/btrfs/v2/LICENSE -rename to vendor/github.com/containerd/btrfs/LICENSE -diff --git a/vendor/github.com/containerd/btrfs/v2/Makefile b/vendor/github.com/containerd/btrfs/Makefile -similarity index 100% -rename from vendor/github.com/containerd/btrfs/v2/Makefile -rename to vendor/github.com/containerd/btrfs/Makefile -diff --git a/vendor/github.com/containerd/btrfs/v2/README.md b/vendor/github.com/containerd/btrfs/README.md -similarity index 81% -rename from vendor/github.com/containerd/btrfs/v2/README.md -rename to vendor/github.com/containerd/btrfs/README.md -index abdac2ad1baa..505f39b12156 100644 ---- a/vendor/github.com/containerd/btrfs/v2/README.md +diff --git a/vendor/github.com/containerd/btrfs/.gitignore b/vendor/github.com/containerd/btrfs/.gitignore +new file mode 100644 +index 000000000000..9b781b52b966 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/.gitignore +@@ -0,0 +1,28 @@ ++# Compiled Object files, Static and Dynamic libs (Shared Objects) ++*.o ++*.a ++*.so ++bin/ ++ ++# Folders ++_obj ++_test ++ ++# Architecture specific extensions/prefixes ++*.[568vq] ++[568vq].out ++ ++*.cgo1.go ++*.cgo2.c ++_cgo_defun.c ++_cgo_gotypes.go ++_cgo_export.* ++ ++_testmain.go ++ ++*.exe ++*.test ++*.prof ++ ++# Support running go modules in vendor mode for local development ++/vendor/ +diff --git a/vendor/github.com/containerd/btrfs/LICENSE b/vendor/github.com/containerd/btrfs/LICENSE +new file mode 100644 +index 000000000000..8dada3edaf50 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/LICENSE +@@ -0,0 +1,201 @@ ++ Apache License ++ Version 2.0, January 2004 ++ http://www.apache.org/licenses/ ++ ++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION ++ ++ 1. Definitions. ++ ++ "License" shall mean the terms and conditions for use, reproduction, ++ and distribution as defined by Sections 1 through 9 of this document. ++ ++ "Licensor" shall mean the copyright owner or entity authorized by ++ the copyright owner that is granting the License. ++ ++ "Legal Entity" shall mean the union of the acting entity and all ++ other entities that control, are controlled by, or are under common ++ control with that entity. For the purposes of this definition, ++ "control" means (i) the power, direct or indirect, to cause the ++ direction or management of such entity, whether by contract or ++ otherwise, or (ii) ownership of fifty percent (50%) or more of the ++ outstanding shares, or (iii) beneficial ownership of such entity. ++ ++ "You" (or "Your") shall mean an individual or Legal Entity ++ exercising permissions granted by this License. ++ ++ "Source" form shall mean the preferred form for making modifications, ++ including but not limited to software source code, documentation ++ source, and configuration files. ++ ++ "Object" form shall mean any form resulting from mechanical ++ transformation or translation of a Source form, including but ++ not limited to compiled object code, generated documentation, ++ and conversions to other media types. ++ ++ "Work" shall mean the work of authorship, whether in Source or ++ Object form, made available under the License, as indicated by a ++ copyright notice that is included in or attached to the work ++ (an example is provided in the Appendix below). ++ ++ "Derivative Works" shall mean any work, whether in Source or Object ++ form, that is based on (or derived from) the Work and for which the ++ editorial revisions, annotations, elaborations, or other modifications ++ represent, as a whole, an original work of authorship. For the purposes ++ of this License, Derivative Works shall not include works that remain ++ separable from, or merely link (or bind by name) to the interfaces of, ++ the Work and Derivative Works thereof. ++ ++ "Contribution" shall mean any work of authorship, including ++ the original version of the Work and any modifications or additions ++ to that Work or Derivative Works thereof, that is intentionally ++ submitted to Licensor for inclusion in the Work by the copyright owner ++ or by an individual or Legal Entity authorized to submit on behalf of ++ the copyright owner. For the purposes of this definition, "submitted" ++ means any form of electronic, verbal, or written communication sent ++ to the Licensor or its representatives, including but not limited to ++ communication on electronic mailing lists, source code control systems, ++ and issue tracking systems that are managed by, or on behalf of, the ++ Licensor for the purpose of discussing and improving the Work, but ++ excluding communication that is conspicuously marked or otherwise ++ designated in writing by the copyright owner as "Not a Contribution." ++ ++ "Contributor" shall mean Licensor and any individual or Legal Entity ++ on behalf of whom a Contribution has been received by Licensor and ++ subsequently incorporated within the Work. ++ ++ 2. Grant of Copyright License. Subject to the terms and conditions of ++ this License, each Contributor hereby grants to You a perpetual, ++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable ++ copyright license to reproduce, prepare Derivative Works of, ++ publicly display, publicly perform, sublicense, and distribute the ++ Work and such Derivative Works in Source or Object form. ++ ++ 3. Grant of Patent License. Subject to the terms and conditions of ++ this License, each Contributor hereby grants to You a perpetual, ++ worldwide, non-exclusive, no-charge, royalty-free, irrevocable ++ (except as stated in this section) patent license to make, have made, ++ use, offer to sell, sell, import, and otherwise transfer the Work, ++ where such license applies only to those patent claims licensable ++ by such Contributor that are necessarily infringed by their ++ Contribution(s) alone or by combination of their Contribution(s) ++ with the Work to which such Contribution(s) was submitted. If You ++ institute patent litigation against any entity (including a ++ cross-claim or counterclaim in a lawsuit) alleging that the Work ++ or a Contribution incorporated within the Work constitutes direct ++ or contributory patent infringement, then any patent licenses ++ granted to You under this License for that Work shall terminate ++ as of the date such litigation is filed. ++ ++ 4. Redistribution. You may reproduce and distribute copies of the ++ Work or Derivative Works thereof in any medium, with or without ++ modifications, and in Source or Object form, provided that You ++ meet the following conditions: ++ ++ (a) You must give any other recipients of the Work or ++ Derivative Works a copy of this License; and ++ ++ (b) You must cause any modified files to carry prominent notices ++ stating that You changed the files; and ++ ++ (c) You must retain, in the Source form of any Derivative Works ++ that You distribute, all copyright, patent, trademark, and ++ attribution notices from the Source form of the Work, ++ excluding those notices that do not pertain to any part of ++ the Derivative Works; and ++ ++ (d) If the Work includes a "NOTICE" text file as part of its ++ distribution, then any Derivative Works that You distribute must ++ include a readable copy of the attribution notices contained ++ within such NOTICE file, excluding those notices that do not ++ pertain to any part of the Derivative Works, in at least one ++ of the following places: within a NOTICE text file distributed ++ as part of the Derivative Works; within the Source form or ++ documentation, if provided along with the Derivative Works; or, ++ within a display generated by the Derivative Works, if and ++ wherever such third-party notices normally appear. The contents ++ of the NOTICE file are for informational purposes only and ++ do not modify the License. You may add Your own attribution ++ notices within Derivative Works that You distribute, alongside ++ or as an addendum to the NOTICE text from the Work, provided ++ that such additional attribution notices cannot be construed ++ as modifying the License. ++ ++ You may add Your own copyright statement to Your modifications and ++ may provide additional or different license terms and conditions ++ for use, reproduction, or distribution of Your modifications, or ++ for any such Derivative Works as a whole, provided Your use, ++ reproduction, and distribution of the Work otherwise complies with ++ the conditions stated in this License. ++ ++ 5. Submission of Contributions. Unless You explicitly state otherwise, ++ any Contribution intentionally submitted for inclusion in the Work ++ by You to the Licensor shall be under the terms and conditions of ++ this License, without any additional terms or conditions. ++ Notwithstanding the above, nothing herein shall supersede or modify ++ the terms of any separate license agreement you may have executed ++ with Licensor regarding such Contributions. ++ ++ 6. Trademarks. This License does not grant permission to use the trade ++ names, trademarks, service marks, or product names of the Licensor, ++ except as required for reasonable and customary use in describing the ++ origin of the Work and reproducing the content of the NOTICE file. ++ ++ 7. Disclaimer of Warranty. Unless required by applicable law or ++ agreed to in writing, Licensor provides the Work (and each ++ Contributor provides its Contributions) on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ++ implied, including, without limitation, any warranties or conditions ++ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A ++ PARTICULAR PURPOSE. You are solely responsible for determining the ++ appropriateness of using or redistributing the Work and assume any ++ risks associated with Your exercise of permissions under this License. ++ ++ 8. Limitation of Liability. In no event and under no legal theory, ++ whether in tort (including negligence), contract, or otherwise, ++ unless required by applicable law (such as deliberate and grossly ++ negligent acts) or agreed to in writing, shall any Contributor be ++ liable to You for damages, including any direct, indirect, special, ++ incidental, or consequential damages of any character arising as a ++ result of this License or out of the use or inability to use the ++ Work (including but not limited to damages for loss of goodwill, ++ work stoppage, computer failure or malfunction, or any and all ++ other commercial damages or losses), even if such Contributor ++ has been advised of the possibility of such damages. ++ ++ 9. Accepting Warranty or Additional Liability. While redistributing ++ the Work or Derivative Works thereof, You may choose to offer, ++ and charge a fee for, acceptance of support, warranty, indemnity, ++ or other liability obligations and/or rights consistent with this ++ License. However, in accepting such obligations, You may act only ++ on Your own behalf and on Your sole responsibility, not on behalf ++ of any other Contributor, and only if You agree to indemnify, ++ defend, and hold each Contributor harmless for any liability ++ incurred by, or claims asserted against, such Contributor by reason ++ of your accepting any such warranty or additional liability. ++ ++ END OF TERMS AND CONDITIONS ++ ++ APPENDIX: How to apply the Apache License to your work. ++ ++ To apply the Apache License to your work, attach the following ++ boilerplate notice, with the fields enclosed by brackets "{}" ++ replaced with your own identifying information. (Don't include ++ the brackets!) The text should be enclosed in the appropriate ++ comment syntax for the file format. We also recommend that a ++ file or class name and description of purpose be included on the ++ same "printed page" as the copyright notice for easier ++ identification within third-party archives. ++ ++ Copyright {yyyy} {name of copyright owner} ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. +diff --git a/vendor/github.com/containerd/btrfs/Makefile b/vendor/github.com/containerd/btrfs/Makefile +new file mode 100644 +index 000000000000..e89dd46ad1b9 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/Makefile +@@ -0,0 +1,34 @@ ++# Copyright The containerd Authors. ++ ++# Licensed under the Apache License, Version 2.0 (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++ ++# http://www.apache.org/licenses/LICENSE-2.0 ++ ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ ++ ++.PHONY: clean binaries generate lint vet test ++all: vet lint test binaries ++ ++binaries: bin/btrfs-test ++ ++vet: ++ go vet ./... ++ ++lint: ++ golint ./... ++ ++test: ++ go test -v ./... ++ ++bin/%: ./cmd/% *.go ++ go build -o ./$@ ./$< ++ ++clean: ++ rm -rf bin/* +diff --git a/vendor/github.com/containerd/btrfs/README.md b/vendor/github.com/containerd/btrfs/README.md +new file mode 100644 +index 000000000000..505f39b12156 +--- /dev/null +++ b/vendor/github.com/containerd/btrfs/README.md -@@ -11,21 +11,6 @@ Native Go bindings for btrfs. - These are in the early stages. We will try to maintain stability, but please - vendor if you are relying on these directly. - +@@ -0,0 +1,46 @@ ++# go-btrfs ++ ++[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/btrfs)](https://pkg.go.dev/github.com/containerd/btrfs) ++[![Build Status](https://github.com/containerd/btrfs/workflows/CI/badge.svg)](https://github.com/containerd/btrfs/actions?query=workflow%3ACI) ++[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/btrfs)](https://goreportcard.com/report/github.com/containerd/btrfs) ++ ++Native Go bindings for btrfs. ++ ++# Status ++ ++These are in the early stages. We will try to maintain stability, but please ++vendor if you are relying on these directly. ++ ++# Contribute ++ ++This package may not cover all the use cases for btrfs. If something you need ++is missing, please don't hesitate to submit a PR. ++ ++Note that due to struct alignment issues, this isn't yet fully native. ++Preferably, this could be resolved, so contributions in this direction are ++greatly appreciated. ++ ++## Applying License Header to New Files ++ ++If you submit a contribution that adds a new file, please add the license ++header. You can do so manually or use the `ltag` tool: ++ ++ ++```console ++$ go get github.com/kunalkushwaha/ltag ++$ ltag -t ./license-templates ++``` ++ ++The above will add the appropriate licenses to Go files. New templates will ++need to be added if other kinds of files are added. Please consult the ++documentation at https://github.com/kunalkushwaha/ltag ++ ++## Project details ++ ++btrfs is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). ++As a containerd sub-project, you will find the: ++ * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md), ++ * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS), ++ * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md) ++ ++information in our [`containerd/project`](https://github.com/containerd/project) repository. +diff --git a/vendor/github.com/containerd/btrfs/btrfs.c b/vendor/github.com/containerd/btrfs/btrfs.c +new file mode 100644 +index 000000000000..f0da012f080e +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/btrfs.c +@@ -0,0 +1,33 @@ ++/* ++ Copyright The containerd Authors ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++#include ++#include ++#include ++#include ++ ++#include "btrfs.h" ++ ++void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src) { ++ memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); ++ memcpy(dst->parent_uuid, src->parent_uuid, BTRFS_UUID_SIZE); ++ memcpy(dst->received_uuid, src->received_uuid, BTRFS_UUID_SIZE); ++ dst->gen = btrfs_root_generation(src); ++ dst->ogen = btrfs_root_otransid(src); ++ dst->flags = btrfs_root_flags(src); ++} ++ ++/* unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src) { */ +diff --git a/vendor/github.com/containerd/btrfs/btrfs.go b/vendor/github.com/containerd/btrfs/btrfs.go +new file mode 100644 +index 000000000000..f9c30b3dd517 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/btrfs.go +@@ -0,0 +1,412 @@ ++/* ++ Copyright The containerd Authors. ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++package btrfs ++ ++/* ++#include ++#include ++#include "btrfs.h" ++ ++static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { ++ return btrfs_struct->name; ++} ++*/ ++import "C" ++ ++import ( ++ "os" ++ "path/filepath" ++ "sort" ++ "syscall" ++ "unsafe" ++ ++ "github.com/pkg/errors" ++) ++ ++// maxByteSliceSize is the smallest size that Go supports on various platforms. ++// On mipsle, 1<<31-1 overflows the address space. ++const maxByteSliceSize = 1 << 30 ++ ++// IsSubvolume returns nil if the path is a valid subvolume. An error is ++// returned if the path does not exist or the path is not a valid subvolume. ++func IsSubvolume(path string) error { ++ fi, err := os.Lstat(path) ++ if err != nil { ++ return err ++ } ++ ++ if err := isFileInfoSubvol(fi); err != nil { ++ return err ++ } ++ ++ var statfs syscall.Statfs_t ++ if err := syscall.Statfs(path, &statfs); err != nil { ++ return err ++ } ++ ++ return isStatfsSubvol(&statfs) ++} ++ ++// SubvolID returns the subvolume ID for the provided path ++func SubvolID(path string) (uint64, error) { ++ fp, err := openSubvolDir(path) ++ if err != nil { ++ return 0, err ++ } ++ defer fp.Close() ++ ++ return subvolID(fp.Fd()) ++} ++ ++// SubvolInfo returns information about the subvolume at the provided path. ++func SubvolInfo(path string) (info Info, err error) { ++ path, err = filepath.EvalSymlinks(path) ++ if err != nil { ++ return info, err ++ } ++ ++ fp, err := openSubvolDir(path) ++ if err != nil { ++ return info, err ++ } ++ defer fp.Close() ++ ++ id, err := subvolID(fp.Fd()) ++ if err != nil { ++ return info, err ++ } ++ ++ subvolsByID, err := subvolMap(path) ++ if err != nil { ++ return info, err ++ } ++ ++ if info, ok := subvolsByID[id]; ok { ++ return *info, nil ++ } ++ ++ return info, errors.Errorf("%q not found", path) ++} ++ ++func subvolMap(path string) (map[uint64]*Info, error) { ++ fp, err := openSubvolDir(path) ++ if err != nil { ++ return nil, err ++ } ++ defer fp.Close() ++ ++ var args C.struct_btrfs_ioctl_search_args ++ ++ args.key.tree_id = C.BTRFS_ROOT_TREE_OBJECTID ++ args.key.min_type = C.BTRFS_ROOT_ITEM_KEY ++ args.key.max_type = C.BTRFS_ROOT_BACKREF_KEY ++ args.key.min_objectid = C.BTRFS_FS_TREE_OBJECTID ++ args.key.max_objectid = C.BTRFS_LAST_FREE_OBJECTID ++ args.key.max_offset = ^C.__u64(0) ++ args.key.max_transid = ^C.__u64(0) ++ ++ subvolsByID := make(map[uint64]*Info) ++ ++ for { ++ args.key.nr_items = 4096 ++ if err := ioctl(fp.Fd(), C.BTRFS_IOC_TREE_SEARCH, uintptr(unsafe.Pointer(&args))); err != nil { ++ return nil, err ++ } ++ ++ if args.key.nr_items == 0 { ++ break ++ } ++ ++ var ( ++ sh C.struct_btrfs_ioctl_search_header ++ shSize = unsafe.Sizeof(sh) ++ buf = (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.buf[0]))[:C.BTRFS_SEARCH_ARGS_BUFSIZE] ++ ) ++ ++ for i := 0; i < int(args.key.nr_items); i++ { ++ sh = (*(*C.struct_btrfs_ioctl_search_header)(unsafe.Pointer(&buf[0]))) ++ buf = buf[shSize:] ++ ++ info := subvolsByID[uint64(sh.objectid)] ++ if info == nil { ++ info = &Info{} ++ } ++ info.ID = uint64(sh.objectid) ++ ++ if sh._type == C.BTRFS_ROOT_BACKREF_KEY { ++ rr := (*(*C.struct_btrfs_root_ref)(unsafe.Pointer(&buf[0]))) ++ ++ // This branch processes the backrefs from the root object. We ++ // get an entry of the objectid, with name, but the parent is ++ // the offset. ++ ++ nname := C.btrfs_stack_root_ref_name_len(&rr) ++ name := string(buf[C.sizeof_struct_btrfs_root_ref : C.sizeof_struct_btrfs_root_ref+uintptr(nname)]) ++ ++ info.ID = uint64(sh.objectid) ++ info.ParentID = uint64(sh.offset) ++ info.Name = name ++ info.DirID = uint64(C.btrfs_stack_root_ref_dirid(&rr)) ++ ++ subvolsByID[uint64(sh.objectid)] = info ++ } else if sh._type == C.BTRFS_ROOT_ITEM_KEY && ++ (sh.objectid >= C.BTRFS_ROOT_ITEM_KEY || ++ sh.objectid == C.BTRFS_FS_TREE_OBJECTID) { ++ ++ var ( ++ ri = (*C.struct_btrfs_root_item)(unsafe.Pointer(&buf[0])) ++ gri C.struct_gosafe_btrfs_root_item ++ ) ++ ++ C.unpack_root_item(&gri, ri) ++ ++ if gri.flags&C.BTRFS_ROOT_SUBVOL_RDONLY != 0 { ++ info.Readonly = true ++ } ++ ++ // in this case, the offset is the actual offset. ++ info.Offset = uint64(sh.offset) ++ ++ info.UUID = uuidString(&gri.uuid) ++ info.ParentUUID = uuidString(&gri.parent_uuid) ++ info.ReceivedUUID = uuidString(&gri.received_uuid) ++ ++ info.Generation = uint64(gri.gen) ++ info.OriginalGeneration = uint64(gri.ogen) ++ ++ subvolsByID[uint64(sh.objectid)] = info ++ } ++ ++ args.key.min_objectid = sh.objectid ++ args.key.min_offset = sh.offset ++ args.key.min_type = sh._type // this is very questionable. ++ ++ buf = buf[sh.len:] ++ } ++ ++ args.key.min_offset++ ++ if args.key.min_offset == 0 { ++ args.key.min_type++ ++ } else { ++ continue ++ } ++ ++ if args.key.min_type > C.BTRFS_ROOT_BACKREF_KEY { ++ args.key.min_type = C.BTRFS_ROOT_ITEM_KEY ++ args.key.min_objectid++ ++ } else { ++ continue ++ } ++ ++ if args.key.min_objectid > args.key.max_objectid { ++ break ++ } ++ } ++ ++ mnt, err := findMountPoint(path) ++ if err != nil { ++ return nil, err ++ } ++ ++ for _, sv := range subvolsByID { ++ path := sv.Name ++ parentID := sv.ParentID ++ ++ for parentID != 0 { ++ parent, ok := subvolsByID[parentID] ++ if !ok { ++ break ++ } ++ ++ parentID = parent.ParentID ++ path = filepath.Join(parent.Name, path) ++ } ++ ++ sv.Path = filepath.Join(mnt, path) ++ } ++ return subvolsByID, nil ++} ++ ++// SubvolList will return the information for all subvolumes corresponding to ++// the provided path. ++func SubvolList(path string) ([]Info, error) { ++ subvolsByID, err := subvolMap(path) ++ if err != nil { ++ return nil, err ++ } ++ ++ subvols := make([]Info, 0, len(subvolsByID)) ++ for _, sv := range subvolsByID { ++ subvols = append(subvols, *sv) ++ } ++ ++ sort.Sort(infosByID(subvols)) ++ ++ return subvols, nil ++} ++ ++// SubvolCreate creates a subvolume at the provided path. ++func SubvolCreate(path string) error { ++ dir, name := filepath.Split(path) ++ ++ fp, err := os.Open(dir) ++ if err != nil { ++ return err ++ } ++ defer fp.Close() ++ ++ var args C.struct_btrfs_ioctl_vol_args ++ args.fd = C.__s64(fp.Fd()) ++ ++ if len(name) > C.BTRFS_PATH_NAME_MAX { ++ return errors.Errorf("%q too long for subvolume", name) ++ } ++ nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX] ++ copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name)) ++ ++ if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil { ++ return errors.Wrap(err, "btrfs subvolume create failed") ++ } ++ ++ return nil ++} ++ ++// SubvolSnapshot creates a snapshot in dst from src. If readonly is true, the ++// snapshot will be readonly. ++func SubvolSnapshot(dst, src string, readonly bool) error { ++ dstdir, dstname := filepath.Split(dst) ++ ++ dstfp, err := openSubvolDir(dstdir) ++ if err != nil { ++ return errors.Wrapf(err, "opening snapshot destination subvolume failed") ++ } ++ defer dstfp.Close() ++ ++ srcfp, err := openSubvolDir(src) ++ if err != nil { ++ return errors.Wrapf(err, "opening snapshot source subvolume failed") ++ } ++ defer srcfp.Close() ++ ++ // dstdir is the ioctl arg, wile srcdir gets set on the args ++ var args C.struct_btrfs_ioctl_vol_args_v2 ++ args.fd = C.__s64(srcfp.Fd()) ++ name := C.get_name_btrfs_ioctl_vol_args_v2(&args) ++ ++ if len(dstname) > C.BTRFS_SUBVOL_NAME_MAX { ++ return errors.Errorf("%q too long for subvolume", dstname) ++ } ++ ++ nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] ++ copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(dstname)) ++ ++ if readonly { ++ args.flags |= C.BTRFS_SUBVOL_RDONLY ++ } ++ ++ if err := ioctl(dstfp.Fd(), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))); err != nil { ++ return errors.Wrapf(err, "snapshot create failed") ++ } ++ ++ return nil ++} ++ ++// SubvolDelete deletes the subvolumes under the given path. ++func SubvolDelete(path string) error { ++ dir, name := filepath.Split(path) ++ fp, err := openSubvolDir(dir) ++ if err != nil { ++ return errors.Wrapf(err, "failed opening %v", path) ++ } ++ defer fp.Close() ++ ++ // remove child subvolumes ++ if err := filepath.Walk(path, func(p string, fi os.FileInfo, err error) error { ++ if err != nil { ++ if os.IsNotExist(err) || p == path { ++ return nil ++ } ++ ++ return errors.Wrapf(err, "failed walking subvolume %v", p) ++ } ++ ++ if !fi.IsDir() { ++ return nil // just ignore it! ++ } ++ ++ if p == path { ++ return nil ++ } ++ ++ if err := isFileInfoSubvol(fi); err != nil { ++ return nil ++ } ++ ++ if err := SubvolDelete(p); err != nil { ++ return errors.Wrapf(err, "recursive delete of %v failed", p) ++ } ++ ++ return filepath.SkipDir // children get walked by call above. ++ }); err != nil { ++ return err ++ } ++ ++ var args C.struct_btrfs_ioctl_vol_args ++ if len(name) > C.BTRFS_SUBVOL_NAME_MAX { ++ return errors.Errorf("%q too long for subvolume", name) ++ } ++ ++ nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] ++ copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name)) ++ ++ if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil { ++ return errors.Wrapf(err, "failed removing subvolume %v", path) ++ } ++ ++ return nil ++} ++ ++func openSubvolDir(path string) (*os.File, error) { ++ fp, err := os.Open(path) ++ if err != nil { ++ return nil, errors.Wrapf(err, "opening %v as subvolume failed", path) ++ } ++ ++ return fp, nil ++} ++ ++func isStatfsSubvol(statfs *syscall.Statfs_t) error { ++ if int64(statfs.Type) != int64(C.BTRFS_SUPER_MAGIC) { ++ return errors.Errorf("not a btrfs filesystem") ++ } ++ ++ return nil ++} ++ ++func isFileInfoSubvol(fi os.FileInfo) error { ++ if !fi.IsDir() { ++ errors.Errorf("must be a directory") ++ } ++ ++ stat := fi.Sys().(*syscall.Stat_t) ++ ++ if stat.Ino != C.BTRFS_FIRST_FREE_OBJECTID { ++ return errors.Errorf("incorrect inode type") ++ } ++ ++ return nil ++} +diff --git a/vendor/github.com/containerd/btrfs/btrfs.h b/vendor/github.com/containerd/btrfs/btrfs.h +new file mode 100644 +index 000000000000..1ec451ed1b36 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/btrfs.h +@@ -0,0 +1,37 @@ ++/* ++ Copyright The containerd Authors ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++#include ++#include ++#include ++#include ++ ++// unfortunately, we need to define "alignment safe" C structs to populate for ++// packed structs that aren't handled by cgo. Fields will be added here, as ++// needed. ++ ++struct gosafe_btrfs_root_item { ++ u8 uuid[BTRFS_UUID_SIZE]; ++ u8 parent_uuid[BTRFS_UUID_SIZE]; ++ u8 received_uuid[BTRFS_UUID_SIZE]; ++ ++ u64 gen; ++ u64 ogen; ++ u64 flags; ++}; ++ ++void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src); ++/* void unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src); */ +diff --git a/vendor/github.com/containerd/btrfs/doc.go b/vendor/github.com/containerd/btrfs/doc.go +new file mode 100644 +index 000000000000..6aaf2d056cc5 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/doc.go +@@ -0,0 +1,18 @@ ++/* ++ Copyright The containerd Authors. ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++// Package btrfs provides bindings for working with btrfs partitions from Go. ++package btrfs +diff --git a/vendor/github.com/containerd/btrfs/helpers.go b/vendor/github.com/containerd/btrfs/helpers.go +new file mode 100644 +index 000000000000..475f1c60f6a6 +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/helpers.go +@@ -0,0 +1,102 @@ ++/* ++ Copyright The containerd Authors. ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++package btrfs ++ ++/* ++#include ++#include ++#include ++*/ ++import "C" ++ ++import ( ++ "bufio" ++ "bytes" ++ "fmt" ++ "os" ++ "strings" ++ "unsafe" ++ ++ "github.com/pkg/errors" ++) ++ ++func subvolID(fd uintptr) (uint64, error) { ++ var args C.struct_btrfs_ioctl_ino_lookup_args ++ args.objectid = C.BTRFS_FIRST_FREE_OBJECTID ++ ++ if err := ioctl(fd, C.BTRFS_IOC_INO_LOOKUP, uintptr(unsafe.Pointer(&args))); err != nil { ++ return 0, err ++ } ++ ++ return uint64(args.treeid), nil ++} ++ ++var ( ++ zeroArray = [16]byte{} ++ zeros = zeroArray[:] ++) ++ ++func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.u8) string { ++ b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE] ++ ++ if bytes.Equal(b, zeros) { ++ return "" ++ } ++ ++ return fmt.Sprintf("%x-%x-%x-%x-%x", b[:4], b[4:4+2], b[6:6+2], b[8:8+2], b[10:16]) ++} ++ ++func findMountPoint(path string) (string, error) { ++ fp, err := os.Open("/proc/self/mounts") ++ if err != nil { ++ return "", err ++ } ++ defer fp.Close() ++ ++ const ( ++ deviceIdx = 0 ++ pathIdx = 1 ++ typeIdx = 2 ++ options = 3 ++ ) ++ ++ var ( ++ mount string ++ scanner = bufio.NewScanner(fp) ++ ) ++ ++ for scanner.Scan() { ++ fields := strings.Fields(scanner.Text()) ++ if fields[typeIdx] != "btrfs" { ++ continue // skip non-btrfs ++ } ++ ++ if strings.HasPrefix(path, fields[pathIdx]) { ++ mount = fields[pathIdx] ++ } ++ } ++ ++ if scanner.Err() != nil { ++ return "", scanner.Err() ++ } ++ ++ if mount == "" { ++ return "", errors.Errorf("mount point of %v not found", path) ++ } ++ ++ return mount, nil ++} +diff --git a/vendor/github.com/containerd/btrfs/info.go b/vendor/github.com/containerd/btrfs/info.go +new file mode 100644 +index 000000000000..0f96be6b87ae +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/info.go +@@ -0,0 +1,45 @@ ++/* ++ Copyright The containerd Authors. ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++package btrfs ++ ++// Info describes metadata about a btrfs subvolume. ++type Info struct { ++ ID uint64 // subvolume id ++ ParentID uint64 // aka ref_tree ++ TopLevelID uint64 // not actually clear what this is, not set for now. ++ Offset uint64 // key offset for root ++ DirID uint64 ++ ++ Generation uint64 ++ OriginalGeneration uint64 ++ ++ UUID string ++ ParentUUID string ++ ReceivedUUID string ++ ++ Name string ++ Path string // absolute path of subvolume ++ Root string // path of root mount point ++ ++ Readonly bool // true if the snaps hot is readonly, extracted from flags ++} ++ ++type infosByID []Info ++ ++func (b infosByID) Len() int { return len(b) } ++func (b infosByID) Less(i, j int) bool { return b[i].ID < b[j].ID } ++func (b infosByID) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +diff --git a/vendor/github.com/containerd/btrfs/ioctl.go b/vendor/github.com/containerd/btrfs/ioctl.go +new file mode 100644 +index 000000000000..bac1dbdd6c6e +--- /dev/null ++++ b/vendor/github.com/containerd/btrfs/ioctl.go +@@ -0,0 +1,27 @@ ++/* ++ Copyright The containerd Authors. ++ ++ Licensed under the Apache License, Version 2.0 (the "License"); ++ you may not use this file except in compliance with the License. ++ You may obtain a copy of the License at ++ ++ http://www.apache.org/licenses/LICENSE-2.0 ++ ++ Unless required by applicable law or agreed to in writing, software ++ distributed under the License is distributed on an "AS IS" BASIS, ++ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ See the License for the specific language governing permissions and ++ limitations under the License. ++*/ ++ ++package btrfs ++ ++import "syscall" ++ ++func ioctl(fd, request, args uintptr) error { ++ _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, fd, request, args) ++ if errno != 0 { ++ return errno ++ } ++ return nil ++} +diff --git a/vendor/github.com/containerd/btrfs/v2/.gitignore b/vendor/github.com/containerd/btrfs/v2/.gitignore +deleted file mode 100644 +index 9b781b52b966..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/.gitignore ++++ /dev/null +@@ -1,28 +0,0 @@ +-# Compiled Object files, Static and Dynamic libs (Shared Objects) +-*.o +-*.a +-*.so +-bin/ +- +-# Folders +-_obj +-_test +- +-# Architecture specific extensions/prefixes +-*.[568vq] +-[568vq].out +- +-*.cgo1.go +-*.cgo2.c +-_cgo_defun.c +-_cgo_gotypes.go +-_cgo_export.* +- +-_testmain.go +- +-*.exe +-*.test +-*.prof +- +-# Support running go modules in vendor mode for local development +-/vendor/ +diff --git a/vendor/github.com/containerd/btrfs/v2/LICENSE b/vendor/github.com/containerd/btrfs/v2/LICENSE +deleted file mode 100644 +index 8dada3edaf50..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/LICENSE ++++ /dev/null +@@ -1,201 +0,0 @@ +- Apache License +- Version 2.0, January 2004 +- http://www.apache.org/licenses/ +- +- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +- +- 1. Definitions. +- +- "License" shall mean the terms and conditions for use, reproduction, +- and distribution as defined by Sections 1 through 9 of this document. +- +- "Licensor" shall mean the copyright owner or entity authorized by +- the copyright owner that is granting the License. +- +- "Legal Entity" shall mean the union of the acting entity and all +- other entities that control, are controlled by, or are under common +- control with that entity. For the purposes of this definition, +- "control" means (i) the power, direct or indirect, to cause the +- direction or management of such entity, whether by contract or +- otherwise, or (ii) ownership of fifty percent (50%) or more of the +- outstanding shares, or (iii) beneficial ownership of such entity. +- +- "You" (or "Your") shall mean an individual or Legal Entity +- exercising permissions granted by this License. +- +- "Source" form shall mean the preferred form for making modifications, +- including but not limited to software source code, documentation +- source, and configuration files. +- +- "Object" form shall mean any form resulting from mechanical +- transformation or translation of a Source form, including but +- not limited to compiled object code, generated documentation, +- and conversions to other media types. +- +- "Work" shall mean the work of authorship, whether in Source or +- Object form, made available under the License, as indicated by a +- copyright notice that is included in or attached to the work +- (an example is provided in the Appendix below). +- +- "Derivative Works" shall mean any work, whether in Source or Object +- form, that is based on (or derived from) the Work and for which the +- editorial revisions, annotations, elaborations, or other modifications +- represent, as a whole, an original work of authorship. For the purposes +- of this License, Derivative Works shall not include works that remain +- separable from, or merely link (or bind by name) to the interfaces of, +- the Work and Derivative Works thereof. +- +- "Contribution" shall mean any work of authorship, including +- the original version of the Work and any modifications or additions +- to that Work or Derivative Works thereof, that is intentionally +- submitted to Licensor for inclusion in the Work by the copyright owner +- or by an individual or Legal Entity authorized to submit on behalf of +- the copyright owner. For the purposes of this definition, "submitted" +- means any form of electronic, verbal, or written communication sent +- to the Licensor or its representatives, including but not limited to +- communication on electronic mailing lists, source code control systems, +- and issue tracking systems that are managed by, or on behalf of, the +- Licensor for the purpose of discussing and improving the Work, but +- excluding communication that is conspicuously marked or otherwise +- designated in writing by the copyright owner as "Not a Contribution." +- +- "Contributor" shall mean Licensor and any individual or Legal Entity +- on behalf of whom a Contribution has been received by Licensor and +- subsequently incorporated within the Work. +- +- 2. Grant of Copyright License. Subject to the terms and conditions of +- this License, each Contributor hereby grants to You a perpetual, +- worldwide, non-exclusive, no-charge, royalty-free, irrevocable +- copyright license to reproduce, prepare Derivative Works of, +- publicly display, publicly perform, sublicense, and distribute the +- Work and such Derivative Works in Source or Object form. +- +- 3. Grant of Patent License. Subject to the terms and conditions of +- this License, each Contributor hereby grants to You a perpetual, +- worldwide, non-exclusive, no-charge, royalty-free, irrevocable +- (except as stated in this section) patent license to make, have made, +- use, offer to sell, sell, import, and otherwise transfer the Work, +- where such license applies only to those patent claims licensable +- by such Contributor that are necessarily infringed by their +- Contribution(s) alone or by combination of their Contribution(s) +- with the Work to which such Contribution(s) was submitted. If You +- institute patent litigation against any entity (including a +- cross-claim or counterclaim in a lawsuit) alleging that the Work +- or a Contribution incorporated within the Work constitutes direct +- or contributory patent infringement, then any patent licenses +- granted to You under this License for that Work shall terminate +- as of the date such litigation is filed. +- +- 4. Redistribution. You may reproduce and distribute copies of the +- Work or Derivative Works thereof in any medium, with or without +- modifications, and in Source or Object form, provided that You +- meet the following conditions: +- +- (a) You must give any other recipients of the Work or +- Derivative Works a copy of this License; and +- +- (b) You must cause any modified files to carry prominent notices +- stating that You changed the files; and +- +- (c) You must retain, in the Source form of any Derivative Works +- that You distribute, all copyright, patent, trademark, and +- attribution notices from the Source form of the Work, +- excluding those notices that do not pertain to any part of +- the Derivative Works; and +- +- (d) If the Work includes a "NOTICE" text file as part of its +- distribution, then any Derivative Works that You distribute must +- include a readable copy of the attribution notices contained +- within such NOTICE file, excluding those notices that do not +- pertain to any part of the Derivative Works, in at least one +- of the following places: within a NOTICE text file distributed +- as part of the Derivative Works; within the Source form or +- documentation, if provided along with the Derivative Works; or, +- within a display generated by the Derivative Works, if and +- wherever such third-party notices normally appear. The contents +- of the NOTICE file are for informational purposes only and +- do not modify the License. You may add Your own attribution +- notices within Derivative Works that You distribute, alongside +- or as an addendum to the NOTICE text from the Work, provided +- that such additional attribution notices cannot be construed +- as modifying the License. +- +- You may add Your own copyright statement to Your modifications and +- may provide additional or different license terms and conditions +- for use, reproduction, or distribution of Your modifications, or +- for any such Derivative Works as a whole, provided Your use, +- reproduction, and distribution of the Work otherwise complies with +- the conditions stated in this License. +- +- 5. Submission of Contributions. Unless You explicitly state otherwise, +- any Contribution intentionally submitted for inclusion in the Work +- by You to the Licensor shall be under the terms and conditions of +- this License, without any additional terms or conditions. +- Notwithstanding the above, nothing herein shall supersede or modify +- the terms of any separate license agreement you may have executed +- with Licensor regarding such Contributions. +- +- 6. Trademarks. This License does not grant permission to use the trade +- names, trademarks, service marks, or product names of the Licensor, +- except as required for reasonable and customary use in describing the +- origin of the Work and reproducing the content of the NOTICE file. +- +- 7. Disclaimer of Warranty. Unless required by applicable law or +- agreed to in writing, Licensor provides the Work (and each +- Contributor provides its Contributions) on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +- implied, including, without limitation, any warranties or conditions +- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +- PARTICULAR PURPOSE. You are solely responsible for determining the +- appropriateness of using or redistributing the Work and assume any +- risks associated with Your exercise of permissions under this License. +- +- 8. Limitation of Liability. In no event and under no legal theory, +- whether in tort (including negligence), contract, or otherwise, +- unless required by applicable law (such as deliberate and grossly +- negligent acts) or agreed to in writing, shall any Contributor be +- liable to You for damages, including any direct, indirect, special, +- incidental, or consequential damages of any character arising as a +- result of this License or out of the use or inability to use the +- Work (including but not limited to damages for loss of goodwill, +- work stoppage, computer failure or malfunction, or any and all +- other commercial damages or losses), even if such Contributor +- has been advised of the possibility of such damages. +- +- 9. Accepting Warranty or Additional Liability. While redistributing +- the Work or Derivative Works thereof, You may choose to offer, +- and charge a fee for, acceptance of support, warranty, indemnity, +- or other liability obligations and/or rights consistent with this +- License. However, in accepting such obligations, You may act only +- on Your own behalf and on Your sole responsibility, not on behalf +- of any other Contributor, and only if You agree to indemnify, +- defend, and hold each Contributor harmless for any liability +- incurred by, or claims asserted against, such Contributor by reason +- of your accepting any such warranty or additional liability. +- +- END OF TERMS AND CONDITIONS +- +- APPENDIX: How to apply the Apache License to your work. +- +- To apply the Apache License to your work, attach the following +- boilerplate notice, with the fields enclosed by brackets "{}" +- replaced with your own identifying information. (Don't include +- the brackets!) The text should be enclosed in the appropriate +- comment syntax for the file format. We also recommend that a +- file or class name and description of purpose be included on the +- same "printed page" as the copyright notice for easier +- identification within third-party archives. +- +- Copyright {yyyy} {name of copyright owner} +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +diff --git a/vendor/github.com/containerd/btrfs/v2/Makefile b/vendor/github.com/containerd/btrfs/v2/Makefile +deleted file mode 100644 +index e89dd46ad1b9..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/Makefile ++++ /dev/null +@@ -1,34 +0,0 @@ +-# Copyright The containerd Authors. +- +-# Licensed under the Apache License, Version 2.0 (the "License"); +-# you may not use this file except in compliance with the License. +-# You may obtain a copy of the License at +- +-# http://www.apache.org/licenses/LICENSE-2.0 +- +-# Unless required by applicable law or agreed to in writing, software +-# distributed under the License is distributed on an "AS IS" BASIS, +-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-# See the License for the specific language governing permissions and +-# limitations under the License. +- +- +-.PHONY: clean binaries generate lint vet test +-all: vet lint test binaries +- +-binaries: bin/btrfs-test +- +-vet: +- go vet ./... +- +-lint: +- golint ./... +- +-test: +- go test -v ./... +- +-bin/%: ./cmd/% *.go +- go build -o ./$@ ./$< +- +-clean: +- rm -rf bin/* +diff --git a/vendor/github.com/containerd/btrfs/v2/README.md b/vendor/github.com/containerd/btrfs/v2/README.md +deleted file mode 100644 +index abdac2ad1baa..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/README.md ++++ /dev/null +@@ -1,61 +0,0 @@ +-# go-btrfs +- +-[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/btrfs)](https://pkg.go.dev/github.com/containerd/btrfs) +-[![Build Status](https://github.com/containerd/btrfs/workflows/CI/badge.svg)](https://github.com/containerd/btrfs/actions?query=workflow%3ACI) +-[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/btrfs)](https://goreportcard.com/report/github.com/containerd/btrfs) +- +-Native Go bindings for btrfs. +- +-# Status +- +-These are in the early stages. We will try to maintain stability, but please +-vendor if you are relying on these directly. +- -# Dependencies - -## v2.x @@ -221,330 +1569,627 @@ index abdac2ad1baa..505f39b12156 100644 -The package name is `libbtrfs-dev` on Debian/Ubuntu, `btrfs-progs-devel` on Fedora and CentOS 7. -The package is not available for Rocky Linux and AlmaLinux. - - # Contribute - - This package may not cover all the use cases for btrfs. If something you need -diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.c b/vendor/github.com/containerd/btrfs/btrfs.c -similarity index 82% -rename from vendor/github.com/containerd/btrfs/v2/btrfs.c -rename to vendor/github.com/containerd/btrfs/btrfs.c -index fe7607c58b3b..f0da012f080e 100644 +-# Contribute +- +-This package may not cover all the use cases for btrfs. If something you need +-is missing, please don't hesitate to submit a PR. +- +-Note that due to struct alignment issues, this isn't yet fully native. +-Preferably, this could be resolved, so contributions in this direction are +-greatly appreciated. +- +-## Applying License Header to New Files +- +-If you submit a contribution that adds a new file, please add the license +-header. You can do so manually or use the `ltag` tool: +- +- +-```console +-$ go get github.com/kunalkushwaha/ltag +-$ ltag -t ./license-templates +-``` +- +-The above will add the appropriate licenses to Go files. New templates will +-need to be added if other kinds of files are added. Please consult the +-documentation at https://github.com/kunalkushwaha/ltag +- +-## Project details +- +-btrfs is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). +-As a containerd sub-project, you will find the: +- * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md), +- * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS), +- * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md) +- +-information in our [`containerd/project`](https://github.com/containerd/project) repository. +diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.c b/vendor/github.com/containerd/btrfs/v2/btrfs.c +deleted file mode 100644 +index fe7607c58b3b..000000000000 --- a/vendor/github.com/containerd/btrfs/v2/btrfs.c -+++ b/vendor/github.com/containerd/btrfs/btrfs.c -@@ -14,16 +14,20 @@ - limitations under the License. - */ - ++++ /dev/null +@@ -1,29 +0,0 @@ +-/* +- Copyright The containerd Authors +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- -#include -+#include -+#include -+#include -+#include -+ - #include "btrfs.h" - - void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src) { - memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); - memcpy(dst->parent_uuid, src->parent_uuid, BTRFS_UUID_SIZE); - memcpy(dst->received_uuid, src->received_uuid, BTRFS_UUID_SIZE); +-#include "btrfs.h" +- +-void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src) { +- memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); +- memcpy(dst->parent_uuid, src->parent_uuid, BTRFS_UUID_SIZE); +- memcpy(dst->received_uuid, src->received_uuid, BTRFS_UUID_SIZE); - dst->generation = src->generation; - dst->otransid = src->otransid; - dst->flags = src->flags; -+ dst->gen = btrfs_root_generation(src); -+ dst->ogen = btrfs_root_otransid(src); -+ dst->flags = btrfs_root_flags(src); - } - - /* unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src) { */ -diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.go b/vendor/github.com/containerd/btrfs/btrfs.go -similarity index 88% -rename from vendor/github.com/containerd/btrfs/v2/btrfs.go -rename to vendor/github.com/containerd/btrfs/btrfs.go -index 471dd3464c51..f9c30b3dd517 100644 +-} +- +-/* unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src) { */ +diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.go b/vendor/github.com/containerd/btrfs/v2/btrfs.go +deleted file mode 100644 +index 471dd3464c51..000000000000 --- a/vendor/github.com/containerd/btrfs/v2/btrfs.go -+++ b/vendor/github.com/containerd/btrfs/btrfs.go -@@ -17,7 +17,8 @@ - package btrfs - - /* ++++ /dev/null +@@ -1,411 +0,0 @@ +-/* +- Copyright The containerd Authors. +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- +-package btrfs +- +-/* -#include -+#include -+#include - #include "btrfs.h" - - static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { -@@ -27,13 +28,13 @@ static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* bt - import "C" - - import ( +-#include "btrfs.h" +- +-static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { +- return btrfs_struct->name; +-} +-*/ +-import "C" +- +-import ( - "errors" - "fmt" - "os" - "path/filepath" - "sort" - "syscall" - "unsafe" -+ -+ "github.com/pkg/errors" - ) - - // maxByteSliceSize is the smallest size that Go supports on various platforms. -@@ -98,7 +99,7 @@ func SubvolInfo(path string) (info Info, err error) { - return *info, nil - } - +- "os" +- "path/filepath" +- "sort" +- "syscall" +- "unsafe" +-) +- +-// maxByteSliceSize is the smallest size that Go supports on various platforms. +-// On mipsle, 1<<31-1 overflows the address space. +-const maxByteSliceSize = 1 << 30 +- +-// IsSubvolume returns nil if the path is a valid subvolume. An error is +-// returned if the path does not exist or the path is not a valid subvolume. +-func IsSubvolume(path string) error { +- fi, err := os.Lstat(path) +- if err != nil { +- return err +- } +- +- if err := isFileInfoSubvol(fi); err != nil { +- return err +- } +- +- var statfs syscall.Statfs_t +- if err := syscall.Statfs(path, &statfs); err != nil { +- return err +- } +- +- return isStatfsSubvol(&statfs) +-} +- +-// SubvolID returns the subvolume ID for the provided path +-func SubvolID(path string) (uint64, error) { +- fp, err := openSubvolDir(path) +- if err != nil { +- return 0, err +- } +- defer fp.Close() +- +- return subvolID(fp.Fd()) +-} +- +-// SubvolInfo returns information about the subvolume at the provided path. +-func SubvolInfo(path string) (info Info, err error) { +- path, err = filepath.EvalSymlinks(path) +- if err != nil { +- return info, err +- } +- +- fp, err := openSubvolDir(path) +- if err != nil { +- return info, err +- } +- defer fp.Close() +- +- id, err := subvolID(fp.Fd()) +- if err != nil { +- return info, err +- } +- +- subvolsByID, err := subvolMap(path) +- if err != nil { +- return info, err +- } +- +- if info, ok := subvolsByID[id]; ok { +- return *info, nil +- } +- - return info, fmt.Errorf("%q not found", path) -+ return info, errors.Errorf("%q not found", path) - } - - func subvolMap(path string) (map[uint64]*Info, error) { -@@ -153,13 +154,13 @@ func subvolMap(path string) (map[uint64]*Info, error) { - // get an entry of the objectid, with name, but the parent is - // the offset. - +-} +- +-func subvolMap(path string) (map[uint64]*Info, error) { +- fp, err := openSubvolDir(path) +- if err != nil { +- return nil, err +- } +- defer fp.Close() +- +- var args C.struct_btrfs_ioctl_search_args +- +- args.key.tree_id = C.BTRFS_ROOT_TREE_OBJECTID +- args.key.min_type = C.BTRFS_ROOT_ITEM_KEY +- args.key.max_type = C.BTRFS_ROOT_BACKREF_KEY +- args.key.min_objectid = C.BTRFS_FS_TREE_OBJECTID +- args.key.max_objectid = C.BTRFS_LAST_FREE_OBJECTID +- args.key.max_offset = ^C.__u64(0) +- args.key.max_transid = ^C.__u64(0) +- +- subvolsByID := make(map[uint64]*Info) +- +- for { +- args.key.nr_items = 4096 +- if err := ioctl(fp.Fd(), C.BTRFS_IOC_TREE_SEARCH, uintptr(unsafe.Pointer(&args))); err != nil { +- return nil, err +- } +- +- if args.key.nr_items == 0 { +- break +- } +- +- var ( +- sh C.struct_btrfs_ioctl_search_header +- shSize = unsafe.Sizeof(sh) +- buf = (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.buf[0]))[:C.BTRFS_SEARCH_ARGS_BUFSIZE] +- ) +- +- for i := 0; i < int(args.key.nr_items); i++ { +- sh = (*(*C.struct_btrfs_ioctl_search_header)(unsafe.Pointer(&buf[0]))) +- buf = buf[shSize:] +- +- info := subvolsByID[uint64(sh.objectid)] +- if info == nil { +- info = &Info{} +- } +- info.ID = uint64(sh.objectid) +- +- if sh._type == C.BTRFS_ROOT_BACKREF_KEY { +- rr := (*(*C.struct_btrfs_root_ref)(unsafe.Pointer(&buf[0]))) +- +- // This branch processes the backrefs from the root object. We +- // get an entry of the objectid, with name, but the parent is +- // the offset. +- - nname := le16ToNative(rr.name_len) -+ nname := C.btrfs_stack_root_ref_name_len(&rr) - name := string(buf[C.sizeof_struct_btrfs_root_ref : C.sizeof_struct_btrfs_root_ref+uintptr(nname)]) - - info.ID = uint64(sh.objectid) - info.ParentID = uint64(sh.offset) - info.Name = name +- name := string(buf[C.sizeof_struct_btrfs_root_ref : C.sizeof_struct_btrfs_root_ref+uintptr(nname)]) +- +- info.ID = uint64(sh.objectid) +- info.ParentID = uint64(sh.offset) +- info.Name = name - info.DirID = le64ToNative(rr.dirid) -+ info.DirID = uint64(C.btrfs_stack_root_ref_dirid(&rr)) - - subvolsByID[uint64(sh.objectid)] = info - } else if sh._type == C.BTRFS_ROOT_ITEM_KEY && -@@ -184,8 +185,8 @@ func subvolMap(path string) (map[uint64]*Info, error) { - info.ParentUUID = uuidString(&gri.parent_uuid) - info.ReceivedUUID = uuidString(&gri.received_uuid) - +- +- subvolsByID[uint64(sh.objectid)] = info +- } else if sh._type == C.BTRFS_ROOT_ITEM_KEY && +- (sh.objectid >= C.BTRFS_ROOT_ITEM_KEY || +- sh.objectid == C.BTRFS_FS_TREE_OBJECTID) { +- +- var ( +- ri = (*C.struct_btrfs_root_item)(unsafe.Pointer(&buf[0])) +- gri C.struct_gosafe_btrfs_root_item +- ) +- +- C.unpack_root_item(&gri, ri) +- +- if gri.flags&C.BTRFS_ROOT_SUBVOL_RDONLY != 0 { +- info.Readonly = true +- } +- +- // in this case, the offset is the actual offset. +- info.Offset = uint64(sh.offset) +- +- info.UUID = uuidString(&gri.uuid) +- info.ParentUUID = uuidString(&gri.parent_uuid) +- info.ReceivedUUID = uuidString(&gri.received_uuid) +- - info.Generation = le64ToNative(gri.generation) - info.OriginalGeneration = le64ToNative(gri.otransid) -+ info.Generation = uint64(gri.gen) -+ info.OriginalGeneration = uint64(gri.ogen) - - subvolsByID[uint64(sh.objectid)] = info - } -@@ -272,13 +273,13 @@ func SubvolCreate(path string) error { - args.fd = C.__s64(fp.Fd()) - - if len(name) > C.BTRFS_PATH_NAME_MAX { +- +- subvolsByID[uint64(sh.objectid)] = info +- } +- +- args.key.min_objectid = sh.objectid +- args.key.min_offset = sh.offset +- args.key.min_type = sh._type // this is very questionable. +- +- buf = buf[sh.len:] +- } +- +- args.key.min_offset++ +- if args.key.min_offset == 0 { +- args.key.min_type++ +- } else { +- continue +- } +- +- if args.key.min_type > C.BTRFS_ROOT_BACKREF_KEY { +- args.key.min_type = C.BTRFS_ROOT_ITEM_KEY +- args.key.min_objectid++ +- } else { +- continue +- } +- +- if args.key.min_objectid > args.key.max_objectid { +- break +- } +- } +- +- mnt, err := findMountPoint(path) +- if err != nil { +- return nil, err +- } +- +- for _, sv := range subvolsByID { +- path := sv.Name +- parentID := sv.ParentID +- +- for parentID != 0 { +- parent, ok := subvolsByID[parentID] +- if !ok { +- break +- } +- +- parentID = parent.ParentID +- path = filepath.Join(parent.Name, path) +- } +- +- sv.Path = filepath.Join(mnt, path) +- } +- return subvolsByID, nil +-} +- +-// SubvolList will return the information for all subvolumes corresponding to +-// the provided path. +-func SubvolList(path string) ([]Info, error) { +- subvolsByID, err := subvolMap(path) +- if err != nil { +- return nil, err +- } +- +- subvols := make([]Info, 0, len(subvolsByID)) +- for _, sv := range subvolsByID { +- subvols = append(subvols, *sv) +- } +- +- sort.Sort(infosByID(subvols)) +- +- return subvols, nil +-} +- +-// SubvolCreate creates a subvolume at the provided path. +-func SubvolCreate(path string) error { +- dir, name := filepath.Split(path) +- +- fp, err := os.Open(dir) +- if err != nil { +- return err +- } +- defer fp.Close() +- +- var args C.struct_btrfs_ioctl_vol_args +- args.fd = C.__s64(fp.Fd()) +- +- if len(name) > C.BTRFS_PATH_NAME_MAX { - return fmt.Errorf("%q too long for subvolume", name) -+ return errors.Errorf("%q too long for subvolume", name) - } - nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX] - copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name)) - - if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil { +- } +- nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX] +- copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name)) +- +- if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil { - return fmt.Errorf("btrfs subvolume create failed: %w", err) -+ return errors.Wrap(err, "btrfs subvolume create failed") - } - - return nil -@@ -291,13 +292,13 @@ func SubvolSnapshot(dst, src string, readonly bool) error { - - dstfp, err := openSubvolDir(dstdir) - if err != nil { +- } +- +- return nil +-} +- +-// SubvolSnapshot creates a snapshot in dst from src. If readonly is true, the +-// snapshot will be readonly. +-func SubvolSnapshot(dst, src string, readonly bool) error { +- dstdir, dstname := filepath.Split(dst) +- +- dstfp, err := openSubvolDir(dstdir) +- if err != nil { - return fmt.Errorf("opening snapshot destination subvolume failed: %w", err) -+ return errors.Wrapf(err, "opening snapshot destination subvolume failed") - } - defer dstfp.Close() - - srcfp, err := openSubvolDir(src) - if err != nil { +- } +- defer dstfp.Close() +- +- srcfp, err := openSubvolDir(src) +- if err != nil { - return fmt.Errorf("opening snapshot source subvolume failed: %w", err) -+ return errors.Wrapf(err, "opening snapshot source subvolume failed") - } - defer srcfp.Close() - -@@ -307,7 +308,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error { - name := C.get_name_btrfs_ioctl_vol_args_v2(&args) - - if len(dstname) > C.BTRFS_SUBVOL_NAME_MAX { +- } +- defer srcfp.Close() +- +- // dstdir is the ioctl arg, wile srcdir gets set on the args +- var args C.struct_btrfs_ioctl_vol_args_v2 +- args.fd = C.__s64(srcfp.Fd()) +- name := C.get_name_btrfs_ioctl_vol_args_v2(&args) +- +- if len(dstname) > C.BTRFS_SUBVOL_NAME_MAX { - return fmt.Errorf("%q too long for subvolume", dstname) -+ return errors.Errorf("%q too long for subvolume", dstname) - } - - nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] -@@ -318,7 +319,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error { - } - - if err := ioctl(dstfp.Fd(), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))); err != nil { +- } +- +- nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] +- copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(dstname)) +- +- if readonly { +- args.flags |= C.BTRFS_SUBVOL_RDONLY +- } +- +- if err := ioctl(dstfp.Fd(), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))); err != nil { - return fmt.Errorf("snapshot create failed: %w", err) -+ return errors.Wrapf(err, "snapshot create failed") - } - - return nil -@@ -329,7 +330,7 @@ func SubvolDelete(path string) error { - dir, name := filepath.Split(path) - fp, err := openSubvolDir(dir) - if err != nil { +- } +- +- return nil +-} +- +-// SubvolDelete deletes the subvolumes under the given path. +-func SubvolDelete(path string) error { +- dir, name := filepath.Split(path) +- fp, err := openSubvolDir(dir) +- if err != nil { - return fmt.Errorf("failed opening %v: %w", path, err) -+ return errors.Wrapf(err, "failed opening %v", path) - } - defer fp.Close() - -@@ -340,7 +341,7 @@ func SubvolDelete(path string) error { - return nil - } - +- } +- defer fp.Close() +- +- // remove child subvolumes +- if err := filepath.Walk(path, func(p string, fi os.FileInfo, err error) error { +- if err != nil { +- if os.IsNotExist(err) || p == path { +- return nil +- } +- - return fmt.Errorf("failed walking subvolume %v: %w", p, err) -+ return errors.Wrapf(err, "failed walking subvolume %v", p) - } - - if !fi.IsDir() { -@@ -356,7 +357,7 @@ func SubvolDelete(path string) error { - } - - if err := SubvolDelete(p); err != nil { +- } +- +- if !fi.IsDir() { +- return nil // just ignore it! +- } +- +- if p == path { +- return nil +- } +- +- if err := isFileInfoSubvol(fi); err != nil { +- return nil +- } +- +- if err := SubvolDelete(p); err != nil { - return fmt.Errorf("recursive delete of %v failed: %w", p, err) -+ return errors.Wrapf(err, "recursive delete of %v failed", p) - } - - return filepath.SkipDir // children get walked by call above. -@@ -366,14 +367,14 @@ func SubvolDelete(path string) error { - - var args C.struct_btrfs_ioctl_vol_args - if len(name) > C.BTRFS_SUBVOL_NAME_MAX { +- } +- +- return filepath.SkipDir // children get walked by call above. +- }); err != nil { +- return err +- } +- +- var args C.struct_btrfs_ioctl_vol_args +- if len(name) > C.BTRFS_SUBVOL_NAME_MAX { - return fmt.Errorf("%q too long for subvolume", name) -+ return errors.Errorf("%q too long for subvolume", name) - } - - nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] - copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name)) - - if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil { +- } +- +- nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] +- copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name)) +- +- if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil { - return fmt.Errorf("failed removing subvolume %v: %w", path, err) -+ return errors.Wrapf(err, "failed removing subvolume %v", path) - } - - return nil -@@ -382,7 +383,7 @@ func SubvolDelete(path string) error { - func openSubvolDir(path string) (*os.File, error) { - fp, err := os.Open(path) - if err != nil { +- } +- +- return nil +-} +- +-func openSubvolDir(path string) (*os.File, error) { +- fp, err := os.Open(path) +- if err != nil { - return nil, fmt.Errorf("opening %v as subvolume failed: %w", path, err) -+ return nil, errors.Wrapf(err, "opening %v as subvolume failed", path) - } - - return fp, nil -@@ -390,7 +391,7 @@ func openSubvolDir(path string) (*os.File, error) { - - func isStatfsSubvol(statfs *syscall.Statfs_t) error { - if int64(statfs.Type) != int64(C.BTRFS_SUPER_MAGIC) { +- } +- +- return fp, nil +-} +- +-func isStatfsSubvol(statfs *syscall.Statfs_t) error { +- if int64(statfs.Type) != int64(C.BTRFS_SUPER_MAGIC) { - return fmt.Errorf("not a btrfs filesystem") -+ return errors.Errorf("not a btrfs filesystem") - } - - return nil -@@ -398,13 +399,13 @@ func isStatfsSubvol(statfs *syscall.Statfs_t) error { - - func isFileInfoSubvol(fi os.FileInfo) error { - if !fi.IsDir() { +- } +- +- return nil +-} +- +-func isFileInfoSubvol(fi os.FileInfo) error { +- if !fi.IsDir() { - return errors.New("must be a directory") -+ errors.Errorf("must be a directory") - } - - stat := fi.Sys().(*syscall.Stat_t) - - if stat.Ino != C.BTRFS_FIRST_FREE_OBJECTID { +- } +- +- stat := fi.Sys().(*syscall.Stat_t) +- +- if stat.Ino != C.BTRFS_FIRST_FREE_OBJECTID { - return fmt.Errorf("incorrect inode type") -+ return errors.Errorf("incorrect inode type") - } - - return nil -diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.h b/vendor/github.com/containerd/btrfs/btrfs.h -similarity index 71% -rename from vendor/github.com/containerd/btrfs/v2/btrfs.h -rename to vendor/github.com/containerd/btrfs/btrfs.h -index bbf0d7ac67b1..1ec451ed1b36 100644 +- } +- +- return nil +-} +diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.h b/vendor/github.com/containerd/btrfs/v2/btrfs.h +deleted file mode 100644 +index bbf0d7ac67b1..000000000000 --- a/vendor/github.com/containerd/btrfs/v2/btrfs.h -+++ b/vendor/github.com/containerd/btrfs/btrfs.h -@@ -14,25 +14,23 @@ - limitations under the License. - */ - ++++ /dev/null +@@ -1,39 +0,0 @@ +-/* +- Copyright The containerd Authors +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) -#error "Headers from kernel >= 4.12 are required on compilation time (not on run time)" -#endif -#include -#include -+#include -+#include -+#include -+#include - - // unfortunately, we need to define "alignment safe" C structs to populate for - // packed structs that aren't handled by cgo. Fields will be added here, as - // needed. - - struct gosafe_btrfs_root_item { +- +-// unfortunately, we need to define "alignment safe" C structs to populate for +-// packed structs that aren't handled by cgo. Fields will be added here, as +-// needed. +- +-struct gosafe_btrfs_root_item { - __u8 uuid[BTRFS_UUID_SIZE]; - __u8 parent_uuid[BTRFS_UUID_SIZE]; - __u8 received_uuid[BTRFS_UUID_SIZE]; -+ u8 uuid[BTRFS_UUID_SIZE]; -+ u8 parent_uuid[BTRFS_UUID_SIZE]; -+ u8 received_uuid[BTRFS_UUID_SIZE]; - +- - __le64 generation; - __le64 otransid; - __le64 flags; -+ u64 gen; -+ u64 ogen; -+ u64 flags; - }; - - void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src); -diff --git a/vendor/github.com/containerd/btrfs/v2/doc.go b/vendor/github.com/containerd/btrfs/doc.go -similarity index 100% -rename from vendor/github.com/containerd/btrfs/v2/doc.go -rename to vendor/github.com/containerd/btrfs/doc.go -diff --git a/vendor/github.com/containerd/btrfs/v2/helpers.go b/vendor/github.com/containerd/btrfs/helpers.go -similarity index 76% -rename from vendor/github.com/containerd/btrfs/v2/helpers.go -rename to vendor/github.com/containerd/btrfs/helpers.go -index e4c4894bc1a0..475f1c60f6a6 100644 +-}; +- +-void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src); +-/* void unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src); */ +diff --git a/vendor/github.com/containerd/btrfs/v2/doc.go b/vendor/github.com/containerd/btrfs/v2/doc.go +deleted file mode 100644 +index 6aaf2d056cc5..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/doc.go ++++ /dev/null +@@ -1,18 +0,0 @@ +-/* +- Copyright The containerd Authors. +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- +-// Package btrfs provides bindings for working with btrfs partitions from Go. +-package btrfs +diff --git a/vendor/github.com/containerd/btrfs/v2/helpers.go b/vendor/github.com/containerd/btrfs/v2/helpers.go +deleted file mode 100644 +index e4c4894bc1a0..000000000000 --- a/vendor/github.com/containerd/btrfs/v2/helpers.go -+++ b/vendor/github.com/containerd/btrfs/helpers.go -@@ -17,20 +17,21 @@ - package btrfs - - /* ++++ /dev/null +@@ -1,119 +0,0 @@ +-/* +- Copyright The containerd Authors. +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- +-package btrfs +- +-/* -#include "btrfs.h" -+#include -+#include -+#include - */ - import "C" - - import ( - "bufio" - "bytes" +-*/ +-import "C" +- +-import ( +- "bufio" +- "bytes" - "encoding/binary" - "fmt" - "os" - "strings" - "unsafe" - +- "fmt" +- "os" +- "strings" +- "unsafe" +- - "golang.org/x/sys/cpu" -+ "github.com/pkg/errors" - ) - - func subvolID(fd uintptr) (uint64, error) { -@@ -49,7 +50,7 @@ var ( - zeros = zeroArray[:] - ) - +-) +- +-func subvolID(fd uintptr) (uint64, error) { +- var args C.struct_btrfs_ioctl_ino_lookup_args +- args.objectid = C.BTRFS_FIRST_FREE_OBJECTID +- +- if err := ioctl(fd, C.BTRFS_IOC_INO_LOOKUP, uintptr(unsafe.Pointer(&args))); err != nil { +- return 0, err +- } +- +- return uint64(args.treeid), nil +-} +- +-var ( +- zeroArray = [16]byte{} +- zeros = zeroArray[:] +-) +- -func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.__u8) string { -+func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.u8) string { - b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE] - - if bytes.Equal(b, zeros) { -@@ -59,24 +60,6 @@ func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.__u8) string { - return fmt.Sprintf("%x-%x-%x-%x-%x", b[:4], b[4:4+2], b[6:6+2], b[8:8+2], b[10:16]) - } - +- b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE] +- +- if bytes.Equal(b, zeros) { +- return "" +- } +- +- return fmt.Sprintf("%x-%x-%x-%x-%x", b[:4], b[4:4+2], b[6:6+2], b[8:8+2], b[10:16]) +-} +- -func le16ToNative(le16 C.__le16) uint16 { - if cpu.IsBigEndian { - b := make([]byte, 2) @@ -563,26 +2208,130 @@ index e4c4894bc1a0..475f1c60f6a6 100644 - return uint64(le64) -} - - func findMountPoint(path string) (string, error) { - fp, err := os.Open("/proc/self/mounts") - if err != nil { -@@ -112,7 +95,7 @@ func findMountPoint(path string) (string, error) { - } - - if mount == "" { +-func findMountPoint(path string) (string, error) { +- fp, err := os.Open("/proc/self/mounts") +- if err != nil { +- return "", err +- } +- defer fp.Close() +- +- const ( +- deviceIdx = 0 +- pathIdx = 1 +- typeIdx = 2 +- options = 3 +- ) +- +- var ( +- mount string +- scanner = bufio.NewScanner(fp) +- ) +- +- for scanner.Scan() { +- fields := strings.Fields(scanner.Text()) +- if fields[typeIdx] != "btrfs" { +- continue // skip non-btrfs +- } +- +- if strings.HasPrefix(path, fields[pathIdx]) { +- mount = fields[pathIdx] +- } +- } +- +- if scanner.Err() != nil { +- return "", scanner.Err() +- } +- +- if mount == "" { - return "", fmt.Errorf("mount point of %v not found", path) -+ return "", errors.Errorf("mount point of %v not found", path) - } - - return mount, nil -diff --git a/vendor/github.com/containerd/btrfs/v2/info.go b/vendor/github.com/containerd/btrfs/info.go -similarity index 100% -rename from vendor/github.com/containerd/btrfs/v2/info.go -rename to vendor/github.com/containerd/btrfs/info.go -diff --git a/vendor/github.com/containerd/btrfs/v2/ioctl.go b/vendor/github.com/containerd/btrfs/ioctl.go -similarity index 100% -rename from vendor/github.com/containerd/btrfs/v2/ioctl.go -rename to vendor/github.com/containerd/btrfs/ioctl.go +- } +- +- return mount, nil +-} +diff --git a/vendor/github.com/containerd/btrfs/v2/info.go b/vendor/github.com/containerd/btrfs/v2/info.go +deleted file mode 100644 +index 0f96be6b87ae..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/info.go ++++ /dev/null +@@ -1,45 +0,0 @@ +-/* +- Copyright The containerd Authors. +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- +-package btrfs +- +-// Info describes metadata about a btrfs subvolume. +-type Info struct { +- ID uint64 // subvolume id +- ParentID uint64 // aka ref_tree +- TopLevelID uint64 // not actually clear what this is, not set for now. +- Offset uint64 // key offset for root +- DirID uint64 +- +- Generation uint64 +- OriginalGeneration uint64 +- +- UUID string +- ParentUUID string +- ReceivedUUID string +- +- Name string +- Path string // absolute path of subvolume +- Root string // path of root mount point +- +- Readonly bool // true if the snaps hot is readonly, extracted from flags +-} +- +-type infosByID []Info +- +-func (b infosByID) Len() int { return len(b) } +-func (b infosByID) Less(i, j int) bool { return b[i].ID < b[j].ID } +-func (b infosByID) Swap(i, j int) { b[i], b[j] = b[j], b[i] } +diff --git a/vendor/github.com/containerd/btrfs/v2/ioctl.go b/vendor/github.com/containerd/btrfs/v2/ioctl.go +deleted file mode 100644 +index bac1dbdd6c6e..000000000000 +--- a/vendor/github.com/containerd/btrfs/v2/ioctl.go ++++ /dev/null +@@ -1,27 +0,0 @@ +-/* +- Copyright The containerd Authors. +- +- Licensed under the Apache License, Version 2.0 (the "License"); +- you may not use this file except in compliance with the License. +- You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +-*/ +- +-package btrfs +- +-import "syscall" +- +-func ioctl(fd, request, args uintptr) error { +- _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, fd, request, args) +- if errno != 0 { +- return errno +- } +- return nil +-} diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s deleted file mode 100644 index 269e173ca469..000000000000 From b700673898a6cc0da85a0142cfb20e20dc188d3ccc25ea5e2c125b7534458038 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 22 May 2024 23:27:37 +0000 Subject: [PATCH 4/4] Accepting request 1175971 from home:cyphar:docker - Switch back to using tar_scm service. Aside from obs_scm using more bandwidth and storage than a locally-compressed tar.xz, it seems there's some weird issue with paths in obscpio that break our SLE-12-only patch. OBS-URL: https://build.opensuse.org/request/show/1175971 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/containerd?expand=0&rev=178 --- ...rt-btrfs-depend-on-kernel-UAPI-inste.patch | 2473 +++-------------- _service | 9 +- containerd-1.7.17_3a4de459a689.obscpio | 3 - containerd-1.7.17_3a4de459a689.tar.xz | 3 + containerd.changes | 4 +- 5 files changed, 371 insertions(+), 2121 deletions(-) delete mode 100644 containerd-1.7.17_3a4de459a689.obscpio create mode 100644 containerd-1.7.17_3a4de459a689.tar.xz diff --git a/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch b/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch index 61700a6..13ab77e 100644 --- a/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch +++ b/0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch @@ -17,54 +17,43 @@ Signed-off-by: Aleksa Sarai go.mod | 2 +- go.sum | 4 +- snapshots/btrfs/btrfs.go | 2 +- - vendor/github.com/containerd/btrfs/.gitignore | 28 ++ - vendor/github.com/containerd/btrfs/LICENSE | 201 +++++++++ - vendor/github.com/containerd/btrfs/Makefile | 34 ++ - vendor/github.com/containerd/btrfs/README.md | 46 ++ - vendor/github.com/containerd/btrfs/btrfs.c | 33 ++ - vendor/github.com/containerd/btrfs/btrfs.go | 412 ++++++++++++++++++ - vendor/github.com/containerd/btrfs/btrfs.h | 37 ++ - vendor/github.com/containerd/btrfs/doc.go | 18 + - vendor/github.com/containerd/btrfs/helpers.go | 102 +++++ - vendor/github.com/containerd/btrfs/info.go | 45 ++ - vendor/github.com/containerd/btrfs/ioctl.go | 27 ++ - .../github.com/containerd/btrfs/v2/.gitignore | 28 -- - vendor/github.com/containerd/btrfs/v2/LICENSE | 201 --------- - .../github.com/containerd/btrfs/v2/Makefile | 34 -- - .../github.com/containerd/btrfs/v2/README.md | 61 --- - vendor/github.com/containerd/btrfs/v2/btrfs.c | 29 -- - .../github.com/containerd/btrfs/v2/btrfs.go | 411 ----------------- - vendor/github.com/containerd/btrfs/v2/btrfs.h | 39 -- - vendor/github.com/containerd/btrfs/v2/doc.go | 18 - - .../github.com/containerd/btrfs/v2/helpers.go | 119 ----- - vendor/github.com/containerd/btrfs/v2/info.go | 45 -- - .../github.com/containerd/btrfs/v2/ioctl.go | 27 -- + .../containerd/btrfs/{v2 => }/.gitignore | 0 + .../containerd/btrfs/{v2 => }/LICENSE | 0 + .../containerd/btrfs/{v2 => }/Makefile | 0 + .../containerd/btrfs/{v2 => }/README.md | 15 - + .../containerd/btrfs/{v2 => }/btrfs.c | 12 +- + .../containerd/btrfs/{v2 => }/btrfs.go | 47 +-- + .../containerd/btrfs/{v2 => }/btrfs.h | 22 +- + .../containerd/btrfs/{v2 => }/doc.go | 0 + .../containerd/btrfs/{v2 => }/helpers.go | 29 +- + .../containerd/btrfs/{v2 => }/info.go | 0 + .../containerd/btrfs/{v2 => }/ioctl.go | 0 vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s | 17 - - vendor/golang.org/x/sys/cpu/byteorder.go | 66 --- - vendor/golang.org/x/sys/cpu/cpu.go | 290 ------------ + vendor/golang.org/x/sys/cpu/byteorder.go | 66 ---- + vendor/golang.org/x/sys/cpu/cpu.go | 290 ------------------ vendor/golang.org/x/sys/cpu/cpu_aix.go | 33 -- - vendor/golang.org/x/sys/cpu/cpu_arm.go | 73 ---- - vendor/golang.org/x/sys/cpu/cpu_arm64.go | 172 -------- + vendor/golang.org/x/sys/cpu/cpu_arm.go | 73 ----- + vendor/golang.org/x/sys/cpu/cpu_arm64.go | 172 ----------- vendor/golang.org/x/sys/cpu/cpu_arm64.s | 31 -- vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go | 11 - - vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 - + vendor/golang.org/x/sys/cpu/cpu_gc_s390x.go | 21 -- vendor/golang.org/x/sys/cpu/cpu_gc_x86.go | 15 - .../golang.org/x/sys/cpu/cpu_gccgo_arm64.go | 11 - - .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 - - vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 37 -- + .../golang.org/x/sys/cpu/cpu_gccgo_s390x.go | 22 -- + vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.c | 37 --- vendor/golang.org/x/sys/cpu/cpu_gccgo_x86.go | 31 -- vendor/golang.org/x/sys/cpu/cpu_linux.go | 15 - - vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 -- - .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 111 ----- - .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 22 - + vendor/golang.org/x/sys/cpu/cpu_linux_arm.go | 39 --- + .../golang.org/x/sys/cpu/cpu_linux_arm64.go | 111 ------- + .../golang.org/x/sys/cpu/cpu_linux_mips64x.go | 22 -- .../golang.org/x/sys/cpu/cpu_linux_noinit.go | 9 - .../golang.org/x/sys/cpu/cpu_linux_ppc64x.go | 30 -- - .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 40 -- + .../golang.org/x/sys/cpu/cpu_linux_s390x.go | 40 --- vendor/golang.org/x/sys/cpu/cpu_loong64.go | 12 - vendor/golang.org/x/sys/cpu/cpu_mips64x.go | 15 - vendor/golang.org/x/sys/cpu/cpu_mipsx.go | 11 - - .../golang.org/x/sys/cpu/cpu_netbsd_arm64.go | 173 -------- - .../golang.org/x/sys/cpu/cpu_openbsd_arm64.go | 65 --- + .../golang.org/x/sys/cpu/cpu_netbsd_arm64.go | 173 ----------- + .../golang.org/x/sys/cpu/cpu_openbsd_arm64.go | 65 ---- .../golang.org/x/sys/cpu/cpu_openbsd_arm64.s | 11 - vendor/golang.org/x/sys/cpu/cpu_other_arm.go | 9 - .../golang.org/x/sys/cpu/cpu_other_arm64.go | 9 - @@ -73,46 +62,35 @@ Signed-off-by: Aleksa Sarai .../golang.org/x/sys/cpu/cpu_other_riscv64.go | 11 - vendor/golang.org/x/sys/cpu/cpu_ppc64x.go | 16 - vendor/golang.org/x/sys/cpu/cpu_riscv64.go | 11 - - vendor/golang.org/x/sys/cpu/cpu_s390x.go | 172 -------- - vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 --- + vendor/golang.org/x/sys/cpu/cpu_s390x.go | 172 ----------- + vendor/golang.org/x/sys/cpu/cpu_s390x.s | 57 ---- vendor/golang.org/x/sys/cpu/cpu_wasm.go | 17 - - vendor/golang.org/x/sys/cpu/cpu_x86.go | 151 ------- + vendor/golang.org/x/sys/cpu/cpu_x86.go | 151 --------- vendor/golang.org/x/sys/cpu/cpu_x86.s | 26 -- vendor/golang.org/x/sys/cpu/cpu_zos.go | 10 - vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go | 25 -- vendor/golang.org/x/sys/cpu/endian_big.go | 10 - vendor/golang.org/x/sys/cpu/endian_little.go | 10 - - vendor/golang.org/x/sys/cpu/hwcap_linux.go | 71 --- - vendor/golang.org/x/sys/cpu/parse.go | 43 -- - .../x/sys/cpu/proc_cpuinfo_linux.go | 53 --- + vendor/golang.org/x/sys/cpu/hwcap_linux.go | 71 ----- + vendor/golang.org/x/sys/cpu/parse.go | 43 --- + .../x/sys/cpu/proc_cpuinfo_linux.go | 53 ---- vendor/golang.org/x/sys/cpu/runtime_auxv.go | 16 - - .../x/sys/cpu/runtime_auxv_go121.go | 18 - + .../x/sys/cpu/runtime_auxv_go121.go | 18 -- .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 26 -- - .../x/sys/cpu/syscall_aix_ppc64_gc.go | 35 -- + .../x/sys/cpu/syscall_aix_ppc64_gc.go | 35 --- vendor/modules.txt | 7 +- - 76 files changed, 990 insertions(+), 3222 deletions(-) - create mode 100644 vendor/github.com/containerd/btrfs/.gitignore - create mode 100644 vendor/github.com/containerd/btrfs/LICENSE - create mode 100644 vendor/github.com/containerd/btrfs/Makefile - create mode 100644 vendor/github.com/containerd/btrfs/README.md - create mode 100644 vendor/github.com/containerd/btrfs/btrfs.c - create mode 100644 vendor/github.com/containerd/btrfs/btrfs.go - create mode 100644 vendor/github.com/containerd/btrfs/btrfs.h - create mode 100644 vendor/github.com/containerd/btrfs/doc.go - create mode 100644 vendor/github.com/containerd/btrfs/helpers.go - create mode 100644 vendor/github.com/containerd/btrfs/info.go - create mode 100644 vendor/github.com/containerd/btrfs/ioctl.go - delete mode 100644 vendor/github.com/containerd/btrfs/v2/.gitignore - delete mode 100644 vendor/github.com/containerd/btrfs/v2/LICENSE - delete mode 100644 vendor/github.com/containerd/btrfs/v2/Makefile - delete mode 100644 vendor/github.com/containerd/btrfs/v2/README.md - delete mode 100644 vendor/github.com/containerd/btrfs/v2/btrfs.c - delete mode 100644 vendor/github.com/containerd/btrfs/v2/btrfs.go - delete mode 100644 vendor/github.com/containerd/btrfs/v2/btrfs.h - delete mode 100644 vendor/github.com/containerd/btrfs/v2/doc.go - delete mode 100644 vendor/github.com/containerd/btrfs/v2/helpers.go - delete mode 100644 vendor/github.com/containerd/btrfs/v2/info.go - delete mode 100644 vendor/github.com/containerd/btrfs/v2/ioctl.go + 65 files changed, 55 insertions(+), 2287 deletions(-) + rename vendor/github.com/containerd/btrfs/{v2 => }/.gitignore (100%) + rename vendor/github.com/containerd/btrfs/{v2 => }/LICENSE (100%) + rename vendor/github.com/containerd/btrfs/{v2 => }/Makefile (100%) + rename vendor/github.com/containerd/btrfs/{v2 => }/README.md (81%) + rename vendor/github.com/containerd/btrfs/{v2 => }/btrfs.c (82%) + rename vendor/github.com/containerd/btrfs/{v2 => }/btrfs.go (88%) + rename vendor/github.com/containerd/btrfs/{v2 => }/btrfs.h (71%) + rename vendor/github.com/containerd/btrfs/{v2 => }/doc.go (100%) + rename vendor/github.com/containerd/btrfs/{v2 => }/helpers.go (76%) + rename vendor/github.com/containerd/btrfs/{v2 => }/info.go (100%) + rename vendor/github.com/containerd/btrfs/{v2 => }/ioctl.go (100%) delete mode 100644 vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s delete mode 100644 vendor/golang.org/x/sys/cpu/byteorder.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu.go @@ -205,1355 +183,29 @@ index a6a41e68e3cd..5cef986b5e7b 100644 "github.com/containerd/continuity/fs" "github.com/containerd/containerd/log" -diff --git a/vendor/github.com/containerd/btrfs/.gitignore b/vendor/github.com/containerd/btrfs/.gitignore -new file mode 100644 -index 000000000000..9b781b52b966 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/.gitignore -@@ -0,0 +1,28 @@ -+# Compiled Object files, Static and Dynamic libs (Shared Objects) -+*.o -+*.a -+*.so -+bin/ -+ -+# Folders -+_obj -+_test -+ -+# Architecture specific extensions/prefixes -+*.[568vq] -+[568vq].out -+ -+*.cgo1.go -+*.cgo2.c -+_cgo_defun.c -+_cgo_gotypes.go -+_cgo_export.* -+ -+_testmain.go -+ -+*.exe -+*.test -+*.prof -+ -+# Support running go modules in vendor mode for local development -+/vendor/ -diff --git a/vendor/github.com/containerd/btrfs/LICENSE b/vendor/github.com/containerd/btrfs/LICENSE -new file mode 100644 -index 000000000000..8dada3edaf50 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/LICENSE -@@ -0,0 +1,201 @@ -+ Apache License -+ Version 2.0, January 2004 -+ http://www.apache.org/licenses/ -+ -+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -+ -+ 1. Definitions. -+ -+ "License" shall mean the terms and conditions for use, reproduction, -+ and distribution as defined by Sections 1 through 9 of this document. -+ -+ "Licensor" shall mean the copyright owner or entity authorized by -+ the copyright owner that is granting the License. -+ -+ "Legal Entity" shall mean the union of the acting entity and all -+ other entities that control, are controlled by, or are under common -+ control with that entity. For the purposes of this definition, -+ "control" means (i) the power, direct or indirect, to cause the -+ direction or management of such entity, whether by contract or -+ otherwise, or (ii) ownership of fifty percent (50%) or more of the -+ outstanding shares, or (iii) beneficial ownership of such entity. -+ -+ "You" (or "Your") shall mean an individual or Legal Entity -+ exercising permissions granted by this License. -+ -+ "Source" form shall mean the preferred form for making modifications, -+ including but not limited to software source code, documentation -+ source, and configuration files. -+ -+ "Object" form shall mean any form resulting from mechanical -+ transformation or translation of a Source form, including but -+ not limited to compiled object code, generated documentation, -+ and conversions to other media types. -+ -+ "Work" shall mean the work of authorship, whether in Source or -+ Object form, made available under the License, as indicated by a -+ copyright notice that is included in or attached to the work -+ (an example is provided in the Appendix below). -+ -+ "Derivative Works" shall mean any work, whether in Source or Object -+ form, that is based on (or derived from) the Work and for which the -+ editorial revisions, annotations, elaborations, or other modifications -+ represent, as a whole, an original work of authorship. For the purposes -+ of this License, Derivative Works shall not include works that remain -+ separable from, or merely link (or bind by name) to the interfaces of, -+ the Work and Derivative Works thereof. -+ -+ "Contribution" shall mean any work of authorship, including -+ the original version of the Work and any modifications or additions -+ to that Work or Derivative Works thereof, that is intentionally -+ submitted to Licensor for inclusion in the Work by the copyright owner -+ or by an individual or Legal Entity authorized to submit on behalf of -+ the copyright owner. For the purposes of this definition, "submitted" -+ means any form of electronic, verbal, or written communication sent -+ to the Licensor or its representatives, including but not limited to -+ communication on electronic mailing lists, source code control systems, -+ and issue tracking systems that are managed by, or on behalf of, the -+ Licensor for the purpose of discussing and improving the Work, but -+ excluding communication that is conspicuously marked or otherwise -+ designated in writing by the copyright owner as "Not a Contribution." -+ -+ "Contributor" shall mean Licensor and any individual or Legal Entity -+ on behalf of whom a Contribution has been received by Licensor and -+ subsequently incorporated within the Work. -+ -+ 2. Grant of Copyright License. Subject to the terms and conditions of -+ this License, each Contributor hereby grants to You a perpetual, -+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable -+ copyright license to reproduce, prepare Derivative Works of, -+ publicly display, publicly perform, sublicense, and distribute the -+ Work and such Derivative Works in Source or Object form. -+ -+ 3. Grant of Patent License. Subject to the terms and conditions of -+ this License, each Contributor hereby grants to You a perpetual, -+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable -+ (except as stated in this section) patent license to make, have made, -+ use, offer to sell, sell, import, and otherwise transfer the Work, -+ where such license applies only to those patent claims licensable -+ by such Contributor that are necessarily infringed by their -+ Contribution(s) alone or by combination of their Contribution(s) -+ with the Work to which such Contribution(s) was submitted. If You -+ institute patent litigation against any entity (including a -+ cross-claim or counterclaim in a lawsuit) alleging that the Work -+ or a Contribution incorporated within the Work constitutes direct -+ or contributory patent infringement, then any patent licenses -+ granted to You under this License for that Work shall terminate -+ as of the date such litigation is filed. -+ -+ 4. Redistribution. You may reproduce and distribute copies of the -+ Work or Derivative Works thereof in any medium, with or without -+ modifications, and in Source or Object form, provided that You -+ meet the following conditions: -+ -+ (a) You must give any other recipients of the Work or -+ Derivative Works a copy of this License; and -+ -+ (b) You must cause any modified files to carry prominent notices -+ stating that You changed the files; and -+ -+ (c) You must retain, in the Source form of any Derivative Works -+ that You distribute, all copyright, patent, trademark, and -+ attribution notices from the Source form of the Work, -+ excluding those notices that do not pertain to any part of -+ the Derivative Works; and -+ -+ (d) If the Work includes a "NOTICE" text file as part of its -+ distribution, then any Derivative Works that You distribute must -+ include a readable copy of the attribution notices contained -+ within such NOTICE file, excluding those notices that do not -+ pertain to any part of the Derivative Works, in at least one -+ of the following places: within a NOTICE text file distributed -+ as part of the Derivative Works; within the Source form or -+ documentation, if provided along with the Derivative Works; or, -+ within a display generated by the Derivative Works, if and -+ wherever such third-party notices normally appear. The contents -+ of the NOTICE file are for informational purposes only and -+ do not modify the License. You may add Your own attribution -+ notices within Derivative Works that You distribute, alongside -+ or as an addendum to the NOTICE text from the Work, provided -+ that such additional attribution notices cannot be construed -+ as modifying the License. -+ -+ You may add Your own copyright statement to Your modifications and -+ may provide additional or different license terms and conditions -+ for use, reproduction, or distribution of Your modifications, or -+ for any such Derivative Works as a whole, provided Your use, -+ reproduction, and distribution of the Work otherwise complies with -+ the conditions stated in this License. -+ -+ 5. Submission of Contributions. Unless You explicitly state otherwise, -+ any Contribution intentionally submitted for inclusion in the Work -+ by You to the Licensor shall be under the terms and conditions of -+ this License, without any additional terms or conditions. -+ Notwithstanding the above, nothing herein shall supersede or modify -+ the terms of any separate license agreement you may have executed -+ with Licensor regarding such Contributions. -+ -+ 6. Trademarks. This License does not grant permission to use the trade -+ names, trademarks, service marks, or product names of the Licensor, -+ except as required for reasonable and customary use in describing the -+ origin of the Work and reproducing the content of the NOTICE file. -+ -+ 7. Disclaimer of Warranty. Unless required by applicable law or -+ agreed to in writing, Licensor provides the Work (and each -+ Contributor provides its Contributions) on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -+ implied, including, without limitation, any warranties or conditions -+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -+ PARTICULAR PURPOSE. You are solely responsible for determining the -+ appropriateness of using or redistributing the Work and assume any -+ risks associated with Your exercise of permissions under this License. -+ -+ 8. Limitation of Liability. In no event and under no legal theory, -+ whether in tort (including negligence), contract, or otherwise, -+ unless required by applicable law (such as deliberate and grossly -+ negligent acts) or agreed to in writing, shall any Contributor be -+ liable to You for damages, including any direct, indirect, special, -+ incidental, or consequential damages of any character arising as a -+ result of this License or out of the use or inability to use the -+ Work (including but not limited to damages for loss of goodwill, -+ work stoppage, computer failure or malfunction, or any and all -+ other commercial damages or losses), even if such Contributor -+ has been advised of the possibility of such damages. -+ -+ 9. Accepting Warranty or Additional Liability. While redistributing -+ the Work or Derivative Works thereof, You may choose to offer, -+ and charge a fee for, acceptance of support, warranty, indemnity, -+ or other liability obligations and/or rights consistent with this -+ License. However, in accepting such obligations, You may act only -+ on Your own behalf and on Your sole responsibility, not on behalf -+ of any other Contributor, and only if You agree to indemnify, -+ defend, and hold each Contributor harmless for any liability -+ incurred by, or claims asserted against, such Contributor by reason -+ of your accepting any such warranty or additional liability. -+ -+ END OF TERMS AND CONDITIONS -+ -+ APPENDIX: How to apply the Apache License to your work. -+ -+ To apply the Apache License to your work, attach the following -+ boilerplate notice, with the fields enclosed by brackets "{}" -+ replaced with your own identifying information. (Don't include -+ the brackets!) The text should be enclosed in the appropriate -+ comment syntax for the file format. We also recommend that a -+ file or class name and description of purpose be included on the -+ same "printed page" as the copyright notice for easier -+ identification within third-party archives. -+ -+ Copyright {yyyy} {name of copyright owner} -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -diff --git a/vendor/github.com/containerd/btrfs/Makefile b/vendor/github.com/containerd/btrfs/Makefile -new file mode 100644 -index 000000000000..e89dd46ad1b9 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/Makefile -@@ -0,0 +1,34 @@ -+# Copyright The containerd Authors. -+ -+# Licensed under the Apache License, Version 2.0 (the "License"); -+# you may not use this file except in compliance with the License. -+# You may obtain a copy of the License at -+ -+# http://www.apache.org/licenses/LICENSE-2.0 -+ -+# Unless required by applicable law or agreed to in writing, software -+# distributed under the License is distributed on an "AS IS" BASIS, -+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+# See the License for the specific language governing permissions and -+# limitations under the License. -+ -+ -+.PHONY: clean binaries generate lint vet test -+all: vet lint test binaries -+ -+binaries: bin/btrfs-test -+ -+vet: -+ go vet ./... -+ -+lint: -+ golint ./... -+ -+test: -+ go test -v ./... -+ -+bin/%: ./cmd/% *.go -+ go build -o ./$@ ./$< -+ -+clean: -+ rm -rf bin/* -diff --git a/vendor/github.com/containerd/btrfs/README.md b/vendor/github.com/containerd/btrfs/README.md -new file mode 100644 -index 000000000000..505f39b12156 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/README.md -@@ -0,0 +1,46 @@ -+# go-btrfs -+ -+[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/btrfs)](https://pkg.go.dev/github.com/containerd/btrfs) -+[![Build Status](https://github.com/containerd/btrfs/workflows/CI/badge.svg)](https://github.com/containerd/btrfs/actions?query=workflow%3ACI) -+[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/btrfs)](https://goreportcard.com/report/github.com/containerd/btrfs) -+ -+Native Go bindings for btrfs. -+ -+# Status -+ -+These are in the early stages. We will try to maintain stability, but please -+vendor if you are relying on these directly. -+ -+# Contribute -+ -+This package may not cover all the use cases for btrfs. If something you need -+is missing, please don't hesitate to submit a PR. -+ -+Note that due to struct alignment issues, this isn't yet fully native. -+Preferably, this could be resolved, so contributions in this direction are -+greatly appreciated. -+ -+## Applying License Header to New Files -+ -+If you submit a contribution that adds a new file, please add the license -+header. You can do so manually or use the `ltag` tool: -+ -+ -+```console -+$ go get github.com/kunalkushwaha/ltag -+$ ltag -t ./license-templates -+``` -+ -+The above will add the appropriate licenses to Go files. New templates will -+need to be added if other kinds of files are added. Please consult the -+documentation at https://github.com/kunalkushwaha/ltag -+ -+## Project details -+ -+btrfs is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). -+As a containerd sub-project, you will find the: -+ * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md), -+ * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS), -+ * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md) -+ -+information in our [`containerd/project`](https://github.com/containerd/project) repository. -diff --git a/vendor/github.com/containerd/btrfs/btrfs.c b/vendor/github.com/containerd/btrfs/btrfs.c -new file mode 100644 -index 000000000000..f0da012f080e ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/btrfs.c -@@ -0,0 +1,33 @@ -+/* -+ Copyright The containerd Authors -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+#include -+#include -+#include -+#include -+ -+#include "btrfs.h" -+ -+void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src) { -+ memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); -+ memcpy(dst->parent_uuid, src->parent_uuid, BTRFS_UUID_SIZE); -+ memcpy(dst->received_uuid, src->received_uuid, BTRFS_UUID_SIZE); -+ dst->gen = btrfs_root_generation(src); -+ dst->ogen = btrfs_root_otransid(src); -+ dst->flags = btrfs_root_flags(src); -+} -+ -+/* unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src) { */ -diff --git a/vendor/github.com/containerd/btrfs/btrfs.go b/vendor/github.com/containerd/btrfs/btrfs.go -new file mode 100644 -index 000000000000..f9c30b3dd517 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/btrfs.go -@@ -0,0 +1,412 @@ -+/* -+ Copyright The containerd Authors. -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+package btrfs -+ -+/* -+#include -+#include -+#include "btrfs.h" -+ -+static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { -+ return btrfs_struct->name; -+} -+*/ -+import "C" -+ -+import ( -+ "os" -+ "path/filepath" -+ "sort" -+ "syscall" -+ "unsafe" -+ -+ "github.com/pkg/errors" -+) -+ -+// maxByteSliceSize is the smallest size that Go supports on various platforms. -+// On mipsle, 1<<31-1 overflows the address space. -+const maxByteSliceSize = 1 << 30 -+ -+// IsSubvolume returns nil if the path is a valid subvolume. An error is -+// returned if the path does not exist or the path is not a valid subvolume. -+func IsSubvolume(path string) error { -+ fi, err := os.Lstat(path) -+ if err != nil { -+ return err -+ } -+ -+ if err := isFileInfoSubvol(fi); err != nil { -+ return err -+ } -+ -+ var statfs syscall.Statfs_t -+ if err := syscall.Statfs(path, &statfs); err != nil { -+ return err -+ } -+ -+ return isStatfsSubvol(&statfs) -+} -+ -+// SubvolID returns the subvolume ID for the provided path -+func SubvolID(path string) (uint64, error) { -+ fp, err := openSubvolDir(path) -+ if err != nil { -+ return 0, err -+ } -+ defer fp.Close() -+ -+ return subvolID(fp.Fd()) -+} -+ -+// SubvolInfo returns information about the subvolume at the provided path. -+func SubvolInfo(path string) (info Info, err error) { -+ path, err = filepath.EvalSymlinks(path) -+ if err != nil { -+ return info, err -+ } -+ -+ fp, err := openSubvolDir(path) -+ if err != nil { -+ return info, err -+ } -+ defer fp.Close() -+ -+ id, err := subvolID(fp.Fd()) -+ if err != nil { -+ return info, err -+ } -+ -+ subvolsByID, err := subvolMap(path) -+ if err != nil { -+ return info, err -+ } -+ -+ if info, ok := subvolsByID[id]; ok { -+ return *info, nil -+ } -+ -+ return info, errors.Errorf("%q not found", path) -+} -+ -+func subvolMap(path string) (map[uint64]*Info, error) { -+ fp, err := openSubvolDir(path) -+ if err != nil { -+ return nil, err -+ } -+ defer fp.Close() -+ -+ var args C.struct_btrfs_ioctl_search_args -+ -+ args.key.tree_id = C.BTRFS_ROOT_TREE_OBJECTID -+ args.key.min_type = C.BTRFS_ROOT_ITEM_KEY -+ args.key.max_type = C.BTRFS_ROOT_BACKREF_KEY -+ args.key.min_objectid = C.BTRFS_FS_TREE_OBJECTID -+ args.key.max_objectid = C.BTRFS_LAST_FREE_OBJECTID -+ args.key.max_offset = ^C.__u64(0) -+ args.key.max_transid = ^C.__u64(0) -+ -+ subvolsByID := make(map[uint64]*Info) -+ -+ for { -+ args.key.nr_items = 4096 -+ if err := ioctl(fp.Fd(), C.BTRFS_IOC_TREE_SEARCH, uintptr(unsafe.Pointer(&args))); err != nil { -+ return nil, err -+ } -+ -+ if args.key.nr_items == 0 { -+ break -+ } -+ -+ var ( -+ sh C.struct_btrfs_ioctl_search_header -+ shSize = unsafe.Sizeof(sh) -+ buf = (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.buf[0]))[:C.BTRFS_SEARCH_ARGS_BUFSIZE] -+ ) -+ -+ for i := 0; i < int(args.key.nr_items); i++ { -+ sh = (*(*C.struct_btrfs_ioctl_search_header)(unsafe.Pointer(&buf[0]))) -+ buf = buf[shSize:] -+ -+ info := subvolsByID[uint64(sh.objectid)] -+ if info == nil { -+ info = &Info{} -+ } -+ info.ID = uint64(sh.objectid) -+ -+ if sh._type == C.BTRFS_ROOT_BACKREF_KEY { -+ rr := (*(*C.struct_btrfs_root_ref)(unsafe.Pointer(&buf[0]))) -+ -+ // This branch processes the backrefs from the root object. We -+ // get an entry of the objectid, with name, but the parent is -+ // the offset. -+ -+ nname := C.btrfs_stack_root_ref_name_len(&rr) -+ name := string(buf[C.sizeof_struct_btrfs_root_ref : C.sizeof_struct_btrfs_root_ref+uintptr(nname)]) -+ -+ info.ID = uint64(sh.objectid) -+ info.ParentID = uint64(sh.offset) -+ info.Name = name -+ info.DirID = uint64(C.btrfs_stack_root_ref_dirid(&rr)) -+ -+ subvolsByID[uint64(sh.objectid)] = info -+ } else if sh._type == C.BTRFS_ROOT_ITEM_KEY && -+ (sh.objectid >= C.BTRFS_ROOT_ITEM_KEY || -+ sh.objectid == C.BTRFS_FS_TREE_OBJECTID) { -+ -+ var ( -+ ri = (*C.struct_btrfs_root_item)(unsafe.Pointer(&buf[0])) -+ gri C.struct_gosafe_btrfs_root_item -+ ) -+ -+ C.unpack_root_item(&gri, ri) -+ -+ if gri.flags&C.BTRFS_ROOT_SUBVOL_RDONLY != 0 { -+ info.Readonly = true -+ } -+ -+ // in this case, the offset is the actual offset. -+ info.Offset = uint64(sh.offset) -+ -+ info.UUID = uuidString(&gri.uuid) -+ info.ParentUUID = uuidString(&gri.parent_uuid) -+ info.ReceivedUUID = uuidString(&gri.received_uuid) -+ -+ info.Generation = uint64(gri.gen) -+ info.OriginalGeneration = uint64(gri.ogen) -+ -+ subvolsByID[uint64(sh.objectid)] = info -+ } -+ -+ args.key.min_objectid = sh.objectid -+ args.key.min_offset = sh.offset -+ args.key.min_type = sh._type // this is very questionable. -+ -+ buf = buf[sh.len:] -+ } -+ -+ args.key.min_offset++ -+ if args.key.min_offset == 0 { -+ args.key.min_type++ -+ } else { -+ continue -+ } -+ -+ if args.key.min_type > C.BTRFS_ROOT_BACKREF_KEY { -+ args.key.min_type = C.BTRFS_ROOT_ITEM_KEY -+ args.key.min_objectid++ -+ } else { -+ continue -+ } -+ -+ if args.key.min_objectid > args.key.max_objectid { -+ break -+ } -+ } -+ -+ mnt, err := findMountPoint(path) -+ if err != nil { -+ return nil, err -+ } -+ -+ for _, sv := range subvolsByID { -+ path := sv.Name -+ parentID := sv.ParentID -+ -+ for parentID != 0 { -+ parent, ok := subvolsByID[parentID] -+ if !ok { -+ break -+ } -+ -+ parentID = parent.ParentID -+ path = filepath.Join(parent.Name, path) -+ } -+ -+ sv.Path = filepath.Join(mnt, path) -+ } -+ return subvolsByID, nil -+} -+ -+// SubvolList will return the information for all subvolumes corresponding to -+// the provided path. -+func SubvolList(path string) ([]Info, error) { -+ subvolsByID, err := subvolMap(path) -+ if err != nil { -+ return nil, err -+ } -+ -+ subvols := make([]Info, 0, len(subvolsByID)) -+ for _, sv := range subvolsByID { -+ subvols = append(subvols, *sv) -+ } -+ -+ sort.Sort(infosByID(subvols)) -+ -+ return subvols, nil -+} -+ -+// SubvolCreate creates a subvolume at the provided path. -+func SubvolCreate(path string) error { -+ dir, name := filepath.Split(path) -+ -+ fp, err := os.Open(dir) -+ if err != nil { -+ return err -+ } -+ defer fp.Close() -+ -+ var args C.struct_btrfs_ioctl_vol_args -+ args.fd = C.__s64(fp.Fd()) -+ -+ if len(name) > C.BTRFS_PATH_NAME_MAX { -+ return errors.Errorf("%q too long for subvolume", name) -+ } -+ nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX] -+ copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name)) -+ -+ if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil { -+ return errors.Wrap(err, "btrfs subvolume create failed") -+ } -+ -+ return nil -+} -+ -+// SubvolSnapshot creates a snapshot in dst from src. If readonly is true, the -+// snapshot will be readonly. -+func SubvolSnapshot(dst, src string, readonly bool) error { -+ dstdir, dstname := filepath.Split(dst) -+ -+ dstfp, err := openSubvolDir(dstdir) -+ if err != nil { -+ return errors.Wrapf(err, "opening snapshot destination subvolume failed") -+ } -+ defer dstfp.Close() -+ -+ srcfp, err := openSubvolDir(src) -+ if err != nil { -+ return errors.Wrapf(err, "opening snapshot source subvolume failed") -+ } -+ defer srcfp.Close() -+ -+ // dstdir is the ioctl arg, wile srcdir gets set on the args -+ var args C.struct_btrfs_ioctl_vol_args_v2 -+ args.fd = C.__s64(srcfp.Fd()) -+ name := C.get_name_btrfs_ioctl_vol_args_v2(&args) -+ -+ if len(dstname) > C.BTRFS_SUBVOL_NAME_MAX { -+ return errors.Errorf("%q too long for subvolume", dstname) -+ } -+ -+ nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] -+ copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(dstname)) -+ -+ if readonly { -+ args.flags |= C.BTRFS_SUBVOL_RDONLY -+ } -+ -+ if err := ioctl(dstfp.Fd(), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))); err != nil { -+ return errors.Wrapf(err, "snapshot create failed") -+ } -+ -+ return nil -+} -+ -+// SubvolDelete deletes the subvolumes under the given path. -+func SubvolDelete(path string) error { -+ dir, name := filepath.Split(path) -+ fp, err := openSubvolDir(dir) -+ if err != nil { -+ return errors.Wrapf(err, "failed opening %v", path) -+ } -+ defer fp.Close() -+ -+ // remove child subvolumes -+ if err := filepath.Walk(path, func(p string, fi os.FileInfo, err error) error { -+ if err != nil { -+ if os.IsNotExist(err) || p == path { -+ return nil -+ } -+ -+ return errors.Wrapf(err, "failed walking subvolume %v", p) -+ } -+ -+ if !fi.IsDir() { -+ return nil // just ignore it! -+ } -+ -+ if p == path { -+ return nil -+ } -+ -+ if err := isFileInfoSubvol(fi); err != nil { -+ return nil -+ } -+ -+ if err := SubvolDelete(p); err != nil { -+ return errors.Wrapf(err, "recursive delete of %v failed", p) -+ } -+ -+ return filepath.SkipDir // children get walked by call above. -+ }); err != nil { -+ return err -+ } -+ -+ var args C.struct_btrfs_ioctl_vol_args -+ if len(name) > C.BTRFS_SUBVOL_NAME_MAX { -+ return errors.Errorf("%q too long for subvolume", name) -+ } -+ -+ nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] -+ copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name)) -+ -+ if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil { -+ return errors.Wrapf(err, "failed removing subvolume %v", path) -+ } -+ -+ return nil -+} -+ -+func openSubvolDir(path string) (*os.File, error) { -+ fp, err := os.Open(path) -+ if err != nil { -+ return nil, errors.Wrapf(err, "opening %v as subvolume failed", path) -+ } -+ -+ return fp, nil -+} -+ -+func isStatfsSubvol(statfs *syscall.Statfs_t) error { -+ if int64(statfs.Type) != int64(C.BTRFS_SUPER_MAGIC) { -+ return errors.Errorf("not a btrfs filesystem") -+ } -+ -+ return nil -+} -+ -+func isFileInfoSubvol(fi os.FileInfo) error { -+ if !fi.IsDir() { -+ errors.Errorf("must be a directory") -+ } -+ -+ stat := fi.Sys().(*syscall.Stat_t) -+ -+ if stat.Ino != C.BTRFS_FIRST_FREE_OBJECTID { -+ return errors.Errorf("incorrect inode type") -+ } -+ -+ return nil -+} -diff --git a/vendor/github.com/containerd/btrfs/btrfs.h b/vendor/github.com/containerd/btrfs/btrfs.h -new file mode 100644 -index 000000000000..1ec451ed1b36 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/btrfs.h -@@ -0,0 +1,37 @@ -+/* -+ Copyright The containerd Authors -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+#include -+#include -+#include -+#include -+ -+// unfortunately, we need to define "alignment safe" C structs to populate for -+// packed structs that aren't handled by cgo. Fields will be added here, as -+// needed. -+ -+struct gosafe_btrfs_root_item { -+ u8 uuid[BTRFS_UUID_SIZE]; -+ u8 parent_uuid[BTRFS_UUID_SIZE]; -+ u8 received_uuid[BTRFS_UUID_SIZE]; -+ -+ u64 gen; -+ u64 ogen; -+ u64 flags; -+}; -+ -+void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src); -+/* void unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src); */ -diff --git a/vendor/github.com/containerd/btrfs/doc.go b/vendor/github.com/containerd/btrfs/doc.go -new file mode 100644 -index 000000000000..6aaf2d056cc5 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/doc.go -@@ -0,0 +1,18 @@ -+/* -+ Copyright The containerd Authors. -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+// Package btrfs provides bindings for working with btrfs partitions from Go. -+package btrfs -diff --git a/vendor/github.com/containerd/btrfs/helpers.go b/vendor/github.com/containerd/btrfs/helpers.go -new file mode 100644 -index 000000000000..475f1c60f6a6 ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/helpers.go -@@ -0,0 +1,102 @@ -+/* -+ Copyright The containerd Authors. -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+package btrfs -+ -+/* -+#include -+#include -+#include -+*/ -+import "C" -+ -+import ( -+ "bufio" -+ "bytes" -+ "fmt" -+ "os" -+ "strings" -+ "unsafe" -+ -+ "github.com/pkg/errors" -+) -+ -+func subvolID(fd uintptr) (uint64, error) { -+ var args C.struct_btrfs_ioctl_ino_lookup_args -+ args.objectid = C.BTRFS_FIRST_FREE_OBJECTID -+ -+ if err := ioctl(fd, C.BTRFS_IOC_INO_LOOKUP, uintptr(unsafe.Pointer(&args))); err != nil { -+ return 0, err -+ } -+ -+ return uint64(args.treeid), nil -+} -+ -+var ( -+ zeroArray = [16]byte{} -+ zeros = zeroArray[:] -+) -+ -+func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.u8) string { -+ b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE] -+ -+ if bytes.Equal(b, zeros) { -+ return "" -+ } -+ -+ return fmt.Sprintf("%x-%x-%x-%x-%x", b[:4], b[4:4+2], b[6:6+2], b[8:8+2], b[10:16]) -+} -+ -+func findMountPoint(path string) (string, error) { -+ fp, err := os.Open("/proc/self/mounts") -+ if err != nil { -+ return "", err -+ } -+ defer fp.Close() -+ -+ const ( -+ deviceIdx = 0 -+ pathIdx = 1 -+ typeIdx = 2 -+ options = 3 -+ ) -+ -+ var ( -+ mount string -+ scanner = bufio.NewScanner(fp) -+ ) -+ -+ for scanner.Scan() { -+ fields := strings.Fields(scanner.Text()) -+ if fields[typeIdx] != "btrfs" { -+ continue // skip non-btrfs -+ } -+ -+ if strings.HasPrefix(path, fields[pathIdx]) { -+ mount = fields[pathIdx] -+ } -+ } -+ -+ if scanner.Err() != nil { -+ return "", scanner.Err() -+ } -+ -+ if mount == "" { -+ return "", errors.Errorf("mount point of %v not found", path) -+ } -+ -+ return mount, nil -+} -diff --git a/vendor/github.com/containerd/btrfs/info.go b/vendor/github.com/containerd/btrfs/info.go -new file mode 100644 -index 000000000000..0f96be6b87ae ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/info.go -@@ -0,0 +1,45 @@ -+/* -+ Copyright The containerd Authors. -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+package btrfs -+ -+// Info describes metadata about a btrfs subvolume. -+type Info struct { -+ ID uint64 // subvolume id -+ ParentID uint64 // aka ref_tree -+ TopLevelID uint64 // not actually clear what this is, not set for now. -+ Offset uint64 // key offset for root -+ DirID uint64 -+ -+ Generation uint64 -+ OriginalGeneration uint64 -+ -+ UUID string -+ ParentUUID string -+ ReceivedUUID string -+ -+ Name string -+ Path string // absolute path of subvolume -+ Root string // path of root mount point -+ -+ Readonly bool // true if the snaps hot is readonly, extracted from flags -+} -+ -+type infosByID []Info -+ -+func (b infosByID) Len() int { return len(b) } -+func (b infosByID) Less(i, j int) bool { return b[i].ID < b[j].ID } -+func (b infosByID) Swap(i, j int) { b[i], b[j] = b[j], b[i] } -diff --git a/vendor/github.com/containerd/btrfs/ioctl.go b/vendor/github.com/containerd/btrfs/ioctl.go -new file mode 100644 -index 000000000000..bac1dbdd6c6e ---- /dev/null -+++ b/vendor/github.com/containerd/btrfs/ioctl.go -@@ -0,0 +1,27 @@ -+/* -+ Copyright The containerd Authors. -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+*/ -+ -+package btrfs -+ -+import "syscall" -+ -+func ioctl(fd, request, args uintptr) error { -+ _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, fd, request, args) -+ if errno != 0 { -+ return errno -+ } -+ return nil -+} -diff --git a/vendor/github.com/containerd/btrfs/v2/.gitignore b/vendor/github.com/containerd/btrfs/v2/.gitignore -deleted file mode 100644 -index 9b781b52b966..000000000000 ---- a/vendor/github.com/containerd/btrfs/v2/.gitignore -+++ /dev/null -@@ -1,28 +0,0 @@ --# Compiled Object files, Static and Dynamic libs (Shared Objects) --*.o --*.a --*.so --bin/ -- --# Folders --_obj --_test -- --# Architecture specific extensions/prefixes --*.[568vq] --[568vq].out -- --*.cgo1.go --*.cgo2.c --_cgo_defun.c --_cgo_gotypes.go --_cgo_export.* -- --_testmain.go -- --*.exe --*.test --*.prof -- --# Support running go modules in vendor mode for local development --/vendor/ -diff --git a/vendor/github.com/containerd/btrfs/v2/LICENSE b/vendor/github.com/containerd/btrfs/v2/LICENSE -deleted file mode 100644 -index 8dada3edaf50..000000000000 ---- a/vendor/github.com/containerd/btrfs/v2/LICENSE -+++ /dev/null -@@ -1,201 +0,0 @@ -- Apache License -- Version 2.0, January 2004 -- http://www.apache.org/licenses/ -- -- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -- -- 1. Definitions. -- -- "License" shall mean the terms and conditions for use, reproduction, -- and distribution as defined by Sections 1 through 9 of this document. -- -- "Licensor" shall mean the copyright owner or entity authorized by -- the copyright owner that is granting the License. -- -- "Legal Entity" shall mean the union of the acting entity and all -- other entities that control, are controlled by, or are under common -- control with that entity. For the purposes of this definition, -- "control" means (i) the power, direct or indirect, to cause the -- direction or management of such entity, whether by contract or -- otherwise, or (ii) ownership of fifty percent (50%) or more of the -- outstanding shares, or (iii) beneficial ownership of such entity. -- -- "You" (or "Your") shall mean an individual or Legal Entity -- exercising permissions granted by this License. -- -- "Source" form shall mean the preferred form for making modifications, -- including but not limited to software source code, documentation -- source, and configuration files. -- -- "Object" form shall mean any form resulting from mechanical -- transformation or translation of a Source form, including but -- not limited to compiled object code, generated documentation, -- and conversions to other media types. -- -- "Work" shall mean the work of authorship, whether in Source or -- Object form, made available under the License, as indicated by a -- copyright notice that is included in or attached to the work -- (an example is provided in the Appendix below). -- -- "Derivative Works" shall mean any work, whether in Source or Object -- form, that is based on (or derived from) the Work and for which the -- editorial revisions, annotations, elaborations, or other modifications -- represent, as a whole, an original work of authorship. For the purposes -- of this License, Derivative Works shall not include works that remain -- separable from, or merely link (or bind by name) to the interfaces of, -- the Work and Derivative Works thereof. -- -- "Contribution" shall mean any work of authorship, including -- the original version of the Work and any modifications or additions -- to that Work or Derivative Works thereof, that is intentionally -- submitted to Licensor for inclusion in the Work by the copyright owner -- or by an individual or Legal Entity authorized to submit on behalf of -- the copyright owner. For the purposes of this definition, "submitted" -- means any form of electronic, verbal, or written communication sent -- to the Licensor or its representatives, including but not limited to -- communication on electronic mailing lists, source code control systems, -- and issue tracking systems that are managed by, or on behalf of, the -- Licensor for the purpose of discussing and improving the Work, but -- excluding communication that is conspicuously marked or otherwise -- designated in writing by the copyright owner as "Not a Contribution." -- -- "Contributor" shall mean Licensor and any individual or Legal Entity -- on behalf of whom a Contribution has been received by Licensor and -- subsequently incorporated within the Work. -- -- 2. Grant of Copyright License. Subject to the terms and conditions of -- this License, each Contributor hereby grants to You a perpetual, -- worldwide, non-exclusive, no-charge, royalty-free, irrevocable -- copyright license to reproduce, prepare Derivative Works of, -- publicly display, publicly perform, sublicense, and distribute the -- Work and such Derivative Works in Source or Object form. -- -- 3. Grant of Patent License. Subject to the terms and conditions of -- this License, each Contributor hereby grants to You a perpetual, -- worldwide, non-exclusive, no-charge, royalty-free, irrevocable -- (except as stated in this section) patent license to make, have made, -- use, offer to sell, sell, import, and otherwise transfer the Work, -- where such license applies only to those patent claims licensable -- by such Contributor that are necessarily infringed by their -- Contribution(s) alone or by combination of their Contribution(s) -- with the Work to which such Contribution(s) was submitted. If You -- institute patent litigation against any entity (including a -- cross-claim or counterclaim in a lawsuit) alleging that the Work -- or a Contribution incorporated within the Work constitutes direct -- or contributory patent infringement, then any patent licenses -- granted to You under this License for that Work shall terminate -- as of the date such litigation is filed. -- -- 4. Redistribution. You may reproduce and distribute copies of the -- Work or Derivative Works thereof in any medium, with or without -- modifications, and in Source or Object form, provided that You -- meet the following conditions: -- -- (a) You must give any other recipients of the Work or -- Derivative Works a copy of this License; and -- -- (b) You must cause any modified files to carry prominent notices -- stating that You changed the files; and -- -- (c) You must retain, in the Source form of any Derivative Works -- that You distribute, all copyright, patent, trademark, and -- attribution notices from the Source form of the Work, -- excluding those notices that do not pertain to any part of -- the Derivative Works; and -- -- (d) If the Work includes a "NOTICE" text file as part of its -- distribution, then any Derivative Works that You distribute must -- include a readable copy of the attribution notices contained -- within such NOTICE file, excluding those notices that do not -- pertain to any part of the Derivative Works, in at least one -- of the following places: within a NOTICE text file distributed -- as part of the Derivative Works; within the Source form or -- documentation, if provided along with the Derivative Works; or, -- within a display generated by the Derivative Works, if and -- wherever such third-party notices normally appear. The contents -- of the NOTICE file are for informational purposes only and -- do not modify the License. You may add Your own attribution -- notices within Derivative Works that You distribute, alongside -- or as an addendum to the NOTICE text from the Work, provided -- that such additional attribution notices cannot be construed -- as modifying the License. -- -- You may add Your own copyright statement to Your modifications and -- may provide additional or different license terms and conditions -- for use, reproduction, or distribution of Your modifications, or -- for any such Derivative Works as a whole, provided Your use, -- reproduction, and distribution of the Work otherwise complies with -- the conditions stated in this License. -- -- 5. Submission of Contributions. Unless You explicitly state otherwise, -- any Contribution intentionally submitted for inclusion in the Work -- by You to the Licensor shall be under the terms and conditions of -- this License, without any additional terms or conditions. -- Notwithstanding the above, nothing herein shall supersede or modify -- the terms of any separate license agreement you may have executed -- with Licensor regarding such Contributions. -- -- 6. Trademarks. This License does not grant permission to use the trade -- names, trademarks, service marks, or product names of the Licensor, -- except as required for reasonable and customary use in describing the -- origin of the Work and reproducing the content of the NOTICE file. -- -- 7. Disclaimer of Warranty. Unless required by applicable law or -- agreed to in writing, Licensor provides the Work (and each -- Contributor provides its Contributions) on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -- implied, including, without limitation, any warranties or conditions -- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A -- PARTICULAR PURPOSE. You are solely responsible for determining the -- appropriateness of using or redistributing the Work and assume any -- risks associated with Your exercise of permissions under this License. -- -- 8. Limitation of Liability. In no event and under no legal theory, -- whether in tort (including negligence), contract, or otherwise, -- unless required by applicable law (such as deliberate and grossly -- negligent acts) or agreed to in writing, shall any Contributor be -- liable to You for damages, including any direct, indirect, special, -- incidental, or consequential damages of any character arising as a -- result of this License or out of the use or inability to use the -- Work (including but not limited to damages for loss of goodwill, -- work stoppage, computer failure or malfunction, or any and all -- other commercial damages or losses), even if such Contributor -- has been advised of the possibility of such damages. -- -- 9. Accepting Warranty or Additional Liability. While redistributing -- the Work or Derivative Works thereof, You may choose to offer, -- and charge a fee for, acceptance of support, warranty, indemnity, -- or other liability obligations and/or rights consistent with this -- License. However, in accepting such obligations, You may act only -- on Your own behalf and on Your sole responsibility, not on behalf -- of any other Contributor, and only if You agree to indemnify, -- defend, and hold each Contributor harmless for any liability -- incurred by, or claims asserted against, such Contributor by reason -- of your accepting any such warranty or additional liability. -- -- END OF TERMS AND CONDITIONS -- -- APPENDIX: How to apply the Apache License to your work. -- -- To apply the Apache License to your work, attach the following -- boilerplate notice, with the fields enclosed by brackets "{}" -- replaced with your own identifying information. (Don't include -- the brackets!) The text should be enclosed in the appropriate -- comment syntax for the file format. We also recommend that a -- file or class name and description of purpose be included on the -- same "printed page" as the copyright notice for easier -- identification within third-party archives. -- -- Copyright {yyyy} {name of copyright owner} -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -diff --git a/vendor/github.com/containerd/btrfs/v2/Makefile b/vendor/github.com/containerd/btrfs/v2/Makefile -deleted file mode 100644 -index e89dd46ad1b9..000000000000 ---- a/vendor/github.com/containerd/btrfs/v2/Makefile -+++ /dev/null -@@ -1,34 +0,0 @@ --# Copyright The containerd Authors. -- --# Licensed under the Apache License, Version 2.0 (the "License"); --# you may not use this file except in compliance with the License. --# You may obtain a copy of the License at -- --# http://www.apache.org/licenses/LICENSE-2.0 -- --# Unless required by applicable law or agreed to in writing, software --# distributed under the License is distributed on an "AS IS" BASIS, --# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --# See the License for the specific language governing permissions and --# limitations under the License. -- -- --.PHONY: clean binaries generate lint vet test --all: vet lint test binaries -- --binaries: bin/btrfs-test -- --vet: -- go vet ./... -- --lint: -- golint ./... -- --test: -- go test -v ./... -- --bin/%: ./cmd/% *.go -- go build -o ./$@ ./$< -- --clean: -- rm -rf bin/* -diff --git a/vendor/github.com/containerd/btrfs/v2/README.md b/vendor/github.com/containerd/btrfs/v2/README.md -deleted file mode 100644 -index abdac2ad1baa..000000000000 +diff --git a/vendor/github.com/containerd/btrfs/v2/.gitignore b/vendor/github.com/containerd/btrfs/.gitignore +similarity index 100% +rename from vendor/github.com/containerd/btrfs/v2/.gitignore +rename to vendor/github.com/containerd/btrfs/.gitignore +diff --git a/vendor/github.com/containerd/btrfs/v2/LICENSE b/vendor/github.com/containerd/btrfs/LICENSE +similarity index 100% +rename from vendor/github.com/containerd/btrfs/v2/LICENSE +rename to vendor/github.com/containerd/btrfs/LICENSE +diff --git a/vendor/github.com/containerd/btrfs/v2/Makefile b/vendor/github.com/containerd/btrfs/Makefile +similarity index 100% +rename from vendor/github.com/containerd/btrfs/v2/Makefile +rename to vendor/github.com/containerd/btrfs/Makefile +diff --git a/vendor/github.com/containerd/btrfs/v2/README.md b/vendor/github.com/containerd/btrfs/README.md +similarity index 81% +rename from vendor/github.com/containerd/btrfs/v2/README.md +rename to vendor/github.com/containerd/btrfs/README.md +index abdac2ad1baa..505f39b12156 100644 --- a/vendor/github.com/containerd/btrfs/v2/README.md -+++ /dev/null -@@ -1,61 +0,0 @@ --# go-btrfs -- --[![PkgGoDev](https://pkg.go.dev/badge/github.com/containerd/btrfs)](https://pkg.go.dev/github.com/containerd/btrfs) --[![Build Status](https://github.com/containerd/btrfs/workflows/CI/badge.svg)](https://github.com/containerd/btrfs/actions?query=workflow%3ACI) --[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/btrfs)](https://goreportcard.com/report/github.com/containerd/btrfs) -- --Native Go bindings for btrfs. -- --# Status -- --These are in the early stages. We will try to maintain stability, but please --vendor if you are relying on these directly. -- ++++ b/vendor/github.com/containerd/btrfs/README.md +@@ -11,21 +11,6 @@ Native Go bindings for btrfs. + These are in the early stages. We will try to maintain stability, but please + vendor if you are relying on these directly. + -# Dependencies - -## v2.x @@ -1569,627 +221,330 @@ index abdac2ad1baa..000000000000 -The package name is `libbtrfs-dev` on Debian/Ubuntu, `btrfs-progs-devel` on Fedora and CentOS 7. -The package is not available for Rocky Linux and AlmaLinux. - --# Contribute -- --This package may not cover all the use cases for btrfs. If something you need --is missing, please don't hesitate to submit a PR. -- --Note that due to struct alignment issues, this isn't yet fully native. --Preferably, this could be resolved, so contributions in this direction are --greatly appreciated. -- --## Applying License Header to New Files -- --If you submit a contribution that adds a new file, please add the license --header. You can do so manually or use the `ltag` tool: -- -- --```console --$ go get github.com/kunalkushwaha/ltag --$ ltag -t ./license-templates --``` -- --The above will add the appropriate licenses to Go files. New templates will --need to be added if other kinds of files are added. Please consult the --documentation at https://github.com/kunalkushwaha/ltag -- --## Project details -- --btrfs is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE). --As a containerd sub-project, you will find the: -- * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md), -- * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS), -- * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md) -- --information in our [`containerd/project`](https://github.com/containerd/project) repository. -diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.c b/vendor/github.com/containerd/btrfs/v2/btrfs.c -deleted file mode 100644 -index fe7607c58b3b..000000000000 + # Contribute + + This package may not cover all the use cases for btrfs. If something you need +diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.c b/vendor/github.com/containerd/btrfs/btrfs.c +similarity index 82% +rename from vendor/github.com/containerd/btrfs/v2/btrfs.c +rename to vendor/github.com/containerd/btrfs/btrfs.c +index fe7607c58b3b..f0da012f080e 100644 --- a/vendor/github.com/containerd/btrfs/v2/btrfs.c -+++ /dev/null -@@ -1,29 +0,0 @@ --/* -- Copyright The containerd Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- ++++ b/vendor/github.com/containerd/btrfs/btrfs.c +@@ -14,16 +14,20 @@ + limitations under the License. + */ + -#include --#include "btrfs.h" -- --void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src) { -- memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); -- memcpy(dst->parent_uuid, src->parent_uuid, BTRFS_UUID_SIZE); -- memcpy(dst->received_uuid, src->received_uuid, BTRFS_UUID_SIZE); ++#include ++#include ++#include ++#include ++ + #include "btrfs.h" + + void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src) { + memcpy(dst->uuid, src->uuid, BTRFS_UUID_SIZE); + memcpy(dst->parent_uuid, src->parent_uuid, BTRFS_UUID_SIZE); + memcpy(dst->received_uuid, src->received_uuid, BTRFS_UUID_SIZE); - dst->generation = src->generation; - dst->otransid = src->otransid; - dst->flags = src->flags; --} -- --/* unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src) { */ -diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.go b/vendor/github.com/containerd/btrfs/v2/btrfs.go -deleted file mode 100644 -index 471dd3464c51..000000000000 ++ dst->gen = btrfs_root_generation(src); ++ dst->ogen = btrfs_root_otransid(src); ++ dst->flags = btrfs_root_flags(src); + } + + /* unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src) { */ +diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.go b/vendor/github.com/containerd/btrfs/btrfs.go +similarity index 88% +rename from vendor/github.com/containerd/btrfs/v2/btrfs.go +rename to vendor/github.com/containerd/btrfs/btrfs.go +index 471dd3464c51..f9c30b3dd517 100644 --- a/vendor/github.com/containerd/btrfs/v2/btrfs.go -+++ /dev/null -@@ -1,411 +0,0 @@ --/* -- Copyright The containerd Authors. -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- --package btrfs -- --/* ++++ b/vendor/github.com/containerd/btrfs/btrfs.go +@@ -17,7 +17,8 @@ + package btrfs + + /* -#include --#include "btrfs.h" -- --static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { -- return btrfs_struct->name; --} --*/ --import "C" -- --import ( ++#include ++#include + #include "btrfs.h" + + static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { +@@ -27,13 +28,13 @@ static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* bt + import "C" + + import ( - "errors" - "fmt" -- "os" -- "path/filepath" -- "sort" -- "syscall" -- "unsafe" --) -- --// maxByteSliceSize is the smallest size that Go supports on various platforms. --// On mipsle, 1<<31-1 overflows the address space. --const maxByteSliceSize = 1 << 30 -- --// IsSubvolume returns nil if the path is a valid subvolume. An error is --// returned if the path does not exist or the path is not a valid subvolume. --func IsSubvolume(path string) error { -- fi, err := os.Lstat(path) -- if err != nil { -- return err -- } -- -- if err := isFileInfoSubvol(fi); err != nil { -- return err -- } -- -- var statfs syscall.Statfs_t -- if err := syscall.Statfs(path, &statfs); err != nil { -- return err -- } -- -- return isStatfsSubvol(&statfs) --} -- --// SubvolID returns the subvolume ID for the provided path --func SubvolID(path string) (uint64, error) { -- fp, err := openSubvolDir(path) -- if err != nil { -- return 0, err -- } -- defer fp.Close() -- -- return subvolID(fp.Fd()) --} -- --// SubvolInfo returns information about the subvolume at the provided path. --func SubvolInfo(path string) (info Info, err error) { -- path, err = filepath.EvalSymlinks(path) -- if err != nil { -- return info, err -- } -- -- fp, err := openSubvolDir(path) -- if err != nil { -- return info, err -- } -- defer fp.Close() -- -- id, err := subvolID(fp.Fd()) -- if err != nil { -- return info, err -- } -- -- subvolsByID, err := subvolMap(path) -- if err != nil { -- return info, err -- } -- -- if info, ok := subvolsByID[id]; ok { -- return *info, nil -- } -- + "os" + "path/filepath" + "sort" + "syscall" + "unsafe" ++ ++ "github.com/pkg/errors" + ) + + // maxByteSliceSize is the smallest size that Go supports on various platforms. +@@ -98,7 +99,7 @@ func SubvolInfo(path string) (info Info, err error) { + return *info, nil + } + - return info, fmt.Errorf("%q not found", path) --} -- --func subvolMap(path string) (map[uint64]*Info, error) { -- fp, err := openSubvolDir(path) -- if err != nil { -- return nil, err -- } -- defer fp.Close() -- -- var args C.struct_btrfs_ioctl_search_args -- -- args.key.tree_id = C.BTRFS_ROOT_TREE_OBJECTID -- args.key.min_type = C.BTRFS_ROOT_ITEM_KEY -- args.key.max_type = C.BTRFS_ROOT_BACKREF_KEY -- args.key.min_objectid = C.BTRFS_FS_TREE_OBJECTID -- args.key.max_objectid = C.BTRFS_LAST_FREE_OBJECTID -- args.key.max_offset = ^C.__u64(0) -- args.key.max_transid = ^C.__u64(0) -- -- subvolsByID := make(map[uint64]*Info) -- -- for { -- args.key.nr_items = 4096 -- if err := ioctl(fp.Fd(), C.BTRFS_IOC_TREE_SEARCH, uintptr(unsafe.Pointer(&args))); err != nil { -- return nil, err -- } -- -- if args.key.nr_items == 0 { -- break -- } -- -- var ( -- sh C.struct_btrfs_ioctl_search_header -- shSize = unsafe.Sizeof(sh) -- buf = (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.buf[0]))[:C.BTRFS_SEARCH_ARGS_BUFSIZE] -- ) -- -- for i := 0; i < int(args.key.nr_items); i++ { -- sh = (*(*C.struct_btrfs_ioctl_search_header)(unsafe.Pointer(&buf[0]))) -- buf = buf[shSize:] -- -- info := subvolsByID[uint64(sh.objectid)] -- if info == nil { -- info = &Info{} -- } -- info.ID = uint64(sh.objectid) -- -- if sh._type == C.BTRFS_ROOT_BACKREF_KEY { -- rr := (*(*C.struct_btrfs_root_ref)(unsafe.Pointer(&buf[0]))) -- -- // This branch processes the backrefs from the root object. We -- // get an entry of the objectid, with name, but the parent is -- // the offset. -- ++ return info, errors.Errorf("%q not found", path) + } + + func subvolMap(path string) (map[uint64]*Info, error) { +@@ -153,13 +154,13 @@ func subvolMap(path string) (map[uint64]*Info, error) { + // get an entry of the objectid, with name, but the parent is + // the offset. + - nname := le16ToNative(rr.name_len) -- name := string(buf[C.sizeof_struct_btrfs_root_ref : C.sizeof_struct_btrfs_root_ref+uintptr(nname)]) -- -- info.ID = uint64(sh.objectid) -- info.ParentID = uint64(sh.offset) -- info.Name = name ++ nname := C.btrfs_stack_root_ref_name_len(&rr) + name := string(buf[C.sizeof_struct_btrfs_root_ref : C.sizeof_struct_btrfs_root_ref+uintptr(nname)]) + + info.ID = uint64(sh.objectid) + info.ParentID = uint64(sh.offset) + info.Name = name - info.DirID = le64ToNative(rr.dirid) -- -- subvolsByID[uint64(sh.objectid)] = info -- } else if sh._type == C.BTRFS_ROOT_ITEM_KEY && -- (sh.objectid >= C.BTRFS_ROOT_ITEM_KEY || -- sh.objectid == C.BTRFS_FS_TREE_OBJECTID) { -- -- var ( -- ri = (*C.struct_btrfs_root_item)(unsafe.Pointer(&buf[0])) -- gri C.struct_gosafe_btrfs_root_item -- ) -- -- C.unpack_root_item(&gri, ri) -- -- if gri.flags&C.BTRFS_ROOT_SUBVOL_RDONLY != 0 { -- info.Readonly = true -- } -- -- // in this case, the offset is the actual offset. -- info.Offset = uint64(sh.offset) -- -- info.UUID = uuidString(&gri.uuid) -- info.ParentUUID = uuidString(&gri.parent_uuid) -- info.ReceivedUUID = uuidString(&gri.received_uuid) -- ++ info.DirID = uint64(C.btrfs_stack_root_ref_dirid(&rr)) + + subvolsByID[uint64(sh.objectid)] = info + } else if sh._type == C.BTRFS_ROOT_ITEM_KEY && +@@ -184,8 +185,8 @@ func subvolMap(path string) (map[uint64]*Info, error) { + info.ParentUUID = uuidString(&gri.parent_uuid) + info.ReceivedUUID = uuidString(&gri.received_uuid) + - info.Generation = le64ToNative(gri.generation) - info.OriginalGeneration = le64ToNative(gri.otransid) -- -- subvolsByID[uint64(sh.objectid)] = info -- } -- -- args.key.min_objectid = sh.objectid -- args.key.min_offset = sh.offset -- args.key.min_type = sh._type // this is very questionable. -- -- buf = buf[sh.len:] -- } -- -- args.key.min_offset++ -- if args.key.min_offset == 0 { -- args.key.min_type++ -- } else { -- continue -- } -- -- if args.key.min_type > C.BTRFS_ROOT_BACKREF_KEY { -- args.key.min_type = C.BTRFS_ROOT_ITEM_KEY -- args.key.min_objectid++ -- } else { -- continue -- } -- -- if args.key.min_objectid > args.key.max_objectid { -- break -- } -- } -- -- mnt, err := findMountPoint(path) -- if err != nil { -- return nil, err -- } -- -- for _, sv := range subvolsByID { -- path := sv.Name -- parentID := sv.ParentID -- -- for parentID != 0 { -- parent, ok := subvolsByID[parentID] -- if !ok { -- break -- } -- -- parentID = parent.ParentID -- path = filepath.Join(parent.Name, path) -- } -- -- sv.Path = filepath.Join(mnt, path) -- } -- return subvolsByID, nil --} -- --// SubvolList will return the information for all subvolumes corresponding to --// the provided path. --func SubvolList(path string) ([]Info, error) { -- subvolsByID, err := subvolMap(path) -- if err != nil { -- return nil, err -- } -- -- subvols := make([]Info, 0, len(subvolsByID)) -- for _, sv := range subvolsByID { -- subvols = append(subvols, *sv) -- } -- -- sort.Sort(infosByID(subvols)) -- -- return subvols, nil --} -- --// SubvolCreate creates a subvolume at the provided path. --func SubvolCreate(path string) error { -- dir, name := filepath.Split(path) -- -- fp, err := os.Open(dir) -- if err != nil { -- return err -- } -- defer fp.Close() -- -- var args C.struct_btrfs_ioctl_vol_args -- args.fd = C.__s64(fp.Fd()) -- -- if len(name) > C.BTRFS_PATH_NAME_MAX { ++ info.Generation = uint64(gri.gen) ++ info.OriginalGeneration = uint64(gri.ogen) + + subvolsByID[uint64(sh.objectid)] = info + } +@@ -272,13 +273,13 @@ func SubvolCreate(path string) error { + args.fd = C.__s64(fp.Fd()) + + if len(name) > C.BTRFS_PATH_NAME_MAX { - return fmt.Errorf("%q too long for subvolume", name) -- } -- nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX] -- copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name)) -- -- if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil { ++ return errors.Errorf("%q too long for subvolume", name) + } + nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_PATH_NAME_MAX:C.BTRFS_PATH_NAME_MAX] + copy(nameptr[:C.BTRFS_PATH_NAME_MAX], []byte(name)) + + if err := ioctl(fp.Fd(), C.BTRFS_IOC_SUBVOL_CREATE, uintptr(unsafe.Pointer(&args))); err != nil { - return fmt.Errorf("btrfs subvolume create failed: %w", err) -- } -- -- return nil --} -- --// SubvolSnapshot creates a snapshot in dst from src. If readonly is true, the --// snapshot will be readonly. --func SubvolSnapshot(dst, src string, readonly bool) error { -- dstdir, dstname := filepath.Split(dst) -- -- dstfp, err := openSubvolDir(dstdir) -- if err != nil { ++ return errors.Wrap(err, "btrfs subvolume create failed") + } + + return nil +@@ -291,13 +292,13 @@ func SubvolSnapshot(dst, src string, readonly bool) error { + + dstfp, err := openSubvolDir(dstdir) + if err != nil { - return fmt.Errorf("opening snapshot destination subvolume failed: %w", err) -- } -- defer dstfp.Close() -- -- srcfp, err := openSubvolDir(src) -- if err != nil { ++ return errors.Wrapf(err, "opening snapshot destination subvolume failed") + } + defer dstfp.Close() + + srcfp, err := openSubvolDir(src) + if err != nil { - return fmt.Errorf("opening snapshot source subvolume failed: %w", err) -- } -- defer srcfp.Close() -- -- // dstdir is the ioctl arg, wile srcdir gets set on the args -- var args C.struct_btrfs_ioctl_vol_args_v2 -- args.fd = C.__s64(srcfp.Fd()) -- name := C.get_name_btrfs_ioctl_vol_args_v2(&args) -- -- if len(dstname) > C.BTRFS_SUBVOL_NAME_MAX { ++ return errors.Wrapf(err, "opening snapshot source subvolume failed") + } + defer srcfp.Close() + +@@ -307,7 +308,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error { + name := C.get_name_btrfs_ioctl_vol_args_v2(&args) + + if len(dstname) > C.BTRFS_SUBVOL_NAME_MAX { - return fmt.Errorf("%q too long for subvolume", dstname) -- } -- -- nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] -- copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(dstname)) -- -- if readonly { -- args.flags |= C.BTRFS_SUBVOL_RDONLY -- } -- -- if err := ioctl(dstfp.Fd(), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))); err != nil { ++ return errors.Errorf("%q too long for subvolume", dstname) + } + + nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] +@@ -318,7 +319,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error { + } + + if err := ioctl(dstfp.Fd(), C.BTRFS_IOC_SNAP_CREATE_V2, uintptr(unsafe.Pointer(&args))); err != nil { - return fmt.Errorf("snapshot create failed: %w", err) -- } -- -- return nil --} -- --// SubvolDelete deletes the subvolumes under the given path. --func SubvolDelete(path string) error { -- dir, name := filepath.Split(path) -- fp, err := openSubvolDir(dir) -- if err != nil { ++ return errors.Wrapf(err, "snapshot create failed") + } + + return nil +@@ -329,7 +330,7 @@ func SubvolDelete(path string) error { + dir, name := filepath.Split(path) + fp, err := openSubvolDir(dir) + if err != nil { - return fmt.Errorf("failed opening %v: %w", path, err) -- } -- defer fp.Close() -- -- // remove child subvolumes -- if err := filepath.Walk(path, func(p string, fi os.FileInfo, err error) error { -- if err != nil { -- if os.IsNotExist(err) || p == path { -- return nil -- } -- ++ return errors.Wrapf(err, "failed opening %v", path) + } + defer fp.Close() + +@@ -340,7 +341,7 @@ func SubvolDelete(path string) error { + return nil + } + - return fmt.Errorf("failed walking subvolume %v: %w", p, err) -- } -- -- if !fi.IsDir() { -- return nil // just ignore it! -- } -- -- if p == path { -- return nil -- } -- -- if err := isFileInfoSubvol(fi); err != nil { -- return nil -- } -- -- if err := SubvolDelete(p); err != nil { ++ return errors.Wrapf(err, "failed walking subvolume %v", p) + } + + if !fi.IsDir() { +@@ -356,7 +357,7 @@ func SubvolDelete(path string) error { + } + + if err := SubvolDelete(p); err != nil { - return fmt.Errorf("recursive delete of %v failed: %w", p, err) -- } -- -- return filepath.SkipDir // children get walked by call above. -- }); err != nil { -- return err -- } -- -- var args C.struct_btrfs_ioctl_vol_args -- if len(name) > C.BTRFS_SUBVOL_NAME_MAX { ++ return errors.Wrapf(err, "recursive delete of %v failed", p) + } + + return filepath.SkipDir // children get walked by call above. +@@ -366,14 +367,14 @@ func SubvolDelete(path string) error { + + var args C.struct_btrfs_ioctl_vol_args + if len(name) > C.BTRFS_SUBVOL_NAME_MAX { - return fmt.Errorf("%q too long for subvolume", name) -- } -- -- nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] -- copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name)) -- -- if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil { ++ return errors.Errorf("%q too long for subvolume", name) + } + + nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))[:C.BTRFS_SUBVOL_NAME_MAX:C.BTRFS_SUBVOL_NAME_MAX] + copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(name)) + + if err := ioctl(fp.Fd(), C.BTRFS_IOC_SNAP_DESTROY, uintptr(unsafe.Pointer(&args))); err != nil { - return fmt.Errorf("failed removing subvolume %v: %w", path, err) -- } -- -- return nil --} -- --func openSubvolDir(path string) (*os.File, error) { -- fp, err := os.Open(path) -- if err != nil { ++ return errors.Wrapf(err, "failed removing subvolume %v", path) + } + + return nil +@@ -382,7 +383,7 @@ func SubvolDelete(path string) error { + func openSubvolDir(path string) (*os.File, error) { + fp, err := os.Open(path) + if err != nil { - return nil, fmt.Errorf("opening %v as subvolume failed: %w", path, err) -- } -- -- return fp, nil --} -- --func isStatfsSubvol(statfs *syscall.Statfs_t) error { -- if int64(statfs.Type) != int64(C.BTRFS_SUPER_MAGIC) { ++ return nil, errors.Wrapf(err, "opening %v as subvolume failed", path) + } + + return fp, nil +@@ -390,7 +391,7 @@ func openSubvolDir(path string) (*os.File, error) { + + func isStatfsSubvol(statfs *syscall.Statfs_t) error { + if int64(statfs.Type) != int64(C.BTRFS_SUPER_MAGIC) { - return fmt.Errorf("not a btrfs filesystem") -- } -- -- return nil --} -- --func isFileInfoSubvol(fi os.FileInfo) error { -- if !fi.IsDir() { ++ return errors.Errorf("not a btrfs filesystem") + } + + return nil +@@ -398,13 +399,13 @@ func isStatfsSubvol(statfs *syscall.Statfs_t) error { + + func isFileInfoSubvol(fi os.FileInfo) error { + if !fi.IsDir() { - return errors.New("must be a directory") -- } -- -- stat := fi.Sys().(*syscall.Stat_t) -- -- if stat.Ino != C.BTRFS_FIRST_FREE_OBJECTID { ++ errors.Errorf("must be a directory") + } + + stat := fi.Sys().(*syscall.Stat_t) + + if stat.Ino != C.BTRFS_FIRST_FREE_OBJECTID { - return fmt.Errorf("incorrect inode type") -- } -- -- return nil --} -diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.h b/vendor/github.com/containerd/btrfs/v2/btrfs.h -deleted file mode 100644 -index bbf0d7ac67b1..000000000000 ++ return errors.Errorf("incorrect inode type") + } + + return nil +diff --git a/vendor/github.com/containerd/btrfs/v2/btrfs.h b/vendor/github.com/containerd/btrfs/btrfs.h +similarity index 71% +rename from vendor/github.com/containerd/btrfs/v2/btrfs.h +rename to vendor/github.com/containerd/btrfs/btrfs.h +index bbf0d7ac67b1..1ec451ed1b36 100644 --- a/vendor/github.com/containerd/btrfs/v2/btrfs.h -+++ /dev/null -@@ -1,39 +0,0 @@ --/* -- Copyright The containerd Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- ++++ b/vendor/github.com/containerd/btrfs/btrfs.h +@@ -14,25 +14,23 @@ + limitations under the License. + */ + -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) -#error "Headers from kernel >= 4.12 are required on compilation time (not on run time)" -#endif -#include -#include -- --// unfortunately, we need to define "alignment safe" C structs to populate for --// packed structs that aren't handled by cgo. Fields will be added here, as --// needed. -- --struct gosafe_btrfs_root_item { ++#include ++#include ++#include ++#include + + // unfortunately, we need to define "alignment safe" C structs to populate for + // packed structs that aren't handled by cgo. Fields will be added here, as + // needed. + + struct gosafe_btrfs_root_item { - __u8 uuid[BTRFS_UUID_SIZE]; - __u8 parent_uuid[BTRFS_UUID_SIZE]; - __u8 received_uuid[BTRFS_UUID_SIZE]; -- ++ u8 uuid[BTRFS_UUID_SIZE]; ++ u8 parent_uuid[BTRFS_UUID_SIZE]; ++ u8 received_uuid[BTRFS_UUID_SIZE]; + - __le64 generation; - __le64 otransid; - __le64 flags; --}; -- --void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src); --/* void unpack_root_ref(struct gosafe_btrfs_root_ref* dst, struct btrfs_root_ref* src); */ -diff --git a/vendor/github.com/containerd/btrfs/v2/doc.go b/vendor/github.com/containerd/btrfs/v2/doc.go -deleted file mode 100644 -index 6aaf2d056cc5..000000000000 ---- a/vendor/github.com/containerd/btrfs/v2/doc.go -+++ /dev/null -@@ -1,18 +0,0 @@ --/* -- Copyright The containerd Authors. -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- --// Package btrfs provides bindings for working with btrfs partitions from Go. --package btrfs -diff --git a/vendor/github.com/containerd/btrfs/v2/helpers.go b/vendor/github.com/containerd/btrfs/v2/helpers.go -deleted file mode 100644 -index e4c4894bc1a0..000000000000 ++ u64 gen; ++ u64 ogen; ++ u64 flags; + }; + + void unpack_root_item(struct gosafe_btrfs_root_item* dst, struct btrfs_root_item* src); +diff --git a/vendor/github.com/containerd/btrfs/v2/doc.go b/vendor/github.com/containerd/btrfs/doc.go +similarity index 100% +rename from vendor/github.com/containerd/btrfs/v2/doc.go +rename to vendor/github.com/containerd/btrfs/doc.go +diff --git a/vendor/github.com/containerd/btrfs/v2/helpers.go b/vendor/github.com/containerd/btrfs/helpers.go +similarity index 76% +rename from vendor/github.com/containerd/btrfs/v2/helpers.go +rename to vendor/github.com/containerd/btrfs/helpers.go +index e4c4894bc1a0..475f1c60f6a6 100644 --- a/vendor/github.com/containerd/btrfs/v2/helpers.go -+++ /dev/null -@@ -1,119 +0,0 @@ --/* -- Copyright The containerd Authors. -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- --package btrfs -- --/* ++++ b/vendor/github.com/containerd/btrfs/helpers.go +@@ -17,20 +17,21 @@ + package btrfs + + /* -#include "btrfs.h" --*/ --import "C" -- --import ( -- "bufio" -- "bytes" ++#include ++#include ++#include + */ + import "C" + + import ( + "bufio" + "bytes" - "encoding/binary" -- "fmt" -- "os" -- "strings" -- "unsafe" -- + "fmt" + "os" + "strings" + "unsafe" + - "golang.org/x/sys/cpu" --) -- --func subvolID(fd uintptr) (uint64, error) { -- var args C.struct_btrfs_ioctl_ino_lookup_args -- args.objectid = C.BTRFS_FIRST_FREE_OBJECTID -- -- if err := ioctl(fd, C.BTRFS_IOC_INO_LOOKUP, uintptr(unsafe.Pointer(&args))); err != nil { -- return 0, err -- } -- -- return uint64(args.treeid), nil --} -- --var ( -- zeroArray = [16]byte{} -- zeros = zeroArray[:] --) -- ++ "github.com/pkg/errors" + ) + + func subvolID(fd uintptr) (uint64, error) { +@@ -49,7 +50,7 @@ var ( + zeros = zeroArray[:] + ) + -func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.__u8) string { -- b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE] -- -- if bytes.Equal(b, zeros) { -- return "" -- } -- -- return fmt.Sprintf("%x-%x-%x-%x-%x", b[:4], b[4:4+2], b[6:6+2], b[8:8+2], b[10:16]) --} -- ++func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.u8) string { + b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE] + + if bytes.Equal(b, zeros) { +@@ -59,24 +60,6 @@ func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.__u8) string { + return fmt.Sprintf("%x-%x-%x-%x-%x", b[:4], b[4:4+2], b[6:6+2], b[8:8+2], b[10:16]) + } + -func le16ToNative(le16 C.__le16) uint16 { - if cpu.IsBigEndian { - b := make([]byte, 2) @@ -2208,130 +563,26 @@ index e4c4894bc1a0..000000000000 - return uint64(le64) -} - --func findMountPoint(path string) (string, error) { -- fp, err := os.Open("/proc/self/mounts") -- if err != nil { -- return "", err -- } -- defer fp.Close() -- -- const ( -- deviceIdx = 0 -- pathIdx = 1 -- typeIdx = 2 -- options = 3 -- ) -- -- var ( -- mount string -- scanner = bufio.NewScanner(fp) -- ) -- -- for scanner.Scan() { -- fields := strings.Fields(scanner.Text()) -- if fields[typeIdx] != "btrfs" { -- continue // skip non-btrfs -- } -- -- if strings.HasPrefix(path, fields[pathIdx]) { -- mount = fields[pathIdx] -- } -- } -- -- if scanner.Err() != nil { -- return "", scanner.Err() -- } -- -- if mount == "" { + func findMountPoint(path string) (string, error) { + fp, err := os.Open("/proc/self/mounts") + if err != nil { +@@ -112,7 +95,7 @@ func findMountPoint(path string) (string, error) { + } + + if mount == "" { - return "", fmt.Errorf("mount point of %v not found", path) -- } -- -- return mount, nil --} -diff --git a/vendor/github.com/containerd/btrfs/v2/info.go b/vendor/github.com/containerd/btrfs/v2/info.go -deleted file mode 100644 -index 0f96be6b87ae..000000000000 ---- a/vendor/github.com/containerd/btrfs/v2/info.go -+++ /dev/null -@@ -1,45 +0,0 @@ --/* -- Copyright The containerd Authors. -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- --package btrfs -- --// Info describes metadata about a btrfs subvolume. --type Info struct { -- ID uint64 // subvolume id -- ParentID uint64 // aka ref_tree -- TopLevelID uint64 // not actually clear what this is, not set for now. -- Offset uint64 // key offset for root -- DirID uint64 -- -- Generation uint64 -- OriginalGeneration uint64 -- -- UUID string -- ParentUUID string -- ReceivedUUID string -- -- Name string -- Path string // absolute path of subvolume -- Root string // path of root mount point -- -- Readonly bool // true if the snaps hot is readonly, extracted from flags --} -- --type infosByID []Info -- --func (b infosByID) Len() int { return len(b) } --func (b infosByID) Less(i, j int) bool { return b[i].ID < b[j].ID } --func (b infosByID) Swap(i, j int) { b[i], b[j] = b[j], b[i] } -diff --git a/vendor/github.com/containerd/btrfs/v2/ioctl.go b/vendor/github.com/containerd/btrfs/v2/ioctl.go -deleted file mode 100644 -index bac1dbdd6c6e..000000000000 ---- a/vendor/github.com/containerd/btrfs/v2/ioctl.go -+++ /dev/null -@@ -1,27 +0,0 @@ --/* -- Copyright The containerd Authors. -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --*/ -- --package btrfs -- --import "syscall" -- --func ioctl(fd, request, args uintptr) error { -- _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, fd, request, args) -- if errno != 0 { -- return errno -- } -- return nil --} ++ return "", errors.Errorf("mount point of %v not found", path) + } + + return mount, nil +diff --git a/vendor/github.com/containerd/btrfs/v2/info.go b/vendor/github.com/containerd/btrfs/info.go +similarity index 100% +rename from vendor/github.com/containerd/btrfs/v2/info.go +rename to vendor/github.com/containerd/btrfs/info.go +diff --git a/vendor/github.com/containerd/btrfs/v2/ioctl.go b/vendor/github.com/containerd/btrfs/ioctl.go +similarity index 100% +rename from vendor/github.com/containerd/btrfs/v2/ioctl.go +rename to vendor/github.com/containerd/btrfs/ioctl.go diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s deleted file mode 100644 index 269e173ca469..000000000000 diff --git a/_service b/_service index 7e0e404..b207126 100644 --- a/_service +++ b/_service @@ -1,5 +1,5 @@ - + https://github.com/containerd/containerd.git git containerd @@ -7,11 +7,8 @@ v1.7.17 .git - - - - *.tar + + containerd-*.tar xz - diff --git a/containerd-1.7.17_3a4de459a689.obscpio b/containerd-1.7.17_3a4de459a689.obscpio deleted file mode 100644 index 62518a6..0000000 --- a/containerd-1.7.17_3a4de459a689.obscpio +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7b376a2339a0751ec75a7e7a9f8607f563a07cb7c93c09cf9badfda5fa64600e -size 50037773 diff --git a/containerd-1.7.17_3a4de459a689.tar.xz b/containerd-1.7.17_3a4de459a689.tar.xz new file mode 100644 index 0000000..645202b --- /dev/null +++ b/containerd-1.7.17_3a4de459a689.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5aaf84248bedb272f99c4da77c0acb5d39d44a61e94f4cb1c95880c68a73c396 +size 5933672 diff --git a/containerd.changes b/containerd.changes index 42b9115..44c2999 100644 --- a/containerd.changes +++ b/containerd.changes @@ -3,9 +3,11 @@ Wed May 22 19:31:04 UTC 2024 - Aleksa Sarai - Update to containerd v1.7.17. Upstream release notes: +- Switch back to using tar_scm service. Aside from obs_scm using more bandwidth + and storage than a locally-compressed tar.xz, it seems there's some weird + issue with paths in obscpio that break our SLE-12-only patch. - Rebase patches: * 0001-BUILD-SLE12-revert-btrfs-depend-on-kernel-UAPI-inste.patch - - Update to containerd v1.7.16. Upstream release notes: CVE-2023-45288 bsc#1221400