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