Wednesday, October 1, 2008

Getting GVfs and FUSE right

One of the cool things about the new IO library (GIO) in the GNOME stack is that it’s extensible. One set of extensions for GIO is provided by the GVfs package. The main (but not only) purpose of GVfs is to provide access to Virtual File Systems by having the file system backend (e.g. file system driver) running in a separate daemon process in user space - sort of similar to what the Filesystems in Userspace (FUSE) framework provides on Linux and, nowadays, most UNIX operating systems. GVfs currently includes backends for SFTP, FTP, OBEX for Bluetooth, Digital cameras and MTP devices (through libgphoto2), Compact Disc Audio, Webdav, HTTP and archive files (through libarchive) to name the most important ones.


One key difference between FUSE and GVfs, is that GVfs file system drivers are not constrained by the rather old-fashioned, limited and design-by-committee POSIX API. Instead, GIO provides (and exposes for implementation to file system drivers) a modern and powerful API that provides asynchronous IO, file monitoring (like inotify) and high-level operations as part of the standard API. The GIO API is at the right level of the stack, it’s part of the GLib tarball. This means that any application that today uses GTK+ has access to GIO. This is a pretty big deal, if you depend on GTK+ 2.14 on newer, you’ll also depend on GIO.


However, since it’s rather naive (not to mention arrogant) to think that people are going to be using only GTK+ applications, GVfs also ships with a FUSE daemon. This daemon provides a POSIX interface to the virtual file systems provided by GVfs. All the fancy high-level operations available when using GIO won’t be available (there’s no POSIX equivalent function to map to) of course, but the basic POSIX stuff (e.g. open(2), read(2) etc.) will work just fine. The way it works is that the GVfs FUSE daemon provides a mount in $HOME/.gvfs where each top-level directory represents a GVfs mount:



$ ls -1 $HOME/.gvfs
gphoto2 mount on usb%3A004,002
sftp on people.freedesktop.org
sftp on quad.local


For example, this means all the good old command line tools still work



