Add loop.autoclear option to Filesystem.Mount() method
authorDavid Zeuthen <davidz@redhat.com>
Mon, 30 Apr 2012 20:59:53 +0000 (16:59 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Mon, 30 Apr 2012 21:09:20 +0000 (17:09 -0400)
commit9a3939800e280efbac0efe22dca26799da894f4d
tree636a1aab4108c73e22b871329d8dfe2d38357ab1
parent748fdd2df42c45ba38d82651b89db17da82ee864
Add loop.autoclear option to Filesystem.Mount() method

The main user of this could be the desktop shell / file manager
offering a "Attach Disk Image" option for e.g. ISO files - it would
first use Manager.LoopSetup() and then, on the returned block device,
invoke Filesystem.Mount() with this new option (assuming the returned
loop device has any interesting content). With this, the file manager
need not worry about the loop device - it goes away as soon as the
filesystem is unmounted.

Why is this an option to Filesystem.Mount() and not Manager.LoopSetup()?
Because right after setting up the loop device, the OS opens the
device so it can populate the udev database with the detected contents
of the newly created loop device and also to maintain symlinks in the
/dev/disk tree. If we had created the loop device with LO_AUTOCLEAR
the kernel would clear the loop device right after blkid(8) closes the
device. However, if we set the flag after successfully mounting the
file system on the loop device, there is already a single reference to
the block device.

Signed-off-by: David Zeuthen <davidz@redhat.com>
data/org.freedesktop.UDisks2.xml
doc/man/udisksctl.xml
src/udiskslinuxfilesystem.c
tools/udisksctl.c