diff -Nru golang-go-zfs-2.1.1/debian/changelog golang-go-zfs-2.1.1.49.gf784269/debian/changelog --- golang-go-zfs-2.1.1/debian/changelog 2017-08-09 09:57:49.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/changelog 2020-11-25 18:45:29.000000000 +0000 @@ -1,3 +1,33 @@ +golang-go-zfs (2.1.1.49.gf784269-1) unstable; urgency=medium + + * Team upload. + + [ Alexandre Viau ] + * Point Vcs-* urls to salsa.debian.org. + + [ Debian Janitor ] + * Use secure copyright file specification URI. + * Bump debhelper from old 9 to 12. + * Set debhelper-compat version in Build-Depends. + * Change priority extra to priority optional. + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + * Apply multi-arch hints. + + golang-go-zfs-dev: Add Multi-Arch: foreign. + + [ Shengjing Zhu ] + * Update uscan watch file to track head version + * New upstream version 2.1.1.49.gf784269 + * Update Section to golang + * Update maintainer address to team+pkg-go@tracker.debian.org + * Update debhelper-compat to 13 + * Update Standards-Version to 4.5.1 (no changes) + * Add Rules-Requires-Root + * Add autopkgtest-pkg-go + * Add golang-github-google-uuid-dev to Depends + + -- Shengjing Zhu Thu, 26 Nov 2020 02:45:29 +0800 + golang-go-zfs (2.1.1-2) unstable; urgency=medium [ Paul Tagliamonte ] diff -Nru golang-go-zfs-2.1.1/debian/compat golang-go-zfs-2.1.1.49.gf784269/debian/compat --- golang-go-zfs-2.1.1/debian/compat 2017-08-08 18:00:06.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -9 diff -Nru golang-go-zfs-2.1.1/debian/control golang-go-zfs-2.1.1.49.gf784269/debian/control --- golang-go-zfs-2.1.1/debian/control 2017-08-09 09:57:31.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/control 2020-11-25 18:45:29.000000000 +0000 @@ -1,19 +1,27 @@ Source: golang-go-zfs -Section: devel -Priority: extra -Maintainer: pkg-go -Uploaders: Tianon Gravi , Tim Potter -Build-Depends: debhelper (>= 9), dh-golang, golang-any -Standards-Version: 3.9.6 +Section: golang +Priority: optional +Maintainer: Debian Go Packaging Team +Uploaders: Tianon Gravi , + Tim Potter , +Build-Depends: debhelper-compat (= 13), + dh-golang, + golang-any, + golang-github-google-uuid-dev, +Standards-Version: 4.5.1 Homepage: https://github.com/mistifyio/go-zfs -Vcs-Git: https://anonscm.debian.org/git/pkg-go/packages/golang-go-zfs.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-go/packages/golang-go-zfs.git +Vcs-Git: https://salsa.debian.org/go-team/packages/golang-go-zfs.git +Vcs-Browser: https://salsa.debian.org/go-team/packages/golang-go-zfs +Rules-Requires-Root: no XS-Go-Import-Path: github.com/mistifyio/go-zfs +Testsuite: autopkgtest-pkg-go Package: golang-go-zfs-dev Architecture: all -Depends: ${misc:Depends} -Recommends: zfs-fuse | zfsutils +Depends: golang-github-google-uuid-dev, + ${misc:Depends}, +Recommends: zfs-fuse | zfsutils, +Multi-Arch: foreign Description: Go library for ZFS manipulation Simple wrappers for ZFS command line tools, used for manipulating ZFS filesystems directly from within applications written in Go. diff -Nru golang-go-zfs-2.1.1/debian/copyright golang-go-zfs-2.1.1.49.gf784269/debian/copyright --- golang-go-zfs-2.1.1/debian/copyright 2017-08-08 18:00:06.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/copyright 2020-11-25 18:45:29.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Source: https://github.com/mistifyio/go-zfs Files: * diff -Nru golang-go-zfs-2.1.1/debian/gitlab-ci.yml golang-go-zfs-2.1.1.49.gf784269/debian/gitlab-ci.yml --- golang-go-zfs-2.1.1/debian/gitlab-ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/gitlab-ci.yml 2020-11-25 18:45:29.000000000 +0000 @@ -0,0 +1,28 @@ + +# auto-generated, DO NOT MODIFY. +# The authoritative copy of this file lives at: +# https://salsa.debian.org/go-team/ci/blob/master/cmd/ci/gitlabciyml.go + +# TODO: publish under debian-go-team/ci +image: stapelberg/ci2 + +test_the_archive: + artifacts: + paths: + - before-applying-commit.json + - after-applying-commit.json + script: + # Create an overlay to discard writes to /srv/gopath/src after the build: + - "rm -rf /cache/overlay/{upper,work}" + - "mkdir -p /cache/overlay/{upper,work}" + - "mount -t overlay overlay -o lowerdir=/srv/gopath/src,upperdir=/cache/overlay/upper,workdir=/cache/overlay/work /srv/gopath/src" + - "export GOPATH=/srv/gopath" + - "export GOCACHE=/cache/go" + # Build the world as-is: + - "ci-build -exemptions=/var/lib/ci-build/exemptions.json > before-applying-commit.json" + # Copy this package into the overlay: + - "GBP_CONF_FILES=:debian/gbp.conf gbp buildpackage --git-no-pristine-tar --git-ignore-branch --git-ignore-new --git-export-dir=/tmp/export --git-no-overlay --git-tarball-dir=/nonexistant --git-cleaner=/bin/true --git-builder='dpkg-buildpackage -S -d --no-sign'" + - "pgt-gopath -dsc /tmp/export/*.dsc" + # Rebuild the world: + - "ci-build -exemptions=/var/lib/ci-build/exemptions.json > after-applying-commit.json" + - "ci-diff before-applying-commit.json after-applying-commit.json" diff -Nru golang-go-zfs-2.1.1/debian/upstream/metadata golang-go-zfs-2.1.1.49.gf784269/debian/upstream/metadata --- golang-go-zfs-2.1.1/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/upstream/metadata 2020-11-25 18:45:29.000000000 +0000 @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/mistifyio/go-zfs/issues +Bug-Submit: https://github.com/mistifyio/go-zfs/issues/new +Repository: https://github.com/mistifyio/go-zfs.git +Repository-Browse: https://github.com/mistifyio/go-zfs diff -Nru golang-go-zfs-2.1.1/debian/watch golang-go-zfs-2.1.1.49.gf784269/debian/watch --- golang-go-zfs-2.1.1/debian/watch 2017-08-08 18:00:06.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/debian/watch 2020-11-25 18:45:29.000000000 +0000 @@ -1,3 +1,5 @@ -version=3 -opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/go-zfs-$1\.tar\.gz/ \ - https://github.com/mistifyio/go-zfs/tags .*/v?(\d\S*)\.tar\.gz +version=4 + +opts="mode=git, pgpmode=none, pretty=describe, uversionmangle=s/^v//" \ + https://github.com/mistifyio/go-zfs \ + HEAD diff -Nru golang-go-zfs-2.1.1/README.md golang-go-zfs-2.1.1.49.gf784269/README.md --- golang-go-zfs-2.1.1/README.md 2015-05-29 14:27:51.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/README.md 2019-04-13 22:22:19.000000000 +0000 @@ -29,7 +29,7 @@ ```go //assuming a zpool named test -//error handling ommitted +//error handling omitted f, err := zfs.CreateFilesystem("test/snapshot-test", nil) diff -Nru golang-go-zfs-2.1.1/.travis.yml golang-go-zfs-2.1.1.49.gf784269/.travis.yml --- golang-go-zfs-2.1.1/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/.travis.yml 2019-04-13 22:22:19.000000000 +0000 @@ -0,0 +1,43 @@ +language: go +dist: trusty +sudo: required +cache: + directories: + - $HOME/.ccache + - $HOME/zfs + +branches: + only: + - master + +env: + - rel=0.6.5.11 + - rel=0.7.6 + +go: + - "1.10.x" + - master + +before_install: + - export MAKEFLAGS=-j$(($(grep -c '^processor' /proc/cpuinfo) * 2 + 1)) + - export PATH=/usr/lib/ccache:$PATH + - go get github.com/alecthomas/gometalinter + - gometalinter --install --update + - sudo apt-get update -y && sudo apt-get install -y libattr1-dev libblkid-dev linux-headers-$(uname -r) tree uuid-dev + - mkdir -p $HOME/zfs + - cd $HOME/zfs + - [[ -d spl-$rel.tar.gz ]] || curl -L https://github.com/zfsonlinux/zfs/releases/download/zfs-$rel/spl-$rel.tar.gz | tar xz + - [[ -d zfs-$rel.tar.gz ]] || curl -L https://github.com/zfsonlinux/zfs/releases/download/zfs-$rel/zfs-$rel.tar.gz | tar xz + - (cd spl-$rel && ./configure --prefix=/usr && make && sudo make install) + - (cd zfs-$rel && ./configure --prefix=/usr && make && sudo make install) + - sudo modprobe zfs + - cd $TRAVIS_BUILD_DIR + +script: + - sudo -E $(which go) test -v ./... + - gometalinter --vendor --vendored-linters ./... || true + - gometalinter --errors --vendor --vendored-linters ./... + +notifications: + email: false + irc: "chat.freenode.net#cerana" diff -Nru golang-go-zfs-2.1.1/utils.go golang-go-zfs-2.1.1.49.gf784269/utils.go --- golang-go-zfs-2.1.1/utils.go 2015-05-29 14:27:51.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/utils.go 2019-04-13 22:22:19.000000000 +0000 @@ -2,12 +2,16 @@ import ( "bytes" + "errors" "fmt" "io" "os/exec" "regexp" + "runtime" "strconv" "strings" + + "github.com/google/uuid" ) type command struct { @@ -34,16 +38,17 @@ } cmd.Stderr = &stderr - debug := strings.Join([]string{cmd.Path, strings.Join(cmd.Args, " ")}, " ") - if logger != nil { - logger.Log(cmd.Args) - } + id := uuid.New().String() + joinedArgs := strings.Join(cmd.Args, " ") + + logger.Log([]string{"ID:" + id, "START", joinedArgs}) err := cmd.Run() + logger.Log([]string{"ID:" + id, "FINISH"}) if err != nil { return nil, &Error{ Err: err, - Debug: debug, + Debug: strings.Join([]string{cmd.Path, joinedArgs[1:]}, " "), Stderr: stderr.String(), } } @@ -88,34 +93,50 @@ } func (ds *Dataset) parseLine(line []string) error { - prop := line[1] - val := line[2] - var err error - switch prop { - case "available": - err = setUint(&ds.Avail, val) - case "compression": - setString(&ds.Compression, val) - case "mountpoint": - setString(&ds.Mountpoint, val) - case "quota": - err = setUint(&ds.Quota, val) - case "type": - setString(&ds.Type, val) - case "origin": - setString(&ds.Origin, val) - case "used": - err = setUint(&ds.Used, val) - case "volsize": - err = setUint(&ds.Volsize, val) - case "written": - err = setUint(&ds.Written, val) - case "logicalused": - err = setUint(&ds.Logicalused, val) + if len(line) != len(dsPropList) { + return errors.New("Output does not match what is expected on this platform") } - return err + setString(&ds.Name, line[0]) + setString(&ds.Origin, line[1]) + + if err = setUint(&ds.Used, line[2]); err != nil { + return err + } + if err = setUint(&ds.Avail, line[3]); err != nil { + return err + } + + setString(&ds.Mountpoint, line[4]) + setString(&ds.Compression, line[5]) + setString(&ds.Type, line[6]) + + if err = setUint(&ds.Volsize, line[7]); err != nil { + return err + } + if err = setUint(&ds.Quota, line[8]); err != nil { + return err + } + if err = setUint(&ds.Referenced, line[9]); err != nil { + return err + } + + if runtime.GOOS == "solaris" { + return nil + } + + if err = setUint(&ds.Written, line[10]); err != nil { + return err + } + if err = setUint(&ds.Logicalused, line[11]); err != nil { + return err + } + if err = setUint(&ds.Usedbydataset, line[12]); err != nil { + return err + } + + return nil } /* @@ -264,7 +285,8 @@ } func listByType(t, filter string) ([]*Dataset, error) { - args := []string{"get", "-rHp", "-t", t, "all"} + args := []string{"list", "-rHp", "-t", t, "-o", dsPropListOptions} + if filter != "" { args = append(args, filter) } @@ -307,6 +329,8 @@ var err error switch prop { + case "name": + setString(&z.Name, val) case "health": setString(&z.Health, val) case "allocated": @@ -315,6 +339,22 @@ err = setUint(&z.Size, val) case "free": err = setUint(&z.Free, val) + case "fragmentation": + // Trim trailing "%" before parsing uint + i := strings.Index(val, "%") + if i < 0 { + i = len(val) + } + err = setUint(&z.Fragmentation, val[:i]) + case "readonly": + z.ReadOnly = val == "on" + case "freeing": + err = setUint(&z.Freeing, val) + case "leaked": + err = setUint(&z.Leaked, val) + case "dedupratio": + // Trim trailing "x" before parsing float64 + z.DedupRatio, err = strconv.ParseFloat(val[:len(val)-1], 64) } return err } diff -Nru golang-go-zfs-2.1.1/utils_notsolaris.go golang-go-zfs-2.1.1.49.gf784269/utils_notsolaris.go --- golang-go-zfs-2.1.1/utils_notsolaris.go 1970-01-01 00:00:00.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/utils_notsolaris.go 2019-04-13 22:22:19.000000000 +0000 @@ -0,0 +1,17 @@ +// +build !solaris + +package zfs + +import ( + "strings" +) + +// List of ZFS properties to retrieve from zfs list command on a non-Solaris platform +var dsPropList = []string{"name", "origin", "used", "available", "mountpoint", "compression", "type", "volsize", "quota", "referenced", "written", "logicalused", "usedbydataset"} + +var dsPropListOptions = strings.Join(dsPropList, ",") + +// List of Zpool properties to retrieve from zpool list command on a non-Solaris platform +var zpoolPropList = []string{"name", "health", "allocated", "size", "free", "readonly", "dedupratio", "fragmentation", "freeing", "leaked"} +var zpoolPropListOptions = strings.Join(zpoolPropList, ",") +var zpoolArgs = []string{"get", "-p", zpoolPropListOptions} diff -Nru golang-go-zfs-2.1.1/utils_solaris.go golang-go-zfs-2.1.1.49.gf784269/utils_solaris.go --- golang-go-zfs-2.1.1/utils_solaris.go 1970-01-01 00:00:00.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/utils_solaris.go 2019-04-13 22:22:19.000000000 +0000 @@ -0,0 +1,17 @@ +// +build solaris + +package zfs + +import ( + "strings" +) + +// List of ZFS properties to retrieve from zfs list command on a Solaris platform +var dsPropList = []string{"name", "origin", "used", "available", "mountpoint", "compression", "type", "volsize", "quota", "referenced"} + +var dsPropListOptions = strings.Join(dsPropList, ",") + +// List of Zpool properties to retrieve from zpool list command on a non-Solaris platform +var zpoolPropList = []string{"name", "health", "allocated", "size", "free", "readonly", "dedupratio"} +var zpoolPropListOptions = strings.Join(zpoolPropList, ",") +var zpoolArgs = []string{"get", "-p", zpoolPropListOptions} diff -Nru golang-go-zfs-2.1.1/zfs.go golang-go-zfs-2.1.1.49.gf784269/zfs.go --- golang-go-zfs-2.1.1/zfs.go 2015-05-29 14:27:51.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/zfs.go 2019-04-13 22:22:19.000000000 +0000 @@ -32,9 +32,10 @@ Type string Written uint64 Volsize uint64 - Usedbydataset uint64 Logicalused uint64 + Usedbydataset uint64 Quota uint64 + Referenced uint64 } // InodeType is the type of inode as reported by Diff @@ -92,12 +93,20 @@ Log(cmd []string) } -var logger Logger +type defaultLogger struct{} + +func (*defaultLogger) Log(cmd []string) { + return +} + +var logger Logger = &defaultLogger{} // SetLogger set a log handler to log all commands including arguments before // they are executed func SetLogger(l Logger) { - logger = l + if l != nil { + logger = l + } } // zfs is a helper function to wrap typical calls to zfs. @@ -137,7 +146,7 @@ // GetDataset retrieves a single ZFS dataset by name. This dataset could be // any valid ZFS dataset type, such as a clone, filesystem, snapshot, or volume. func GetDataset(name string) (*Dataset, error) { - out, err := zfs("get", "-Hp", "all", name) + out, err := zfs("list", "-Hp", "-o", dsPropListOptions, name) if err != nil { return nil, err } @@ -172,6 +181,46 @@ return GetDataset(dest) } +// Unmount unmounts currently mounted ZFS file systems. +func (d *Dataset) Unmount(force bool) (*Dataset, error) { + if d.Type == DatasetSnapshot { + return nil, errors.New("cannot unmount snapshots") + } + args := make([]string, 1, 3) + args[0] = "umount" + if force { + args = append(args, "-f") + } + args = append(args, d.Name) + _, err := zfs(args...) + if err != nil { + return nil, err + } + return GetDataset(d.Name) +} + +// Mount mounts ZFS file systems. +func (d *Dataset) Mount(overlay bool, options []string) (*Dataset, error) { + if d.Type == DatasetSnapshot { + return nil, errors.New("cannot mount snapshots") + } + args := make([]string, 1, 5) + args[0] = "mount" + if overlay { + args = append(args, "-O") + } + if options != nil { + args = append(args, "-o") + args = append(args, strings.Join(options, ",")) + } + args = append(args, d.Name) + _, err := zfs(args...) + if err != nil { + return nil, err + } + return GetDataset(d.Name) +} + // ReceiveSnapshot receives a ZFS stream from the input io.Reader, creates a // new snapshot with the specified name, and streams the input data into the // newly-created snapshot. @@ -259,7 +308,7 @@ // A full list of available ZFS properties may be found here: // https://www.freebsd.org/cgi/man.cgi?zfs(8). func (d *Dataset) GetProperty(key string) (string, error) { - out, err := zfs("get", key, d.Name) + out, err := zfs("get", "-H", key, d.Name) if err != nil { return "", err } @@ -267,6 +316,26 @@ return out[0][2], nil } +// Rename renames a dataset. +func (d *Dataset) Rename(name string, createParent bool, recursiveRenameSnapshots bool) (*Dataset, error) { + args := make([]string, 3, 5) + args[0] = "rename" + args[1] = d.Name + args[2] = name + if createParent { + args = append(args, "-p") + } + if recursiveRenameSnapshots { + args = append(args, "-r") + } + _, err := zfs(args...) + if err != nil { + return d, err + } + + return GetDataset(name) +} + // Snapshots returns a slice of all ZFS snapshots of a given dataset. func (d *Dataset) Snapshots() ([]*Dataset, error) { return Snapshots(d.Name) @@ -335,13 +404,14 @@ // A recursion depth may be specified, or a depth of 0 allows unlimited // recursion. func (d *Dataset) Children(depth uint64) ([]*Dataset, error) { - args := []string{"get", "-t", "all", "-Hp", "all"} + args := []string{"list"} if depth > 0 { args = append(args, "-d") args = append(args, strconv.FormatUint(depth, 10)) } else { args = append(args, "-r") } + args = append(args, "-t", "all", "-Hp", "-o", dsPropListOptions) args = append(args, d.Name) out, err := zfs(args...) diff -Nru golang-go-zfs-2.1.1/zfs_test.go golang-go-zfs-2.1.1.49.gf784269/zfs_test.go --- golang-go-zfs-2.1.1/zfs_test.go 2015-05-29 14:27:51.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/zfs_test.go 2019-04-13 22:22:19.000000000 +0000 @@ -11,7 +11,7 @@ "testing" "time" - "github.com/mistifyio/go-zfs" + zfs "github.com/mistifyio/go-zfs" ) func sleep(delay int) { @@ -41,6 +41,15 @@ } } +// nok fails the test if an err is nil. +func nok(tb testing.TB, err error) { + if err == nil { + _, file, line, _ := runtime.Caller(1) + fmt.Printf("\033[31m%s:%d: expected error: %s\033[39m\n\n", filepath.Base(file), line, err.Error()) + tb.FailNow() + } +} + // equals fails the test if exp is not equal to act. func equals(tb testing.TB, exp, act interface{}) { if !reflect.DeepEqual(exp, act) { @@ -78,7 +87,24 @@ ok(t, err) equals(t, zfs.DatasetFilesystem, ds.Type) equals(t, "", ds.Origin) - assert(t, ds.Logicalused > 0, "Logicalused is not greater than 0") + if runtime.GOOS != "solaris" { + assert(t, ds.Logicalused != 0, "Logicalused is not greater than 0") + } + }) +} + +func TestDatasetGetProperty(t *testing.T) { + zpoolTest(t, func() { + ds, err := zfs.GetDataset("test") + ok(t, err) + + prop, err := ds.GetProperty("foobarbaz") + nok(t, err) + equals(t, "", prop) + + prop, err = ds.GetProperty("compression") + ok(t, err) + equals(t, "off", prop) }) } @@ -264,8 +290,13 @@ zpoolTest(t, func() { pools, err := zfs.ListZpools() ok(t, err) - equals(t, "test", pools[0].Name) - + for _, pool := range pools { + if pool.Name == "test" { + equals(t, "test", pool.Name) + return + } + } + t.Fatal("Failed to find test pool") }) } @@ -332,23 +363,45 @@ ok(t, err) equals(t, 4, len(inodeChanges)) - equals(t, "/test/origin/", inodeChanges[0].Path) - equals(t, zfs.Directory, inodeChanges[0].Type) - equals(t, zfs.Modified, inodeChanges[0].Change) - - equals(t, "/test/origin/linked", inodeChanges[1].Path) - equals(t, zfs.File, inodeChanges[1].Type) - equals(t, zfs.Modified, inodeChanges[1].Change) - equals(t, 1, inodeChanges[1].ReferenceCountChange) - - equals(t, "/test/origin/file", inodeChanges[2].Path) - equals(t, "/test/origin/file-new", inodeChanges[2].NewPath) - equals(t, zfs.File, inodeChanges[2].Type) - equals(t, zfs.Renamed, inodeChanges[2].Change) - - equals(t, "/test/origin/i ❤ unicode", inodeChanges[3].Path) - equals(t, zfs.File, inodeChanges[3].Type) - equals(t, zfs.Created, inodeChanges[3].Change) + unicodePath := "/test/origin/i\x040\x1c2\x135\x144\x040unicode" + wants := map[string]*zfs.InodeChange{ + "/test/origin/linked": &zfs.InodeChange{ + Type: zfs.File, + Change: zfs.Modified, + ReferenceCountChange: 1, + }, + "/test/origin/file": &zfs.InodeChange{ + Type: zfs.File, + Change: zfs.Renamed, + NewPath: "/test/origin/file-new", + }, + "/test/origin/i ❤ unicode": &zfs.InodeChange{ + Path: "❤❤ unicode ❤❤", + Type: zfs.File, + Change: zfs.Created, + }, + unicodePath: &zfs.InodeChange{ + Path: "❤❤ unicode ❤❤", + Type: zfs.File, + Change: zfs.Created, + }, + "/test/origin/": &zfs.InodeChange{ + Type: zfs.Directory, + Change: zfs.Modified, + }, + } + for _, change := range inodeChanges { + want := wants[change.Path] + want.Path = change.Path + delete(wants, change.Path) + + equals(t, want, change) + } + + equals(t, 1, len(wants)) + for _, want := range wants { + equals(t, "❤❤ unicode ❤❤", want.Path) + } ok(t, movedFile.Close()) ok(t, unicodeFile.Close()) diff -Nru golang-go-zfs-2.1.1/zpool.go golang-go-zfs-2.1.1.49.gf784269/zpool.go --- golang-go-zfs-2.1.1/zpool.go 2015-05-29 14:27:51.000000000 +0000 +++ golang-go-zfs-2.1.1.49.gf784269/zpool.go 2019-04-13 22:22:19.000000000 +0000 @@ -15,11 +15,16 @@ // Zpool is a ZFS zpool. A pool is a top-level structure in ZFS, and can // contain many descendent datasets. type Zpool struct { - Name string - Health string - Allocated uint64 - Size uint64 - Free uint64 + Name string + Health string + Allocated uint64 + Size uint64 + Free uint64 + Fragmentation uint64 + ReadOnly bool + Freeing uint64 + Leaked uint64 + DedupRatio float64 } // zpool is a helper function to wrap typical calls to zpool. @@ -30,7 +35,9 @@ // GetZpool retrieves a single ZFS zpool by name. func GetZpool(name string) (*Zpool, error) { - out, err := zpool("get", "all", "-p", name) + args := zpoolArgs + args = append(args, name) + out, err := zpool(args...) if err != nil { return nil, err }