3

In the Red Hat documentation on Device Mapper, it reads:

"the application interface to the Device Mapper is the ioctl system call."

So far, I understand that the ioctls are sent to /dev/mapper/control (for most distributions), but it seems I will need to dig around the source code for dmsetup, libdevmapper, or similar to understand how the ioctls actually work and how to use them.

Are there any books, lectures, or documentation that expand on this topic? Am I stuck parsing through complicated source code? Am I better off using libdevmapper instead of the ioctl system calls? The man page for ioctl is too general to be of much use in this case.

  • Googling "device mapper ioctl" comes up with this, which seems quite readable and not really complicated. The corresponding file is include/uapi/linux/dm-ioctl.h. Documentation/device-mapper also exists. Or was the question "I don't understand what an ioctl is"? And what do you actually want to achieve? Understand how the kernel works? – dirkt Apr 28 '17 at 6:48
  • 1
    @dirkt Yes, thank you. A newer source of dm-ioctl.h can be found here. My goal is to use ioctl's to create, destroy, and modify dm-crypt targets. To clarify, my question is how to go about learning to use the ioctl's to accomplish these goals. I understand the extent of what the header tells me, but how to use the ioctls, including formatting and initializing the structs, correctly for each command, is not clear to me. – Zomp Apr 28 '17 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.