[hfs-user] TN 1150 - HFS+

Mark Day mday@apple.com
Thu, 17 Jan 2002 09:01:38 -0800


--Apple-Mail-1-767444259
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=ISO-8859-1;
	format=flowed

On Thursday, January 17, 2002, at 03:00  AM, Entwicklung wrote:

> =A0=A0=A0=A0=A0=A0=A0=A0The technical notes for HFS+ pg. 26 describes =
two fields=20
> userInfo and finderInfo of=A0the structure HFSPlusCatalogFile=A0as " =
This=20
> field contains information used by the Mac OS Finder. Its format is =
not=20
> part of the HFS Plus Specifications."=A0
> =A0
> Can anybody who is familiar with the specifications please tell me if =
a=20
> third party HFS-generating application has to set these fields to 0=20
> assuming them to be 'reserved' or what values exactly these should=20
> correctly take on?
> I'm relatively new to the Specs and would be grateful=A0for some=20
> professional advice from the experts who work with the specs everyday.

If you don't want to fill in the fields, or don't know what to put=20
there, use zeros.  The Mac OS File Manager initializes those fields to=20=

zero when files or directories are created.  The Finder or other=20
applications typically change them later.

If you haven't already done so, you should probably download a copy of=20=

Apple's Universal Interfaces.  It contains headers for C, Pascal, and=20
68xxx assembly.  There are definitions for the structures used on HFS=20
and HFS Plus.  You can download them from:
=
<ftp://ftp.apple.com/developer/Development_Kits/UniversalInterfaces3.4.img=
.
bin>

Note that this is a MacBinary encoded disk image.  If you're not using a=20=

Macintosh, it would probably be a lot easier to borrow a Mac to decode=20=

and mount the image, so you can copy the files off.  Some or all of=20
these headers may be available through the Darwin sources, but I haven't=20=

looked.  You can also download the interfaces without the Pascal or=20
assembly headers, but I find the assembly headers really convenient=20
since they list the byte offsets of fields within structures (which is=20=

really handy when you're looking at a hex dump at a terminal or in a=20
disk editor).

For example, in HFSVolumes.h, you'll find:

struct HFSPlusCatalogFile {
   SInt16              recordType;             /* record type =3D HFS =
Plus=20
file record */
   UInt16              flags;                  /* file flags */
   UInt32              reserved1;              /* reserved - set to=20
zero */
   HFSCatalogNodeID    fileID;                 /* file ID */
   UInt32              createDate;             /* date and time of=20
creation */
   UInt32              contentModDate;         /* date and time of last=20=

content modification */
   UInt32              attributeModDate;       /* date and time of last=20=

attribute modification */
   UInt32              accessDate;             /* date and time of last=20=

access (Rhapsody only) */
   UInt32              backupDate;             /* date and time of last=20=

backup */
   HFSPlusPermissions  permissions;            /* permissions (for=20
Rhapsody) */
   FInfo               userInfo;               /* Finder information */
   FXInfo              finderInfo;             /* additional Finder=20
information */
   UInt32              textEncoding;           /* hint for name=20
conversions */
   UInt32              reserved2;              /* reserved - set to=20
zero */

                                               /* start on double long=20=

(64 bit) boundry */
   HFSPlusForkData     dataFork;               /* size and block data =
for=20
data fork */
   HFSPlusForkData     resourceFork;           /* size and block data =
for=20
resource fork */
};

That tells you that the userInfo field is of type FInfo, and finderInfo=20=

is of type FXInfo.  You can find definitions of FInfo and FXInfo in=20
Finder.h, where you'll also find FileInfo and ExtendedFinderInfo, which=20=

are alternative definitions that represent how current versions of Mac=20=

OS use those fields.

You can find more information in the Finder Interface chapter of Inside=20=

Macintosh: Macintosh Toolbox Essentials.  I suggest looking at the=20
following URL:
=
<http://developer.apple.com/techpubs/macos8/Files/FinderInterface/finderin=
terface.
html>

Probably the most import fields to set would be the type and creator of=20=

files.  This is what Mac OS 9 and earlier use to determine the icon and=20=

application associated with a file.  (Mac OS X uses additional=20
mechanisms.)