$ stat /home/davidz/.gvfs/sftp\ on\ quad.local/home/davidz/.bashrc
File: `/home/davidz/.gvfs/sftp on quad.local/home/davidz/.bashrc'
Size: 313 Blocks: 0 IO Block: 4096 regular file
Device: 14h/20d Inode: 44 Links: 1
Access: (0600/-rw-------) Uid: ( 500/ davidz) Gid: ( 500/ davidz)
Access: 2008-10-01 14:35:28.000000000 -0400
Modify: 2008-04-25 11:55:02.000000000 -0400
Change: 2008-04-25 11:55:02.000000000 -0400


$ convert /home/davidz/.gvfs/gphoto2\ mount\ on\ usb%3A004\,002/DCIM/100NIKON/DSCN0001.JPG -dither out.jpg


and so forth. Lots of command-line people like this, at least they always like to complain when we didn’t have this back in the GnomeVFS days.


But it gets better. Today I committed a patch to GIO to ensure that GIO applications launching applications (such as the Nautilus file manager or the Evolution mailer) will always pass a FUSE path instead of the GIO URI. One implication of this is that if you launch a non-GIO application (such as mplayer or a KDE application) from Nautilus, that application will Just Work(tm) even if the file lives on a GVfs share.


I think this is a pretty big deal; now it just doesn’t matter what VFS system of the week is used in the application, it’s all POSIX as far as applications are concerned. Sure, there’s a small performance hit by having to go through the GVfs FUSE daemon (a couple of extra context switches) but for run-of-the-mill desktop applications this is insignificant. Also, as explained here it’s currently not a very smart idea to pass an URI to an application; there’s the problem we don’t have proper standards defining the URI’s we use; there’s also the problem of having to authenticate over and over again.


Finally, if the application itself is using GIO, this patch ensures we map back to a GIO URI and, thus, we bypass the FUSE daemon. This is best illustrated by the following screenshot:




Bastien in VFS heaven


Bastien in VFS heaven


As you can see from the terminal window, Eye of GNOME is being passed a FUSE path from Nautilus. But thanks to the aforementioned patch, this is getting mapped back to a GIO URI as shown in the properties dialog.


This feature won’t be available in GNOME until 2.26 (and GLib 2.20) - we’re concerned some broken applications might be examining the URI before it’s mapped back so we’re reluctant to provide it in GLib 2.18 / GNOME 2.24 for now. FWIW, we’ve been shipping patches for this feature since Fedora 9 and the feature will be in Fedora 10 as well. Other vendors are encouraged to ship these patches as well.

Tuesday, August 19, 2008

DeviceKit presentations

Earlier today Richard and I did a DeviceKit (the set of projects replacing HAL) presentation for some other group here at Red Hat. You can see the slides here and here.


Perhaps of interest to the GNOME community, there’s also screenshots of Palimpsest, an upcoming Disk Utility library and application for GNOME. Most of this is already available in Fedora’s development branch, dubbed Rawhide, but won’t be installed by default in Fedora 10. Right now I’m busy with PolicyKit stuff but the plan is definitely to get a gnome-disk-utility mailing list going soon and get this stuff integrated throughout GNOME (I’ve already made sure it’s easy to plug into gvfs for example).


For example, I learned the other day that my disk is failing (actually, as mjg59 pointed out, it’s wrong to use the word FAILING since it’s Old-Age. Easily fixed.). Now, it would definitely be useful to have a notification bubble indicating this. This is pretty trivial to write using the DeviceKit-disks API; just monitor the org.freedesktop.DeviceKit.Disks.Device:drive-smart-is-failing property. Of course the gnome-disk-utility libraries (there’s one at the GLib level and one at the GTK+ level) wraps this nicely. In fact the gnome-disk-utility library at the GTK+ level should probably provide the code for doing this status icon. Something to discuss. Hence why a mailing list and more community involvement in the gnome-disk-utility project is needed.


Anyway, the goal is to port the most of the Fedora desktop to use DeviceKit instead of HAL for the Fedora 11 time frame.

Wednesday, August 6, 2008

Resolution Independent GTK+

Got one of them big laptops where you feel tempted to use a looking glass because the pixels are so tiny? Ever feel cheated when you adjust the font size but the rest of the UI looks like crap in comparison? Or maybe ever felt dirty when hard coding pixel values in your application?







there’s also a tiny and a normal version…



Today I sent a patch to gtk-devel-list adding Resolution Independence to the GTK+ toolkit. Let’s see how that goes.

Wednesday, July 30, 2008

D-Bus introspection

Sure, there’s already d-feet and a similar Qt tool but for people who hate using the mouse or are allergic to X, I’ve put together this cute little hack that provides bash completion to dbus-send(1). Unfortunately it depends on the XML introspection parser from dbus-glib so it’s not straightforward to add to mainline D-Bus. Could easily go in dbus-glib though. Then again, it would be nice if libdbus included an XML introspection parser. Decisions, decisions.

Wednesday, July 23, 2008

Linux Plumbers Conference CFP extended!

I rarely blog these days, doing the Twitter thing instead and all. Anyway. The Call for Papers for the Linux Plumbers Conference in September in lovely Portland, Oregon has been extended until July 31st 2008. It’s a conference about the core infrastructure of Linux systems: the part of the system where userspace and the kernel interface. It’s the first conference where the focus is specifically on getting together the kernel people who work on the userspace interfaces and the userspace people who have to deal with kernel interfaces. It’s supposed to be a place where all the people doing infrastructure work sit down and talk, so that each other understands better what the requirements and needs of the other are, and where we can work towards fixing the major problems we currently have with our lower-level APIs.


I’m running the “Desktop Integration” microconf at Plumbers. I have two goals for the microconf. One is to be informative about what’s going on in the dusty hallways between the Kernel and the Free Desktop. Which I think is important at a place like Plumbers where we’re going to a lot of people working on similar problems present. The other goal is to actually try and make some headway on actual problems that require people from multiple communities working together. Such as some of the work Jon is focusing on, e.g. how to make fast-user-switching, multi-seat and terminal services Just Work(tm).


The conference is expected to sell out pretty quickly so it’s a good idea to go ahead and register for Plumbers Conference instead of procrastinating about doing it!


Linux Plumbers Conference


See you in Portland!

Monday, January 28, 2008

gnome.conf.au 2008

Am in Melbourne, VIC, Australia for linux.conf.au 2008; just gave a talk on PolicyKit, the slides are here. Only had 20 minutes so the whole thing felt a bit rushed and I didn’t get to go into much detail. Hopefully it made some sense though, otherwise checkout the design and API docs.