A KDE-way to know if a file is sequential/non-random
Darío Andrés
andresbajotierra at gmail.com
Sun May 31 00:55:46 BST 2009
Sorry about the double mail David.
2009/5/29 David Faure <faure at kde.org>:
> On Tuesday 26 May 2009, Darío Andrés wrote:
>> Hi everyone.
>>
>> I was developing some fixes for hangs that occur when some
>> applications try to access special files like pipes, or char/block
>> devices.
>> http://reviewboard.kde.org/r/723/
>> The patch in that review proposal will fix the hang locally (on
>> KPropertiesDialog) (btw: Dolphin tooltips also suffer this issue)
>>
>> kdepepo and I were thinking about doing this globally on KFileItem /
>> KFileMetaInfo so every app accessing the metainfo of a file will not
>> block the whole application.
>>
>> I was wondering what is the best way / methods to check that..
>> Currently my patch is using "S_ISFIFO"/CHR/BLK but we were wondering
>> if a KDE function like "isRegularFile" exists (or it should be
>> created).
>
> KFileItem::isRegularFile, which tests S_ISFIFO etc. on the data it
> got from kio or from local stat(), sounds like a good plan indeed.
>
I wonder how to handle the method naming:
isRegularFile / isSequentialFile / isFifoFile
and with that naming schemes, what will the function imply? will it
check for FIFO or also for devices blocks or sockets too ?
That should be needed in order to avoid the hang on reading.
My implementation draft is
a bool member var of KFileItemPrivate named m_regularFile.
and after the creation of the object, at the end of the init() call
(when we already have the mode), just set this var using the S_FIFO
(and/or other functions) result.
and a public member "isRegularFile" which will return the
d->m_regularFile . (this file modes aren't going to change on the
fly.. am I right?)
Any other thoughts?
Regards
Dario
> --
> David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
> Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
>
More information about the kde-core-devel
mailing list