Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mounting images via UDisks2 #184

Open
gasinvein opened this issue Apr 2, 2021 · 5 comments
Open

Mounting images via UDisks2 #184

gasinvein opened this issue Apr 2, 2021 · 5 comments
Assignees

Comments

@gasinvein
Copy link
Contributor

gasinvein commented Apr 2, 2021

UDisks is a privileged daemon with D-Bus API for for manipulating block devices and filesystems.
Q4Wine could ask UDisks2 to mount a disk image for it. This gives several advantages over exec'ing CLI tools for mount:

  • Q4Wine won't need to elevate at all, even no need to run suid binaries (e.g. fusermount when using FUSE)
  • UDisks2 is preinstalled on most modern Linux desktops, so no additional software required
  • This can work in sandbox with NO_NEW_PRIVILEGES set (useful for Flatpak, Flatpak bundle #147)

Key difference from current mount approach, as I see it, is that UDisks2 sets up a mountpoint for us automatically (usually in /media or /run/media/) when mounting a filesystem, which means we can't select it ourselves.

To mount an image, client app would need to call two D-Bus methods sequentially: org.freedesktop.UDisks2.Manager.LoopSetup to create a block device backed by given image (returns object path of the created device), and then org.freedesktop.UDisks2.Filesystem.Mount (method of the block device object we just created) to mount the filesystem (returns path to the mount point).

@brezerk brezerk self-assigned this May 19, 2021
@brezerk
Copy link
Owner

brezerk commented May 19, 2021

as per: https://wiki.archlinux.org/title/udisks
seems like there are two ways to interact with udisks: dbus and cli.
cli probably would be much easier to implement.

@brezerk
Copy link
Owner

brezerk commented May 19, 2021

or seems like there is much interesting way: https://doc.qt.io/qt-5/qdbusinterface.html

@gasinvein
Copy link
Contributor Author

gasinvein commented May 19, 2021

I believe DBus API is the proper way to integrate apps with udisks2. udisksctl is just a very limited console UI, it's probably not supposed to be invoked from apps.

or seems like there is much interesting way: https://doc.qt.io/qt-5/qdbusinterface.html

Yeah, Qt DBus module should do.

@brezerk
Copy link
Owner

brezerk commented May 19, 2021

api reference: http://storaged.org/doc/udisks2-api/latest/

@gasinvein
Copy link
Contributor Author

Yeah, we don't need much of the API here, just two interfaces and two method calls. Probably the only thing to note is that when calling LoopSetup method on org.freedesktop.UDisks2.Manager interface, we should set no-part-scan option to true, so the filesystem interface appears for the whole loopback block device and we won't need to poke into partitions to mount the filesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants