MCPcopy
hub / github.com/containerd/containerd / buildIDMappedPaths

Function buildIDMappedPaths

core/mount/mount_linux.go:324–333  ·  view source on GitHub ↗

buildIDMappedPaths constructs new lower directory paths through an idmapped mount of the commonDir. It takes the original lowerDirs, the commonDir of those dirs, and rewrites the paths to go through the idMappedDir directory to achieve idmapped lowerdirs ready for overlayfs

(lowerDirs []string, commonDir, idMappedDir string)

Source from the content-addressed store, hash-verified

322// It takes the original lowerDirs, the commonDir of those dirs, and rewrites the paths
323// to go through the idMappedDir directory to achieve idmapped lowerdirs ready for overlayfs
324func buildIDMappedPaths(lowerDirs []string, commonDir, idMappedDir string) []string {
325 tmpLowerDirs := make([]string, 0, len(lowerDirs))
326
327 for _, lowerDir := range lowerDirs {
328 relativePath := strings.TrimPrefix(lowerDir, commonDir)
329 tmpLowerDirs = append(tmpLowerDirs, filepath.Join(idMappedDir, relativePath))
330 }
331
332 return tmpLowerDirs
333}
334
335// parseMountOptions takes fstab style mount options and parses them for
336// use with a standard mount() syscall

Callers 2

TestBuildIDMappedPathsFunction · 0.85
doPrepareIDMappedOverlayFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestBuildIDMappedPathsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…