MCPcopy
hub / github.com/containerd/containerd / getFreeLoopDev

Function getFreeLoopDev

core/mount/losetup_linux.go:51–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51func getFreeLoopDev() (uint32, error) {
52 ctrl, err := os.OpenFile(loopControlPath, os.O_RDWR, 0)
53 if err != nil {
54 return 0, fmt.Errorf("could not open %v: %v", loopControlPath, err)
55 }
56 defer ctrl.Close()
57 num, err := unix.IoctlRetInt(int(ctrl.Fd()), unix.LOOP_CTL_GET_FREE)
58 if err != nil {
59 return 0, fmt.Errorf("could not get free loop device: %w", err)
60 }
61 return uint32(num), nil
62}
63
64// setupLoopDev attaches the backing file to the loop device and returns
65// the file handle for the loop device. The caller is responsible for

Callers 1

SetupLoopFunction · 0.85

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…