[Interest] QFile subclass that does HFS compression?
Roland Hughes
roland at logikalsolutions.com
Mon Dec 17 14:13:32 CET 2018
Rene',
Cannot answer your question, but, I'm a bit curious about "how a file
system supports it?" Not trying to be a jerk, just seeking a bit of
comprehension because I know how we do this in other worlds. In the
OpenVMS world we have FDL (File Definition Language) and C/C++ language
extensions to mimic this for applications which don't wish to
CREATE/FDL=blah.fdl my.idx
If curious you can visit here:
https://www.itec.suny.edu/scsys/vms/ovmsdoc073/v73/4506/4506pro_010.html
and search for Compression. All 3 entries are grouped together.
Once the file is created with these attributes RMS (the Record
Management System) handles everything else, compressing various portions
of the record on write and decompressing them on read.
IBM, I believe, has something similar but been a long time since I
touched big blue.
If a *nix or WinTel file system is going to "support" file/data
compression shouldn't there also be an attribute the file gets created
with which provides all of the compression/decompression unseen by the
application or OS? I'm asking because when I read this:
https://askubuntu.com/questions/332315/how-to-read-and-write-hfs-journaled-external-hdd-in-ubuntu-without-access-to-os
I see the following:
|$ sudo fsck.hfsplus /dev/sdXY ** /dev/sdXY ** Checking HFS Plus volume.
** Detected a case-sensitive catalog. ** Checking Extents Overflow file.
** Checking Catalog file. ** Checking multi-linked files. ** Checking
Catalog hierarchy. ** Checking Extended Attributes file. ** Checking
volume bitmap. ** Checking volume information. ** The volume ###########
appears to be OK.|
So wouldn't this be more along the lines of a setFileAttributes() method
added to QFileDevice? Then QFileDevice would be in charge of determining
which attributes are allowed for the underlying volume structure.
Adding such support in a supportable cross platform manner sounds like a
rather large undertaking. How many different file systems are there on
*nix alone? QFileDevice would need
QMap<int, QString> supportedAttributes();
int setAttributes(QMap<int,QString);
bool hasSupportedAttributes();
I'm not even certain an int would work in all cases. Some file systems
may require string attributes. As maintainers keep changing supported
attributes and adding new file systems, this sounds like a massive
non-portable burden.
If you really want the compression for your Apple specific application
you could create your own class based on QFile and paste in however many
of the nearly 2300 source lines you need from here:
https://github.com/diimdeep/afsctool/blob/master/afsctool.c
I didn't do a detailed analysis of the source, but, it appears to be an
after the fact rather than on the fly compression. You could simply lift
the compress method for your new class.
Just my 0.002 cents.
On 12/17/2018 4:00 AM, René J.V. Bertin wrote:
> Hi,
>
> Is anyone aware of a QFile subclass (or comparable) that writes data using HFS compression if the filesystem supports it (HFS+ and APFS)?
>
> If not, and that's more of a question for the development ML: has thought ever been given to make this an option in the QFile class itself?
>
> Using HFS compression can be very beneficial for files that you write once and read often (or very infrequently) as well as for tiny files (which are reduced to only a directory entry). Being able to create such files directly in compressed form is typically an order of magnitude faster than using a post-hoc compression utility like afsctool.
>
> Thanks,
--
Roland Hughes, President
Logikal Solutions
(630) 205-1593
http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us
More information about the Interest
mailing list