Skip to content

Commit d034327

Browse files
committed
cmd/runtimetest: use github.com/moby/sys/mountinfo
I noticed that this package was a fork of an old version of the "mount" package in the docker repository. This package was migrated to a separate module in the github.com/moby/sys repository, which should be easy to consume now that it's no longer insxide the docker repository. This patch switches the local fork to the new module. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 28f43fa commit d034327

23 files changed

+679
-254
lines changed

cmd/runtimetest/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/syndtr/gocapability/capability"
2121
"github.com/urfave/cli"
2222

23-
"github.com/opencontainers/runtime-tools/cmd/runtimetest/mount"
23+
"github.com/moby/sys/mountinfo"
2424
rfc2119 "github.com/opencontainers/runtime-tools/error"
2525
"github.com/opencontainers/runtime-tools/specerror"
2626
"github.com/opencontainers/selinux/go-selinux/label"
@@ -620,14 +620,14 @@ func (c *complianceTester) validateRootfsPropagation(spec *rspec.Spec) error {
620620
}
621621

622622
func (c *complianceTester) validateDefaultFS(spec *rspec.Spec) error {
623-
mountInfos, err := mount.GetMounts()
623+
mountInfos, err := mountinfo.GetMounts(nil)
624624
if err != nil {
625625
return nil
626626
}
627627

628628
mountsMap := make(map[string]string)
629629
for _, mountInfo := range mountInfos {
630-
mountsMap[mountInfo.Mountpoint] = mountInfo.Fstype
630+
mountsMap[mountInfo.Mountpoint] = mountInfo.FSType
631631
}
632632

633633
for fs, fstype := range defaultFS {
@@ -1091,10 +1091,10 @@ func (c *complianceTester) validateGIDMappings(spec *rspec.Spec) error {
10911091
return c.validateIDMappings(spec.Linux.GIDMappings, "/proc/self/gid_map", "linux.gidMappings")
10921092
}
10931093

1094-
func mountMatch(configMount rspec.Mount, sysMount *mount.Info) error {
1094+
func mountMatch(configMount rspec.Mount, sysMount *mountinfo.Info) error {
10951095
sys := rspec.Mount{
10961096
Destination: sysMount.Mountpoint,
1097-
Type: sysMount.Fstype,
1097+
Type: sysMount.FSType,
10981098
Source: sysMount.Source,
10991099
}
11001100

@@ -1137,7 +1137,7 @@ func (c *complianceTester) validatePosixMounts(spec *rspec.Spec) error {
11371137
return nil
11381138
}
11391139

1140-
mountInfos, err := mount.GetMounts()
1140+
mountInfos, err := mountinfo.GetMounts(nil)
11411141
if err != nil {
11421142
return err
11431143
}

cmd/runtimetest/mount/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

cmd/runtimetest/mount/mountinfo.go

Lines changed: 0 additions & 45 deletions
This file was deleted.

cmd/runtimetest/mount/mountinfo_freebsd.go

Lines changed: 0 additions & 41 deletions
This file was deleted.

cmd/runtimetest/mount/mountinfo_linux.go

Lines changed: 0 additions & 96 deletions
This file was deleted.

cmd/runtimetest/mount/mountinfo_solaris.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

cmd/runtimetest/mount/mountinfo_unsupported.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

cmd/runtimetest/mount/mountinfo_windows.go

Lines changed: 0 additions & 6 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ require (
77
github.com/google/uuid v1.3.0
88
github.com/hashicorp/go-multierror v1.1.1
99
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b
10+
github.com/moby/sys/mountinfo v0.6.2
1011
github.com/mrunalp/fileutils v0.5.0
1112
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb
1213
github.com/opencontainers/selinux v1.9.1

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
1111
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
1212
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b h1:Ga1nclDSe8gOw37MVLMhfu2QKWtD6gvtQ298zsKVh8g=
1313
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs=
14+
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
15+
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
1416
github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4=
1517
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
1618
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb h1:1xSVPOd7/UA+39/hXEGnBJ13p6JFB0E1EvQFlrRDOXI=
@@ -37,6 +39,7 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17
3739
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
3840
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3941
golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
42+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4043
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
4144
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4245
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

0 commit comments

Comments
 (0)