[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KIO::is_manually_mounted() and device UUIDs
From:       David Faure <faure () kde ! org>
Date:       2007-04-30 16:30:02
Message-ID: 200704301830.03248.faure () kde ! org
[Download RAW message or body]

On Thursday 26 April 2007, Kevin Ottens wrote:
> Le jeudi 26 avril 2007 01:08, David Faure a écrit :
> > KIO::is_manually_mounted() greps /etc/fstab for the "noauto" option, for a
> > given device. But this doesn't work anymore, now that kubuntu converted
> > /etc/fstab to use UUIDs instead of device names:
> > 
> > # /dev/sda7 -- converted during upgrade to edgy
> > UUID=2c31247e-d3a0-11da-bd28-314ffa00bcaa /home ext3 defaults 0 2
> > 
> > I tried using KMountPoint::currentMountPoints with
> > KMountPoint::NeedMountOptions but this doesn't help, because /etc/mtab
> > keeps the mount options but not "noauto" (since it doesn't care about it).
> > 
> > Any other ideas? How would I go about finding the uuid of a given device?
> 
> What about using Solid::Volume::uuid()?
> 
> Actually if you have an uuid you can get the device which match it using a 
> predicate like: "Volume.uuid == 'uuid'", it'll get you the only device which 
> match it, then calling d.as<Block>()->device() will get you the device node 
> for instance.

That sounds great. Too bad KMountPoint is in kdecore and kdecore doesn't link to \
solid (kio does; and solid links to kdecore)....

The reason KMountPoint is in kdecore is only because of Type=FSDevice desktop files
Those are the device files that users can create (since kde1) using RMB / Create New \
/ Link to device / ... I guess we still need to support those?
They need KMountPoint for their icon (mounted != unmounted, but that's \
KMountPoint::currentMountPoints, which gets device names, so no problem there...) and \
for their url in KDesktopFile::readUrl() (but that code looks wrong to me -- all such \
desktop files that I can see have a MountPoint entry anyway, so we could just use \
that).

I toyed with the idea of letting KMountPoint::possibleMountPoints() read
mountedFrom="UUID=361573af-cdad-4564-a315-6df1b78295a8" and sorting it
out in the calling code, but that seems to lead to horribly duplicated code...
So, the fix needs to be in kmountpoint and I don't see how to move kmountpoint up
unless we split mtab and fstab parsing, which seems bad....
=> how about we merge solid and kdecore?

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic