[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netatalk
Subject:    Re: [Netatalk-admins] osx
From:       Thomas Kaiser <Thomas.Kaiser () phg-online ! de>
Date:       2002-05-25 12:19:45
[Download RAW message or body]

On Fri, 24 May 2002 17:34:54 +0200, Thomas Kaiser wrote:

Two small additions/corrections:

> MOSX always store's the resource fork and metadata, if necessary:
> [...]
> - on other filesystems (UFS, NFS, SMBFS, WebDAV, etc.) by storing metadata
>   and resource fork as ._[datafork's filename] (in AppleDouble v2 format)

Unfortunately MOSX is using just a small subset of AppleDouble v2: It just
uses ID 9 (Standard Macintosh Finder information) and in case a resource
fork is present, ID 2 also. It doesn't even really try to understand the
AppleDouble structure but instead always assumes that a "._" file starts
with ID 9 followed by ID 2 from byte position 82 (decimal) on:

0000: 00 05 16 07 00 02 00 00 00 00 00 00 00 00 00 00     ................
0010: 00 00 00 00 00 00 00 00 00 02 00 00 00 09 00 00     ................
0020: 00 32 00 00 00 20 00 00 00 02 00 00 00 52 00 00     .2... .......R..
0030: 13 04 4A 50 45 47 38 42 49 4D 05 00 00 00 00 00     ..JPEG8BIM......
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ................
0050: 00 00 00 00 01 00 00 00 12 76 00 00 11 76 00 00     .........v...v..

Other useful stuff like the Finder comment in the finder's info window, Icon
positions, etc. are only stored in .DS_Store in the same directory although
there are fields present in AppleDouble format for these purposes...

From .DS_Store:

0360: 75 73 74 72 00 00 00 1A 00 74 00 68 00 69 00 73     ustr.....t.h.i.s
0370: 00 20 00 69 00 73 00 20 00 74 00 68 00 65 00 20     . .i.s. .t.h.e.
0380: 00 46 00 69 00 6E 00 64 00 65 00 72 00 20 00 63     .F.i.n.d.e.r. .c
0390: 00 6F 00 6D 00 6D 00 65 00 6E 00 74 00 00 00 16     .o.m.m.e.n.t....
03A0: 00 74 00 68 00 69 00 73 00 20 00 69 00 73 00 20     .t.h.i.s. .i.s.
03B0: 00 74 00 68 00 65 00 20 00 66 00 69 00 6C 00 65     .t.h.e. .f.i.l.e
03C0: 00 6E 00 61 00 6D 00 65 00 2D 00 32 49 6C 6F 63     .n.a.m.e.-.2Iloc

Netatalk stores metadata and resource forks per default in AppleDouble v1.

But by changing

    #define AD_VERSION    AD_VERSION1

to 

    #define AD_VERSION    AD_VERSION2

in 'include/atalk/adouble.h' it seems that Netatalk stores all this stuff in
AppleDouble version 2 internally. When Netatalk creates a new file then it
utilizes the following 9 entries:

ID  2 (Resource fork)                                        if available
ID  3 (File¹s name as created on home file system)           used
ID  4 (Standard Macintosh comment)                           used
ID  8 (File creation date, modification date, and so on)     used
ID  9 (Standard Macintosh Finder information)                used
ID 11 (ProDOS file information, attributes, and so on)       not used/zeroed
ID 13 (AFP short name)                                       not used/zeroed
ID 14 (AFP file information, attributes, and so on)          not used/zeroed
ID 15 (AFP directory ID)                                     not used/zeroed

This looks like this, when using AppleDouble v2:

0000: 00 05 16 07 00 02 00 00 00 00 00 00 00 00 00 00     ................
0010: 00 00 00 00 00 00 00 00 00 09 00 00 00 02 00 00     ................
0020: 02 99 00 00 13 04 00 00 00 03 00 00 00 86 00 00     .ô...........Ü..
0030: 00 14 00 00 00 04 00 00 01 85 00 00 00 1B 00 00     .........Ö......
0040: 00 08 00 00 02 4D 00 00 00 10 00 00 00 09 00 00     .....M..........
0050: 02 5D 00 00 00 20 00 00 00 0B 00 00 02 91 00 00     .]... .......ë..
0060: 00 08 00 00 00 0D 00 00 02 85 00 00 00 00 00 00     .........Ö......
0070: 00 0E 00 00 02 81 00 00 00 04 00 00 00 0F 00 00     .....Å..........
0080: 02 7D 00 00 00 04 74 68 69 73 20 69 73 20 74 68     .}....this is th
0090: 65 20 66 69 6C 65 6E 61 6D 65 00 00 00 00 00 00     e filename......
[...]
0180: 00 00 00 00 00 74 68 69 73 20 69 73 20 74 68 65     .....this is the
0190: 20 46 69 6E 64 65 72 73 20 63 6F 6D 6D 65 6E 74      Finders comment
[...]

Unfortunately simply copying the Netatalk AppleDouble header file
('.AppleDouble/file') for use with MOSX ('./._file') won't work as MacOS X
just recognizes it's own very limited interpretation of AppleDouble (ID 9
followed by ID 2) and uses './.DS_Store' for the other metadata stuff.

The other way around works: If you copy a MOSX' style '._file' to
'.AppleDouble/file' (and compiled Netatalk with support for AppleDouble v2)
then it works. Netatalk recognizes MOSX' limited AppleDouble headers (but
has no knowledge about the lost metadata in .DS_Store, substituting this
with empty fields or default values)

> [...]
> From the view of an absolute programmer novice (like me) it looks not that
> hard to let Netatalk switch from storing metadata and resource forks in
> .AppleDouble/[datafork's filename] (in AppleDouble v1 format) to the way, MOSX
> handles this (AppleDouble version 2 and different location).

Well, I realized that this is not that easy :-\

1) Letting Netatalk write crippled AppleDouble header files for MOSX would
   require that it also uses the '.DS_Store' file to store the other
   necessary metadata stuff

2) In the netatalk source tree there are more than 100 references to
   .AppleDouble. Changing this from a 'dir/file' style to a simple 'just
   another file' style will be a bit harder, I assume (as there are many
   directory operations involved at the moment when dealing with the
   AppleDouble header files)

If you want to experiment with this stuff, please be careful and use
separate sharepoints for netatalk with AppleDouble v1 and v2 support!

Thomas


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Netatalk-admins mailing list
Netatalk-admins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/netatalk-admins
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic