From 23751c9ced60b59523668e3d4fff965d238022b0 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Tue, 6 Mar 2018 13:16:56 -0800 Subject: [PATCH] vendor: update btrfs dependency Signed-off-by: Stephen J Day --- vendor.conf | 2 +- vendor/github.com/containerd/btrfs/README.md | 20 +++++++++++ vendor/github.com/containerd/btrfs/btrfs.go | 36 +++++++++++++------ vendor/github.com/containerd/btrfs/doc.go | 17 +++++++++ vendor/github.com/containerd/btrfs/helpers.go | 15 ++++++++ vendor/github.com/containerd/btrfs/info.go | 15 ++++++++ vendor/github.com/containerd/btrfs/ioctl.go | 15 ++++++++ 7 files changed, 108 insertions(+), 12 deletions(-) create mode 100644 vendor/github.com/containerd/btrfs/doc.go diff --git a/vendor.conf b/vendor.conf index 9145c87c5..81f2409f2 100644 --- a/vendor.conf +++ b/vendor.conf @@ -18,7 +18,7 @@ github.com/golang/protobuf 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 github.com/opencontainers/runtime-spec v1.0.1 github.com/opencontainers/runc a618ab5a0186905949ee463dbb762c3d23e12a80 github.com/sirupsen/logrus v1.0.0 -github.com/containerd/btrfs cc52c4dea2ce11a44e6639e561bb5c2af9ada9e3 +github.com/containerd/btrfs 2e1aa0ddf94f91fa282b6ed87c23bf0d64911244 github.com/pmezard/go-difflib v1.0.0 github.com/containerd/fifo fbfb6a11ec671efbe94ad1c12c2e98773f19e1e6 github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c diff --git a/vendor/github.com/containerd/btrfs/README.md b/vendor/github.com/containerd/btrfs/README.md index 4d0f2730f..f6c472064 100644 --- a/vendor/github.com/containerd/btrfs/README.md +++ b/vendor/github.com/containerd/btrfs/README.md @@ -16,3 +16,23 @@ 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 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/ + +# License + +The copyright to this repository is held by the The containerd Authors and the +codebase is released under the [Apache 2.0 license](LICENSE). diff --git a/vendor/github.com/containerd/btrfs/btrfs.go b/vendor/github.com/containerd/btrfs/btrfs.go index bbe7e0cd4..015cb62a2 100644 --- a/vendor/github.com/containerd/btrfs/btrfs.go +++ b/vendor/github.com/containerd/btrfs/btrfs.go @@ -1,3 +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 import "sort" @@ -7,10 +22,6 @@ import "sort" #include #include "btrfs.h" -// Required because Go has struct casting rules for negative numbers -const __u64 u64_BTRFS_LAST_FREE_OBJECTID = (__u64)BTRFS_LAST_FREE_OBJECTID; -const __u64 negative_one = (__u64)-1; - static char* get_name_btrfs_ioctl_vol_args_v2(struct btrfs_ioctl_vol_args_v2* btrfs_struct) { return btrfs_struct->name; } @@ -81,13 +92,13 @@ func SubvolInfo(path string) (info Info, err error) { } if info, ok := subvolsByID[id]; ok { - return info, nil + return *info, nil } return info, errors.Errorf("%q not found", path) } -func subvolMap(path string) (map[uint64]Info, error) { +func subvolMap(path string) (map[uint64]*Info, error) { fp, err := openSubvolDir(path) if err != nil { return nil, err @@ -100,11 +111,11 @@ func subvolMap(path string) (map[uint64]Info, error) { 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.u64_BTRFS_LAST_FREE_OBJECTID - args.key.max_offset = C.negative_one - args.key.max_transid = C.negative_one + args.key.max_objectid = C.BTRFS_LAST_FREE_OBJECTID + args.key.max_offset = ^C.__u64(0) + args.key.max_transid = ^C.__u64(0) - subvolsByID := map[uint64]Info{} + subvolsByID := make(map[uint64]*Info) for { args.key.nr_items = 4096 @@ -127,6 +138,9 @@ func subvolMap(path string) (map[uint64]Info, error) { 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 { @@ -233,7 +247,7 @@ func SubvolList(path string) ([]Info, error) { subvols := make([]Info, 0, len(subvolsByID)) for _, sv := range subvolsByID { - subvols = append(subvols, sv) + subvols = append(subvols, *sv) } sort.Sort(infosByID(subvols)) diff --git a/vendor/github.com/containerd/btrfs/doc.go b/vendor/github.com/containerd/btrfs/doc.go new file mode 100644 index 000000000..8d572ddf4 --- /dev/null +++ b/vendor/github.com/containerd/btrfs/doc.go @@ -0,0 +1,17 @@ +/* + 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 index cc417abaa..a48270625 100644 --- a/vendor/github.com/containerd/btrfs/helpers.go +++ b/vendor/github.com/containerd/btrfs/helpers.go @@ -1,3 +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 /* diff --git a/vendor/github.com/containerd/btrfs/info.go b/vendor/github.com/containerd/btrfs/info.go index 9850c9bae..c283a4e8d 100644 --- a/vendor/github.com/containerd/btrfs/info.go +++ b/vendor/github.com/containerd/btrfs/info.go @@ -1,3 +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 // Info describes metadata about a btrfs subvolume. diff --git a/vendor/github.com/containerd/btrfs/ioctl.go b/vendor/github.com/containerd/btrfs/ioctl.go index 369b6d078..8df9bd0a7 100644 --- a/vendor/github.com/containerd/btrfs/ioctl.go +++ b/vendor/github.com/containerd/btrfs/ioctl.go @@ -1,3 +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 import "syscall"