-Mark

--Apple-Mail-1-767444259
Content-Transfer-Encoding: quoted-printable
Content-Type: text/enriched;
	charset=ISO-8859-1

On Thursday, January 17, 2002, at 03:00  AM, Entwicklung wrote:


<excerpt><fontfamily><param>Arial</param><smaller>=A0=A0=A0=A0=A0=A0=A0=A0=
The
technical notes for HFS+ pg. 26 describes two fields userInfo and
finderInfo of=A0the structure HFSPlusCatalogFile=A0as " This field
contains information used by the Mac OS Finder. Its format is not part
of the HFS Plus Specifications."=A0</smaller></fontfamily>

=A0

<fontfamily><param>Arial</param><smaller>Can anybody who is familiar
with the specifications please tell me if a third party HFS-generating
application has to set these fields to 0 assuming them to be
'reserved' or what values exactly these should correctly take =
on?</smaller></fontfamily>

<fontfamily><param>Arial</param><smaller>I'm relatively new to the
Specs and would be grateful=A0for some professional advice from the
experts who work with the specs everyday.</smaller></fontfamily>

</excerpt>

If you don't want to fill in the fields, or don't know what to put
there, use zeros.  The Mac OS File Manager initializes those fields to
zero when files or directories are created.  The Finder or other
applications typically change them later.


If you haven't already done so, you should probably download a copy of
Apple's Universal Interfaces.  It contains headers for C, Pascal, and
68xxx assembly.  There are definitions for the structures used on HFS
and HFS Plus.  You can download them from:

=
<<ftp://ftp.apple.com/developer/Development_Kits/UniversalInterfaces3.4.im=
g.bin>


Note that this is a MacBinary encoded disk image.  If you're not using
a Macintosh, it would probably be a lot easier to borrow a Mac to
decode and mount the image, so you can copy the files off.  Some or
all of these headers may be available through the Darwin sources, but
I haven't looked.  You can also download the interfaces without the
Pascal or assembly headers, but I find the assembly headers really
convenient since they list the byte offsets of fields within
structures (which is really handy when you're looking at a hex dump at
a terminal or in a disk editor).


For example, in HFSVolumes.h, you'll find:


struct HFSPlusCatalogFile {

  SInt16              recordType;             /* record type =3D HFS
Plus file record */

  UInt16              flags;                  /* file flags */

  UInt32              reserved1;              /* reserved - set to
zero */

  HFSCatalogNodeID    fileID;                 /* file ID */

  UInt32              createDate;             /* date and time of
creation */

  UInt32              contentModDate;         /* date and time of last
content modification */

  UInt32              attributeModDate;       /* date and time of last
attribute modification */

  UInt32              accessDate;             /* date and time of last
access (Rhapsody only) */

  UInt32              backupDate;             /* date and time of last
backup */

  HFSPlusPermissions  permissions;            /* permissions (for
Rhapsody) */

  FInfo               userInfo;               /* Finder information */

  FXInfo              finderInfo;             /* additional Finder
information */

  UInt32              textEncoding;           /* hint for name
conversions */

  UInt32              reserved2;              /* reserved - set to
zero */


                                              /* start on double long
(64 bit) boundry */

  HFSPlusForkData     dataFork;               /* size and block data
for data fork */

  HFSPlusForkData     resourceFork;           /* size and block data
for resource fork */

};


That tells you that the userInfo field is of type FInfo, and
finderInfo is of type FXInfo.  You can find definitions of FInfo and
FXInfo in Finder.h, where you'll also find FileInfo and
ExtendedFinderInfo, which are alternative definitions that represent
how current versions of Mac OS use those fields.


You can find more information in the Finder Interface chapter of
Inside Macintosh: Macintosh Toolbox Essentials.  I suggest looking at
the following URL:

=
<<http://developer.apple.com/techpubs/macos8/Files/FinderInterface/finderi=
nterface.html>


Probably the most import fields to set would be the type and creator
of files.  This is what Mac OS 9 and earlier use to determine the icon
and application associated with a file.  (Mac OS X uses additional
mechanisms.)


-Mark


--Apple-Mail-1-767444259--