How do you mount a loop device (similar to hdiutil attach
) on XNU / Darwin in C?
Specifically I'm looking for functionality that would be in linux/loop.h, but on XNU. ( I'm going to be doing this on iOS, don't ask ;) )
How do you mount a loop device (similar to hdiutil attach
) on XNU / Darwin in C?
Specifically I'm looking for functionality that would be in linux/loop.h, but on XNU. ( I'm going to be doing this on iOS, don't ask ;) )
Copyright © 2021 Jogjafile Inc.
There is no public API for disk images in macOS/Darwin. The disk image mechanism used by
hdiutil
is not implemented in core XNU itself, but the kext/System/Library/Extensions/IOHDIXController.kext
. I have seen no documentation or source code on it, and I am not aware of a user space library for interfacing with it which is a public API. You will likely need to shell out tohdiutil
on macOS.Whether there's any chance of doing this on iOS is another question. (I assume you are talking about a jailbroken system) Judging by how OTA updates work in iOS, I can't think of anything else for which the OS itself might use disk images. So it seems likely that iOS has no disk image support at all. You could see what happens if you load an .iso or .dmg onto a USB storage device, connect that to your iDevice and try to open it in Files.app, but I'm not especially optimistic you'll be able to open them.