From: Zdenek Kabelac <zkabelac@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: best way to detect a dm device is dm-multipath from userspace?
Date: Tue, 25 Mar 2014 19:30:51 +0100 [thread overview]
Message-ID: <5331CB5B.4040701@redhat.com> (raw)
In-Reply-To: <20140325172022.GA32702@infradead.org>
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
next prev parent reply other threads:[~2014-03-25 18:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2014-03-25 22:54 ` Alasdair G Kergon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5331CB5B.4040701@redhat.com \
--to=zkabelac@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.