Skip to contentSkip to conversation

Writing basic functions using libdevmapper.h

DISCUSSION Taavi Ilves 1 participant 1 message Aug 1, 2005 Device mapper

lore
Share & tools
lore
#0 lore raw

Hi!

I'm a quite C newbie, but for my school-project I need something to be done with device-mapper.

Problem is quite simple: I have a device-mapper device ( in /dev/mapper ) and I must find out which loop ( or actually whatever ) device is behind that mapper-device device.

Example: status output with cryptsetup

# cryptsetup status /dev/mapper/secret10
/dev/mapper//dev/mapper/secret10 is active:
  cipher:  aes-cbc-plain
  keysize: 256 bits
  device:  /dev/loop/1
  offset:  0 sectors
  size:    917 sectors
  mode:    read/write

This device field is what I'm looking for. I have looked into dm-setup and cryptsetup too, where libdevmapper.h is being used to get such information, but those applications were quite advance for me to study.

So I seek documentation and maybe some simple examples to learn how to use libdevmapper.h . I don't need full source-code solution for my problem, but still I welcome anything that leads to the solution. Thanks ahead!

Best wishes,
Taavi Ilves