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 Aug 14, 2024
1 parent 408c51e commit a3a57a9
Show file tree
Hide file tree
Showing 23 changed files with 714 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.7.2
github.com/mrunalp/fileutils v0.5.0
github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb
github.com/opencontainers/selinux v1.9.1
Expand Down
2 changes: 2 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.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=
github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4=
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.0.3-0.20220825212826-86290f6a00fb h1:1xSVPOd7/UA+39/hXEGnBJ13p6JFB0E1EvQFlrRDOXI=
Expand Down

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

44 changes: 44 additions & 0 deletions vendor/github.com/moby/sys/mountinfo/doc.go

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

Loading

0 comments on commit a3a57a9

Please sign in to comment.