udisks2 - How to get basic functionality we had in old udisks?

.. ink .. mhogomchungu at gmail.com
Mon Nov 16 08:16:29 PST 2015


On Mon, Nov 16, 2015 at 5:47 PM, Guy <genlist at faert.net> wrote:

> - 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.

It is possible to get a name of a file associated with a loop device
without root's privileges.

The path of the backing file of loop device "/dev/loop0" for
example,can be obtained by reading:

"/sys/block/loop0/loop/backing_file"

A few comments about your code:

1. No need to cast return value of malloc() as the language will
automatically do it for you.

2. Its perfectly fine to free a NULL pointer and hence no need to
check if a variable is not NULL
    before passing it to free()


More information about the devkit-devel mailing list