* best way to detect a dm device is dm-multipath from userspace?
@ 2014-03-25 17:20 Christoph Hellwig
2014-03-25 18:30 ` Zdenek Kabelac
2014-03-25 22:54 ` Alasdair G Kergon
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2014-03-25 17:20 UTC (permalink / raw)
To: dm-devel
For a little project I'm working on I'd like to find out if a given
device node is a dm-multipath device from C code. dm_is_dm_major tells
me if it's any DM node, but from there on it seems like I'd have to
grab the table name from dmsetup table output for which I'd need a name
for the device or similar.
Is there a good shortcut or library function for this check?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: best way to detect a dm device is dm-multipath from userspace?
2014-03-25 17:20 best way to detect a dm device is dm-multipath from userspace? Christoph Hellwig
@ 2014-03-25 18:30 ` Zdenek Kabelac
2014-03-25 22:54 ` Alasdair G Kergon
1 sibling, 0 replies; 3+ messages in thread
From: Zdenek Kabelac @ 2014-03-25 18:30 UTC (permalink / raw)
To: device-mapper development
Dne 25.3.2014 18:20, Christoph Hellwig napsal(a):
> For a little project I'm working on I'd like to find out if a given
> device node is a dm-multipath device from C code. dm_is_dm_major tells
> me if it's any DM node, but from there on it seems like I'd have to
> grab the table name from dmsetup table output for which I'd need a name
> for the device or similar.
>
> Is there a good shortcut or library function for this check?
>
dmsetup is just a commandline tool wrapper around libdm.
libdm has 'libdevmapper.h' interface.
For more complex usage look at dmsetup.c
In general you prepare dm_task structure
(dm_task_create()) - you present needed
options and you 'dm_task_run()' (wrapper over ioctl)
Then you read result.
If you know how to use 'dmsetup' - then you get pretty
easy conversion to libdm usage.
However from the message title - I think you just really want to check
content in udev database - which should be storing all info about device type.
All detection happens in rules - IMHO you should not try to add any new
detection..
Zdenek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: best way to detect a dm device is dm-multipath from userspace?
2014-03-25 17:20 best way to detect a dm device is dm-multipath from userspace? Christoph Hellwig
2014-03-25 18:30 ` Zdenek Kabelac
@ 2014-03-25 22:54 ` Alasdair G Kergon
1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2014-03-25 22:54 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: dm-devel
udev db as zkabelac says; or
sysfs .../dm/uuid; or
dm ioctl lookup by name or major:minor and get uuid (dmsetup info equivalent)
then check for mpath prefix on the uuid
[Assuming it was created with the standard tools]
Alasdair
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-25 22:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-25 17:20 best way to detect a dm device is dm-multipath from userspace? Christoph Hellwig
2014-03-25 18:30 ` Zdenek Kabelac
2014-03-25 22:54 ` Alasdair G Kergon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.