KDirLister keeps mounted devices in use

Lubos Lunak l.lunak at suse.cz
Wed Jan 8 11:23:44 GMT 2003


On Wednesday 08 of January 2003 00:17, Waldo Bastian wrote:
> On Tuesday 07 January 2003 23:22, Michael Brade wrote:
> > Well ok, seriously. I could make KDirLister not put things like floppy
> > and cdrom (wich is flawed anyways, who wants to watch a cdrom? :) in
> > KDirWatch once that dir is in itemsCached. I think it's worth the speed
> > we loose, right? ;) But, how to detect if an url is a floppy, cdrom, Zip
> > or not? And furthermore, I occasionally mount harddisks temporarily. I

 I guess that's the main reason why I asked for help. :-/

> > can't think of a solution here... besides removing the "speedy caching"
> > feature altogether
> >
> > :/
>
> Instead of relying on KDirWatch, can't you somehow check whether the cache
> is still valid before you reuse it? Maybe something like:
>
> check mtime/ctime of dir
> if modified
>   throw away cache
> else
>   show cache
>   validate (and update) cached items
>
> Checking the mtime/ctime should detect new/deleted files I think, so you
> only need to validate to update any file attributes (time/size)

On Wednesday 08 of January 2003 00:42, David Faure wrote:
> Sure. But the dir's mtime isn't enough information. Some file might have
> changed, which doesn't change the dir's mtime.

 I think we could check dir's mtime and mtime of all files in it. The only way 
one could change something without having noticed with such mtime checking 
I'm aware of would be changing a file and changing mtime back (e.g. touch 
-t). And that's pretty unlikely, and one doing that is asking for not having 
the view updated (i.e. I think this case can be ignored).

>
> You could also check with KIO::probably_slow_mounted and keep using
> KDirWatch when it isn't slow.

 I don't fully understand KIO::probably_slow_mounted() code, but I think it 
wouldn't detect e.g. mounted cdrom as "slow". But perhaps there could be a 
similar function KIO::temporarily_mounted() which would return false if this 
entry is in fstab and has the auto option.


> Cheers,
> Waldo

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/





More information about the kfm-devel mailing list