MCPcopy
hub / github.com/containerd/containerd / RemoveIDMapOption

Function RemoveIDMapOption

core/mount/temp.go:109–125  ·  view source on GitHub ↗

RemoveIDMapOption copies and removes the uidmap/gidmap options on any of the mounts using it.

(mounts []Mount)

Source from the content-addressed store, hash-verified

107
108// RemoveIDMapOption copies and removes the uidmap/gidmap options on any of the mounts using it.
109func RemoveIDMapOption(mounts []Mount) []Mount {
110 var out []Mount
111 for i, m := range mounts {
112 for j, opt := range m.Options {
113 if strings.HasPrefix(opt, "uidmap") || strings.HasPrefix(opt, "gidmap") {
114 if out == nil {
115 out = copyMounts(mounts)
116 }
117 out[i].Options = append(out[i].Options[:j], out[i].Options[j+1:]...)
118 }
119 }
120 }
121 if out != nil {
122 return out
123 }
124 return mounts
125}
126
127// copyMounts creates a copy of the original slice to allow for modification and not altering the original
128func copyMounts(in []Mount) []Mount {

Callers 1

WithVolumesFunction · 0.92

Calls 1

copyMountsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…