:: Re: [Dng] libudev and device queryi…
Top Page
Delete this message
Reply to this message
Author: Isaac Dunham
Date:  
To: dng
Subject: Re: [Dng] libudev and device querying
On Wed, Dec 31, 2014 at 02:44:49PM +0100, Enrico Weigelt, metux IT consult wrote:
> On 31.12.2014 13:44, Matteo Panella wrote:
> > On 31/12/2014 13:16, Enrico Weigelt, metux IT consult wrote:
> >> hmm, which ones for example ?
> >> maybe we should have a deeper look into them.
> >
> > Accounting for direct rdeps alone:
> >
> > (jessie-amd64)morpheus@vingilot:~$ apt-cache rdepends libudev1 libgudev-1.0-0
> > libudev1
> > Reverse Depends:
>
> <snip>
>
> Wow, that's a _really_ long list.
>
> Just did a little bit of digging. File managers seem to use it for
> querying available devices for mounting. IMHO, these tasks should
> be moved to an separate agent, which can be called via some simple
> command line interface - each device manager then should supply it's
> own implementation for that command.
>
> What do you think about that ?


It's possible to get a list without a device manager:
parse the output of 'blkid'.

The issue is that you'll need to update that periodically, and polling
is not very nice.

Setting up an fanotify hook on /dev wouldn't work since fanotify doesn't
support create/delete/move events, which are all that we want.

But maybe watching /dev/disk/by-{uuid,label}/ for create/delete events
with inotify would do it. Then we could configure mdev so that when a
device of devtype "partition" is added, it links it into the right
directory. udev already does this.
Those who use a static /dev without these directories would get the
results of the first blkid, and no updates--which seems like exactly
what they would want.

HTH,
Isaac Dunham