[hfs-user] Difference in Data types??

Simon Bazley sibaz@sibaz.com
Fri, 29 Mar 2002 14:41:39 +0000

Firstly, check out the code for the hfs file system on linux.  Theres a
lot of helpful little tricks when implementing things in C.  In
particular there is a directive which when added to the end of a struct
made it pack as you'd expect it to instead of doing strange things
similar to what you're suggesting.
Again working out assumtions is easy when you can see how someone else
has done it.

As for working out catalog file sizes based on the number of files, you
can't.  The problem is the eventual catalog size will be based on the
number of nodes in the file, and the number of nodes depends on howmany
files you can get in each node.  That depends on the record size within
the node and that varies for some node types, depending on the length of
the filename.  There are 4 types of node in a catalog file, I believe
only 2 will vary in this way.  It may be all 4, I'm not sure.  Extent
files however don't vary like this so you can work it out.  Just
checkout how big key structure is in an extents file, then work out the
packing density of that structure in a node.  Remember though that Nodes
are 512 bytes (I think) in HFS, but 4k in HFS+ (this is because the
maximum name length changed in HFS+, so records could be up to 4k big).
I suspect you're best just to create all the keys then just combine them
together and see what you get.  I'm sure you could work it out, but It'd
be easier just to make a massive file, then shrink it to the used size
when you've finished adding stuff.

The size of the Catalog file and extents file (allocated size and nodes
used) are stored in the mdb, incase that was what you meant.


"Biswaroop(External)" wrote:

> HI, Everybody Wishing u all a very Happy Holi.( An Indian festival
> played  with colours)   Well in the MDB structure for an HFS volume
> the  field  vol.drXTClpSiz /* clump size for extents overflow file */
> is 4 bytes long.  Again in the Catalog Data Record structure the
> member  filClpSize; /* file clump size */  takes 2 bytes.   Therefore
> when i assign the value of the first variable to  the second I lose
> information.  But then one way is to make the MDB's variable contain
> a value only for 2 bytes then assignment won't make  a data loss. But
> the value for the MDB's variable was  calculated as 1/128 th part of
> the Total volume size.  An emphirical formula used in the hfsutils
> package.  Any comments on this???  Please is there any simple formula
> to find out the  extent file size and the catalog file size for a
> volume  when we know before hand how many files have to be  in that
> volume.  For eg. if i know i have to write "X" files  contained in
> "Y" number of directories.   Then can i calculate what should be the
> volume's   clump size for the extents overflow file and the catalog
> file. Waiting for ur  explanations.  Bye Biswaroop  Each Day gives us
> an Opprutunity to
> Ruin it, those who Fail, Succeed in Life.
>                                                 -- Bisban