Hey, On Fri, 2009-07-03 at 16:13 +0200, Juan Miguel Cejuela wrote: > Hi there, > > . > I've written a simple automounter and volume manager based on > DeviceKit:
Note that DeviceKit is now completely deprecated - users are supposed to be using libudev or libgudev instead. > . > http://www.ashrentum.net/jmcejuela/programs/sources/volman-0.2.tar.gz > . > Some may find it interesting. > . > Currently it only manages media drives. I hasn't support yet for > CDs/DVDs because I don't see an obvious way to obtain their device > files. When inserting CDs I receive a "change" action device event and > its device_file is null. > . Note that automounting is a really tricky business - see http://bugs.freedesktop.org/show_bug.cgi?id=22652#c4 for some ramblings about the various issues. Anyway, if all you want is automounting without a desktop session (which I personally don't think is interesting but lots of people do), it's probably much easier to just use something like GIO's GVolumeMonitor, GDrive, GVolume, GMount and GMountOperation classes since - GIO has a stable ABI/API that is guaranteed to be around for a very very long time - all the hard problems and nasty details are being addresses in GIO since we use it in GNOME - it's a higher-level abstraction so things like RAID support / iSCSI / LVM / are abstracted away and you use the same API to e.g. start/stop raid arrays as you would to bring-up/tear-down an iSCSI drive. - it's also a higher level abstraction than DeviceKit-disks since it breaks down block devices into Drives / Volumes. You need this kind of abstraction to handle a) devices with partitions; vs. b) devices with file systems on the main block device (like CDs); without too much special casing - it supports multiple backends like HAL, gnome-disk-utility / DeviceKit-disks - GIO has bindings for lots of languages, e.g. JS, Python, C++, C#, Java, whatever The downside is that it's hard to get GIO/GVfs to work for system daemons. The trick here a) is to start a session bus; and b) avoid mounting non-native mounts (e.g. a gphoto2:/// mount will only be available to that "session"). Of course GIO won't end world hunger - it's definitely not the right API for e.g. managing disks like Palimpsest wants (GIO makes policy decisions about what is user visible and what's not) but for automounting it should get it just right. (Btw, if you (or anyone else for that matter) don't like the G stack then just don't use it. But please realize that a lot of the logic is needed one way or the other other and one main difference between DeviceKit-disks and what it's replacing (HAL) is that a lot of this logic now happens on the user side, not in the daemon.) David _______________________________________________ devkit-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/devkit-devel
