MCPcopy
hub / github.com/containerd/containerd / setLoopAutoclear

Function setLoopAutoclear

core/mount/losetup_linux.go:195–216  ·  view source on GitHub ↗
(loop *os.File, autoclear bool)

Source from the content-addressed store, hash-verified

193}
194
195func setLoopAutoclear(loop *os.File, autoclear bool) error {
196 info, err := unix.IoctlLoopGetStatus64(int(loop.Fd()))
197 if err != nil {
198 return fmt.Errorf("failed to get loop device info: %w", err)
199 }
200
201 flags := info.Flags
202 if autoclear {
203 flags |= unix.LO_FLAGS_AUTOCLEAR
204 } else {
205 flags &= ^uint32(unix.LO_FLAGS_AUTOCLEAR)
206 }
207
208 if flags != info.Flags {
209 info.Flags = flags
210 err = unix.IoctlLoopSetStatus64(int(loop.Fd()), info)
211 if err != nil {
212 return fmt.Errorf("failed to set loop device info: %w", err)
213 }
214 }
215 return nil
216}
217
218func removeLoop(loopdev string) error {
219 file, err := os.Open(loopdev)

Callers 2

MountMethod · 0.85
UnmountMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…