<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
As promised, I let you know about my solution to circumvent the
udisks2 problems. A small and ugly program for collecting the most
important information about block devices can be found here:<br>
<a class="moz-txt-link-freetext" href="http://faert.net/jangdeblannen/udevblk.c">http://faert.net/jangdeblannen/udevblk.c</a><br>
<br>
This solution is not free of problems neither:<br>
- libudev is poorly documented. A small (very problem specific)
tutorial can be found on <a class="moz-txt-link-freetext" href="http://www.signal11.us/oss/udev/">http://www.signal11.us/oss/udev/</a>.<br>
- Another good source for everything about block devices is the
source code of udisks itself (see file device.c). Without it, I
would have been able to put it all together.<br>
- Something I learned from the udisks source code is that libudev by
far does not give us all the info we need. There are many things
that need to be done "manually".<br>
- An example: Good old udisks told us the name of files associated
with loop devices. This information is queried directly from the
loop device driver, by using an ioctl call. The consequence is, that
this info only is available when running as root. <br>
- Other data must be queried from the /sys tree.<br>
- If ever something changes inside /sys or the loop device driver
or... then the code probably needs to be adapted :-( This really
is bad news for any high level application. udisks was the perfect
single point for adaptations. I still am angry when think about how
easily they gave up compatibility in udisks2!<br>
<br>
I hope this is useful for others.<br>
<br>
Best greetings<br>
<br>
Guy<br>
<br>
<br>
<div class="moz-cite-prefix">On 31.10.2015 19:02, Federico wrote:<br>
</div>
<blockquote
cite="mid:CAMZm_CkwkB0FyDwRfK7cw1NO29AqOwiDrbj+B1sD7k8vEr-LTA@mail.gmail.com"
type="cite">
<div dir="ltr">@guy:
<div>What about using libudev? Note that these are just my 2
cents, i don't know how to achieve that with udisks2, sorry.</div>
<div><a moz-do-not-send="true"
href="http://www.signal11.us/oss/udev/">http://www.signal11.us/oss/udev/</a>.<br>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">Federico</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2015-10-30 19:00 GMT+01:00 Guy <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:genlist@faert.net" target="_blank">genlist@faert.net</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><span
class="">On 10/30/2015 05:02 PM, .. ink .. wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Oct 30, 2015 at 12:51 AM, Guy <<a
moz-do-not-send="true"
href="mailto:genlist@faert.net" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:genlist@faert.net">genlist@faert.net</a></a>>
wrote:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
This leaves me with a strange feeling... can I rely
on udisks2?<br>
</blockquote>
Probably not as you are not the target audience,look
at "audience"<br>
section in the following link<br>
for more info: <a moz-do-not-send="true"
href="http://udisks.freedesktop.org/docs/latest/udisks.8.html"
rel="noreferrer" target="_blank">http://udisks.freedesktop.org/docs/latest/udisks.8.html</a><br>
<br>
You can do all of these things yourself without udisks
ridding<br>
yourself of a dependency with<br>
an unstable API.<br>
<br>
You can get a list of partitions from parsing
"/proc/partitions".<br>
<br>
Let say you have a partition with a node address of
"/dev/sda5", you can get<br>
the starting offset of this partition by reading
"/sys/block/sda/sda5/start" and<br>
you can get the size of the partition by reading<br>
"/sys/block/sda/sda5/size". Both<br>
sizes are in sectors.<br>
<br>
you can get pretty much everything you want by pocking
around at<br>
"/sys/block/" and you can<br>
get a list of mounted volumes by parsing
"/proc/self/mountinfo".<br>
</blockquote>
</span>
That's exactely what I didn't want to do: Fiddling a bit a
everywhere until I have all the info. And fiddling again
after some updates...<br>
<br>
I am not the target audience? Wrong! It looks as if I am
*no longer* the target audience, because in udisks I was!
udisks2 breaks with the elementary code of conduct, that a
newer version must support previous ones.<br>
<br>
Is it really that difficult to produce a list of {Vendor,
Model, Serial number, Size, Linux-device and Sector-size}?<br>
Is it really that exotic to ask for this?<br>
<br>
My conclusion: udisks2 serves as an example of how it
should not be done!<br>
rm -rf udisks2<br>
<br>
To you mhogomchungu, many thanks for your answer! Just as
you suggested, I will have to look for another way. If I
find one that pleases me I'll post it here.
<div class="HOEnZb">
<div class="h5"><br>
<br>
_______________________________________________<br>
devkit-devel mailing list<br>
<a moz-do-not-send="true"
href="mailto:devkit-devel@lists.freedesktop.org"
target="_blank">devkit-devel@lists.freedesktop.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freedesktop.org/mailman/listinfo/devkit-devel"
rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/devkit-devel</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>