github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/engine/pkg/mount/deprecated.go (about) 1 package mount // import "github.com/docker/docker/pkg/mount" 2 3 // Deprecated: this package is not maintained and will be removed. 4 // Use github.com/moby/sys/mount and github.com/moby/sys/mountinfo instead. 5 6 import ( 7 "github.com/moby/sys/mountinfo" 8 ) 9 10 //nolint:golint 11 type ( 12 // FilterFunc is a type. 13 // Deprecated: use github.com/moby/sys/mountinfo instead. 14 FilterFunc = func(*Info) (skip, stop bool) 15 16 // Info is a type 17 // Deprecated: use github.com/moby/sys/mountinfo instead. 18 Info struct { 19 ID, Parent, Major, Minor int 20 Root, Mountpoint, Opts, Optional, Fstype, Source, VfsOpts string 21 } 22 ) 23 24 // Deprecated: use github.com/moby/sys/mountinfo instead. 25 // 26 //nolint:golint 27 var ( 28 Mounted = mountinfo.Mounted 29 PrefixFilter = mountinfo.PrefixFilter 30 SingleEntryFilter = mountinfo.SingleEntryFilter 31 ParentsFilter = mountinfo.ParentsFilter 32 FstypeFilter = mountinfo.FSTypeFilter 33 ) 34 35 // GetMounts is a function. 36 // 37 // Deprecated: use github.com/moby/sys/mountinfo.GetMounts() instead. 38 // 39 //nolint:golint 40 func GetMounts(f FilterFunc) ([]*Info, error) { 41 fi := func(i *mountinfo.Info) (skip, stop bool) { 42 return f(toLegacyInfo(i)) 43 } 44 45 mounts, err := mountinfo.GetMounts(fi) 46 if err != nil { 47 return nil, err 48 } 49 mi := make([]*Info, len(mounts)) 50 for i, m := range mounts { 51 mi[i] = toLegacyInfo(m) 52 } 53 return mi, nil 54 } 55 56 func toLegacyInfo(m *mountinfo.Info) *Info { 57 return &Info{ 58 ID: m.ID, 59 Parent: m.Parent, 60 Major: m.Major, 61 Minor: m.Minor, 62 Root: m.Root, 63 Mountpoint: m.Mountpoint, 64 Opts: m.Options, 65 Fstype: m.FSType, 66 Source: m.Source, 67 VfsOpts: m.VFSOptions, 68 } 69 }