Skip to content

Commit

Permalink
cmd/runtimetest: use github.com/moby/sys/mountinfo
Browse files Browse the repository at this point in the history
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 <github@gone.nl>
  • Loading branch information
thaJeztah committed Sep 6, 2023
1 parent b54a88a commit 76e5efe
Show file tree
Hide file tree
Showing 23 changed files with 679 additions and 254 deletions.
12 changes: 6 additions & 6 deletions cmd/runtimetest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/syndtr/gocapability/capability"
"github.com/urfave/cli"

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

func (c *complianceTester) validateDefaultFS(spec *rspec.Spec) error {
mountInfos, err := mount.GetMounts()
mountInfos, err := mountinfo.GetMounts(nil)
if err != nil {
return nil
}

mountsMap := make(map[string]string)
for _, mountInfo := range mountInfos {
mountsMap[mountInfo.Mountpoint] = mountInfo.Fstype
mountsMap[mountInfo.Mountpoint] = mountInfo.FSType
}

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

func mountMatch(configMount rspec.Mount, sysMount *mount.Info) error {
func mountMatch(configMount rspec.Mount, sysMount *mountinfo.Info) error {
sys := rspec.Mount{
Destination: sysMount.Mountpoint,
Type: sysMount.Fstype,
Type: sysMount.FSType,
Source: sysMount.Source,
}

Expand Down Expand Up @@ -1137,7 +1137,7 @@ func (c *complianceTester) validatePosixMounts(spec *rspec.Spec) error {
return nil
}

mountInfos, err := mount.GetMounts()
mountInfos, err := mountinfo.GetMounts(nil)
if err != nil {
return err
}
Expand Down
6 changes: 0 additions & 6 deletions cmd/runtimetest/mount/README.md

This file was deleted.

45 changes: 0 additions & 45 deletions cmd/runtimetest/mount/mountinfo.go

This file was deleted.

41 changes: 0 additions & 41 deletions cmd/runtimetest/mount/mountinfo_freebsd.go

This file was deleted.

96 changes: 0 additions & 96 deletions cmd/runtimetest/mount/mountinfo_linux.go

This file was deleted.

38 changes: 0 additions & 38 deletions cmd/runtimetest/mount/mountinfo_solaris.go

This file was deleted.

13 changes: 0 additions & 13 deletions cmd/runtimetest/mount/mountinfo_unsupported.go

This file was deleted.

6 changes: 0 additions & 6 deletions cmd/runtimetest/mount/mountinfo_windows.go

This file was deleted.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/google/uuid v1.3.0
github.com/hashicorp/go-multierror v1.1.1
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b
github.com/moby/sys/mountinfo v0.6.2
github.com/mrunalp/fileutils v0.5.0
github.com/opencontainers/runtime-spec v1.1.0
github.com/opencontainers/selinux v1.9.1
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b h1:Ga1nclDSe8gOw37MVLMhfu2QKWtD6gvtQ298zsKVh8g=
github.com/mndrix/tap-go v0.0.0-20171203230836-629fa407e90b/go.mod h1:pzzDgJWZ34fGzaAZGFW22KVZDfyrYW+QABMrWnJBnSs=
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4=
github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ=
github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg=
Expand All @@ -37,6 +39,7 @@ github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 76e5efe

Please sign in to comment.