Skip to content

Commit

Permalink
Import docker/docker/pkg/mount into runc
Browse files Browse the repository at this point in the history
This will help get rid of docker/docker dependency in runc 👼

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
  • Loading branch information
vdemeester committed Nov 8, 2017
1 parent ababa2d commit 3ca4c78
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 483 deletions.
2 changes: 1 addition & 1 deletion libcontainer/factory_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"runtime/debug"
"strconv"

"github.com/docker/docker/pkg/mount"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/cgroups/fs"
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/configs/validate"
"github.com/opencontainers/runc/libcontainer/intelrdt"
"github.com/opencontainers/runc/libcontainer/mount"
"github.com/opencontainers/runc/libcontainer/utils"

"golang.org/x/sys/unix"
Expand Down
2 changes: 1 addition & 1 deletion libcontainer/factory_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"reflect"
"testing"

"github.com/docker/docker/pkg/mount"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/mount"
"github.com/opencontainers/runc/libcontainer/utils"

"golang.org/x/sys/unix"
Expand Down
23 changes: 23 additions & 0 deletions libcontainer/mount/mount.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mount

// GetMounts retrieves a list of mounts for the current running process.
func GetMounts() ([]*Info, error) {
return parseMountTable()
}

// Mounted looks at /proc/self/mountinfo to determine of the specified
// mountpoint has been mounted
func Mounted(mountpoint string) (bool, error) {
entries, err := parseMountTable()
if err != nil {
return false, err
}

// Search the table for the mountpoint
for _, e := range entries {
if e.Mountpoint == mountpoint {
return true, nil
}
}
return false, nil
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,3 @@ func parseInfoFile(r io.Reader) ([]*Info, error) {
}
return out, nil
}

// PidMountInfo collects the mounts for a specific process ID. If the process
// ID is unknown, it is better to use `GetMounts` which will inspect
// "/proc/self/mountinfo" instead.
func PidMountInfo(pid int) ([]*Info, error) {
f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
if err != nil {
return nil, err
}
defer f.Close()

return parseInfoFile(f)
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion libcontainer/rootfs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"time"

"github.com/cyphar/filepath-securejoin"
"github.com/docker/docker/pkg/mount"
"github.com/mrunalp/fileutils"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runc/libcontainer/mount"
"github.com/opencontainers/runc/libcontainer/system"
libcontainerUtils "github.com/opencontainers/runc/libcontainer/utils"
"github.com/opencontainers/selinux/go-selinux/label"
Expand Down
69 changes: 0 additions & 69 deletions vendor/github.com/docker/docker/pkg/mount/flags.go

This file was deleted.

48 changes: 0 additions & 48 deletions vendor/github.com/docker/docker/pkg/mount/flags_freebsd.go

This file was deleted.

85 changes: 0 additions & 85 deletions vendor/github.com/docker/docker/pkg/mount/flags_linux.go

This file was deleted.

30 changes: 0 additions & 30 deletions vendor/github.com/docker/docker/pkg/mount/flags_unsupported.go

This file was deleted.

74 changes: 0 additions & 74 deletions vendor/github.com/docker/docker/pkg/mount/mount.go

This file was deleted.

Loading

0 comments on commit 3ca4c78

Please sign in to comment.