Merge pull request #3966 from zhsj/update-btrfs

vendor: bump containerd/btrfs to 153935315f4ab9be5bf03650a1341454b05efa5d
This commit is contained in:
Akihiro Suda 2020-01-17 15:30:10 +09:00 committed by GitHub
commit 64b08f90e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 86 deletions

View File

@ -1,7 +1,7 @@
github.com/beorn7/perks 37c8de3658fcb183f997c4e13e8337516ab753e6 # v1.0.1
github.com/BurntSushi/toml 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 # v0.3.1
github.com/cespare/xxhash/v2 d7df74196a9e781ede915320c11c378c1b2f3a1f # v2.1.1
github.com/containerd/btrfs af5082808c833de0e79c1e72eea9fea239364877
github.com/containerd/btrfs 153935315f4ab9be5bf03650a1341454b05efa5d
github.com/containerd/cgroups 7347743e5d1e8500d9f27c8e748e689ed991d92b
github.com/containerd/console 8375c3424e4d7b114e8a90a4a40c8e1b40d1d4e6
github.com/containerd/continuity 0ec596719c75bfd42908850990acea594b7593ac

View File

@ -1,5 +1,6 @@
# go-btrfs
[![GoDoc](https://godoc.org/github.com/containerd/btrfs?status.svg)](https://godoc.org/github.com/containerd/btrfs) [![Build Status](https://travis-ci.org/stevvooe/go-btrfs.svg?branch=master)](https://travis-ci.org/stevvooe/go-btrfs)
[![GoDoc](https://godoc.org/github.com/containerd/btrfs?status.svg)](https://godoc.org/github.com/containerd/btrfs)
[![Build Status](https://travis-ci.org/containerd/btrfs.svg?branch=master)](https://travis-ci.org/containerd/btrfs)
Native Go bindings for btrfs.
@ -14,7 +15,7 @@ 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.
Preferrably, this could be resolved, so contributions in this direction are
Preferably, this could be resolved, so contributions in this direction are
greatly appreciated.
## Applying License Header to New Files

View File

@ -14,25 +14,8 @@
limitations under the License.
*/
/*
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 "sort"
/*
#include <stddef.h>
#include <btrfs/ioctl.h>
@ -47,12 +30,17 @@ 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 {
@ -146,7 +134,7 @@ func subvolMap(path string) (map[uint64]*Info, error) {
var (
sh C.struct_btrfs_ioctl_search_header
shSize = unsafe.Sizeof(sh)
buf = (*[1<<31 - 1]byte)(unsafe.Pointer(&args.buf[0]))[:C.BTRFS_SEARCH_ARGS_BUFSIZE]
buf = (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.buf[0]))[:C.BTRFS_SEARCH_ARGS_BUFSIZE]
)
for i := 0; i < int(args.key.nr_items); i++ {
@ -287,7 +275,7 @@ func SubvolCreate(path string) error {
if len(name) > C.BTRFS_PATH_NAME_MAX {
return errors.Errorf("%q too long for subvolume", name)
}
nameptr := (*[1<<31 - 1]byte)(unsafe.Pointer(&args.name[0]))
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))
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 {
@ -304,7 +292,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error {
dstfp, err := openSubvolDir(dstdir)
if err != nil {
return errors.Wrapf(err, "opening snapshot desination subvolume failed")
return errors.Wrapf(err, "opening snapshot destination subvolume failed")
}
defer dstfp.Close()
@ -323,7 +311,7 @@ func SubvolSnapshot(dst, src string, readonly bool) error {
return errors.Errorf("%q too long for subvolume", dstname)
}
nameptr := (*[1<<31 - 1]byte)(unsafe.Pointer(name))
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(name))
copy(nameptr[:C.BTRFS_SUBVOL_NAME_MAX], []byte(dstname))
if readonly {
@ -382,7 +370,7 @@ func SubvolDelete(path string) error {
return errors.Errorf("%q too long for subvolume", name)
}
nameptr := (*[1<<31 - 1]byte)(unsafe.Pointer(&args.name[0]))
nameptr := (*[maxByteSliceSize]byte)(unsafe.Pointer(&args.name[0]))
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 {

View File

@ -14,20 +14,5 @@
limitations under the License.
*/
/*
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

5
vendor/github.com/containerd/btrfs/go.mod generated vendored Normal file
View File

@ -0,0 +1,5 @@
module github.com/containerd/btrfs
go 1.13
require github.com/pkg/errors v0.8.1

View File

@ -14,21 +14,6 @@
limitations under the License.
*/
/*
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
/*
@ -66,7 +51,7 @@ var (
)
func uuidString(uuid *[C.BTRFS_UUID_SIZE]C.u8) string {
b := (*[1<<31 - 1]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE]
b := (*[maxByteSliceSize]byte)(unsafe.Pointer(uuid))[:C.BTRFS_UUID_SIZE]
if bytes.Equal(b, zeros) {
return ""

View File

@ -14,21 +14,6 @@
limitations under the License.
*/
/*
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.

View File

@ -14,21 +14,6 @@
limitations under the License.
*/
/*
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"