MCPcopy
hub / github.com/containerd/containerd / Mount

Method Mount

core/mount/loopback_handler_linux.go:36–66  ·  view source on GitHub ↗
(ctx context.Context, m Mount, mp string, _ []ActiveMount)

Source from the content-addressed store, hash-verified

34}
35
36func (loopbackHandler) Mount(ctx context.Context, m Mount, mp string, _ []ActiveMount) (ActiveMount, error) {
37 if m.Type != "loop" {
38 return ActiveMount{}, errdefs.ErrNotImplemented
39 }
40 params := LoopParams{
41 Autoclear: true,
42 }
43 // TODO: Handle readonly
44 // TODO: Handle direct io
45
46 t := time.Now()
47 loop, err := SetupLoop(m.Source, params)
48 if err != nil {
49 return ActiveMount{}, err
50 }
51 defer loop.Close()
52
53 if err := os.Symlink(loop.Name(), mp); err != nil {
54 return ActiveMount{}, err
55 }
56
57 if err := setLoopAutoclear(loop, false); err != nil {
58 return ActiveMount{}, err
59 }
60
61 return ActiveMount{
62 Mount: m,
63 MountedAt: &t,
64 MountPoint: mp,
65 }, nil
66}
67
68func (loopbackHandler) Unmount(ctx context.Context, path string) error {
69 loopdev, err := os.Readlink(path)

Callers

nothing calls this directly

Calls 5

SetupLoopFunction · 0.85
setLoopAutoclearFunction · 0.85
SymlinkMethod · 0.80
CloseMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected