OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [hfs/] [HFS.txt] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
  Macintosh HFS Filesystem for Linux
2
  Paul H. Hargrove, hargrove@sccm.Stanford.EDU
3
  version 0.95, 28 Apr 1997
4
 
5
  This document describes version 0.95 of the Macintosh HFS filesystem
6
  for Linux.  The most current versions of this document and the
7
  software are kept at The HFS for Linux Page
8
  .
9
  ______________________________________________________________________
10
 
11
  Table of Contents:
12
 
13
  1.      Introduction
14
 
15
  2.      Mounting HFS Filesystems
16
 
17
  2.1.    afpd
18
 
19
  2.2.    case={asis, lower}
20
 
21
  2.3.    conv={auto, binary, text}
22
 
23
  2.4.    creator=cccc
24
 
25
  2.5.    fork={cap, double, netatalk}
26
 
27
  2.6.    gid=n
28
 
29
  2.7.    names={7bit, 8bit, alpha, cap, latin, netatalk, trivial}
30
 
31
  2.8.    part=n
32
 
33
  2.9.    quiet
34
 
35
  2.10.   type=cccc
36
 
37
  2.11.   uid=n
38
 
39
  2.12.   umask=n
40
 
41
  3.      Writing to HFS Filesystems
42
 
43
  3.1.    Writing with fork=cap
44
 
45
  3.2.    Writing with fork=double
46
 
47
  3.3.    Writing with fork=netatalk
48
 
49
  4.      A Guide to Special File Formats
50
 
51
  4.1.    CAP .finderinfo Files
52
 
53
  4.2.    AppleDouble Header Files
54
 
55
  5.      Reporting Bugs
56
 
57
  5.1.    What Goes in a Bug Report
58
 
59
  5.2.    How to Report a Kernel Oops or GPF
60
 
61
  6.      Legal Notices
62
 
63
  6.1.    This Document
64
 
65
  6.2.    The Software
66
 
67
  6.2.1.  The Columbia AppleTalk Package for UNIX
68
 
69
  6.2.2.  Netatalk
70
 
71
  6.3.    Trademarks
72
  ______________________________________________________________________
73
 
74
  11..  IInnttrroodduuccttiioonn
75
 
76
  This software implements the Macintosh HFS filesystem under Linux.  It
77
  allows you to read and write HFS filesystems on floppy disks, CDROMs,
78
  hard drives, ZIP drives, etc.  It is _n_o_t an AppleShare client.
79
 
80
  If you use this software, please send me a note telling of your
81
  success or failure with it.  Your feedback lets me know that this
82
  project is not a waste of my time.
83
 
84
  This code is still experimental, so backup anything important before
85
  you start playing.  I'd like you to know that I've never lost any
86
  files while using this software, or I would not release it.  However,
87
  a ``better safe than sorry'' attitude is probably best.
88
 
89
  If, for instance, the buffer cache were to become corrupted you could
90
  start losing things on other disks.  Because of this, if you get a
91
  General Protection Fault, or a kernel Oops, I _s_t_r_o_n_g_l_y recommend that
92
  you reboot before writing any files.
93
 
94
  22..  MMoouunnttiinngg HHFFSS FFiilleessyysstteemmss
95
 
96
  Once you have the HFS filesystem compiled into the kernel or installed
97
  as a loadable module, you will be able to use hfs as a filesystem type
98
  option to mount.  For instance, to mount a Macintosh floppy disk on
99
  the directory /mnt using the default mount options you would execute
100
  ``mount -t hfs /dev/fd0 /mnt''.
101
 
102
  The remainder of this section describes the several mount options
103
  available to control how the HFS filesystem is mapped onto a Linux
104
  filesystem structure.  The values for the multiple-choice options
105
  (case, conv, fork and names) can be abbreviated by their first
106
  character.
107
 
108
  22..11..  aaffppdd
109
 
110
  If included in the options, then the behavior of the filesystem is
111
  changed to make it fully read-write compatible with Netatalk's afpd.
112
  In this mode you should not use normal user-level tools to modify the
113
  filesystem, though reading from it is acceptable.  This is because the
114
  return codes from some system calls are changed to fool afpd.  These
115
  changes will confuse many user-level tools.  In particular ``rm -r''
116
  will loop forever.
117
 
118
  This option implies fork=netatalk, which in turn implies
119
  names=netatalk.  If either of these options are explicitly set to
120
  something else they will take precedence and will confuse afpd.  The
121
  quiet option has no effect.  The case= option functions normally, but
122
  afpd usually does the same thing for you.  The conv= and part= options
123
  also function normally.
124
 
125
  You will probably want to use the uid=, gid= and umask= mount options.
126
  Note that because all the files on an HFS filesystem belong to a
127
  single user and group and have a single umask, the full AppleShare
128
  permission scheme will not work through Netatalk.
129
 
130
  One additional limitation is that the Desktop database on the disk is
131
  stored in afpd's format and is separate from any existing database
132
  maintained by the Finder when the volume is used on a Macintosh.
133
  Because of this mounting an HFS CDROM across the network to a
134
  Macintosh may result in applications and documents showing up with
135
  default application and document icons.  Additionally double clicking
136
  on a document will fail to start the correct application.  Both of
137
  these problems can be worked around by copying the application to a
138
  local disk on the Macintosh.
139
 
140
  This mode is known to be compatible with afpd from Netatalk versions
141
  1.4b1 and 1.4b2, and known to be incompatible with the afpd from
142
  version 1.3.3.  As of this writing Netatalk version 1.4 has not yet
143
  been released.  However, it is expected that this mode will be
144
  compatible with afpd from Netatalk version 1.4 when it is released.
145
 
146
  22..22..  ccaassee=={{aassiiss,, lloowweerr}}
147
 
148
  default value: asis
149
 
150
  This option determines if Macintosh filenames are presented in their
151
  original case or in all lowercase.  Filename lookup is always case
152
  insensitive, so either way foo and Foo refer to the same file but ls
153
  will list Foo with case=asis, and foo with case=lower.  (Same as for
154
  the HPFS filesystem.)
155
 
156
     aassiiss
157
        Filenames are reported in the case they were created with.
158
 
159
     lloowweerr
160
        Filenames are reported in lowercase.
161
 
162
  22..33..  ccoonnvv=={{aauuttoo,, bbiinnaarryy,, tteexxtt}}
163
 
164
  default value: binary
165
 
166
  This option controls CR<->NL conversion of Macintosh _d_a_t_a _f_o_r_k_s.  Any
167
  translation takes place only for files accessed with the read() and
168
  write() system calls (either directly or through the stdio functions).
169
  Access through mmap() is unaffected.  (Similar to the conv= option for
170
  the MS-DOS filesystem.)
171
 
172
     aauuttoo
173
        If the Finder's type for a file is TEXT or ttro, then CR
174
        characters are converted to NL characters when read, and NL
175
        characters are converted to CR characters when written.
176
 
177
        Be warned that some Macintosh applications create files with
178
        type TEXT even though the contents is clearly binary.
179
 
180
     bbiinnaarryy
181
        No CR<->NL conversion is done.
182
 
183
     tteexxtt
184
        In all data forks, regardless of the Finder's type for the file,
185
        CR characters are converted to NL characters when read, and NL
186
        characters are converted to CR characters when written.
187
 
188
  22..44..  ccrreeaattoorr==cccccccc
189
 
190
  default value: ``????''
191
 
192
  Specifies the 4-character string specifying the Finder's Creator for
193
  new files.
194
 
195
  22..55..  ffoorrkk=={{ccaapp,, ddoouubbllee,, nneettaattaallkk}}
196
 
197
  default value: cap
198
 
199
  This option determines how resource forks and the Finder's metadata
200
  are represented within the structure of the Linux filesystem.
201
 
202
     ccaapp
203
        The scheme used by the Columbia AppleTalk Package's AUFS.
204
 
205
        Associated with each directory are two special directories and a
206
        metadata file.  The directory ./bar is represented by:
207
 
208
        ..//bbaarr
209
           The directory itself, containing subdirectories, the data
210
           forks of files, and the following two special directories.
211
 
212
        ..//bbaarr//..rreessoouurrccee
213
           A special directory holding resource forks of the files in
214
           ./bar.
215
 
216
        ..//bbaarr//..ffiinnddeerriinnffoo
217
           A special directory holding metadata files for the files and
218
           subdirectories in ./bar.
219
 
220
        ..//..ffiinnddeerriinnffoo//bbaarr
221
           The metadata file for the directory ./bar.
222
 
223
        The files in a directory are represented as three files:
224
 
225
        ..//ffoooo
226
           The data fork of the file ./foo.
227
 
228
        ..//..rreessoouurrccee//ffoooo
229
           The resource fork of the file ./foo.
230
 
231
        ..//..ffiinnddeerriinnffoo//ffoooo
232
           The metadata file for the file ./foo.
233
 
234
        Additionally, the file .rootinfo in the root directory of the
235
        HFS filesystem is a metadata file for the root directory.
236
 
237
        Brief documentation on the format of file containing the
238
        Finder's metadata is included in the section ``A Guide to
239
        Special File Formats'' in this document.  More detailed
240
        information is available in the Columbia AppleTalk Package.
241
 
242
     ddoouubbllee
243
        The ``AppleDouble'' format recommended by Apple.  (Apple's other
244
        recommended format, ``AppleSingle'', is not yet implemented.)
245
 
246
        Associated with each directory is an AppleDouble ``header
247
        file''.  The directory ./bar is represented by:
248
 
249
        ..//bbaarr
250
           The directory itself, containing subdirectories, the data
251
           forks for files, and the header files for files and
252
           subdirectories.
253
 
254
        ..//%%bbaarr
255
           The header file for the directory ./bar, containing the
256
           Finder's metadata for the directory.
257
 
258
        The files in a directory are represented as two files:
259
 
260
        ..//ffoooo
261
           The data fork of the file ./foo.
262
 
263
        ..//%%ffoooo
264
           The header file for the file ./foo, containing the resource
265
           fork and the Finder's metadata for the file.
266
 
267
        Additionally, the file %RootInfo in the root directory of the
268
        HFS filesystem is a header file for the root directory.  This is
269
        not quite the %RootInfo file referred to in the AppleDouble
270
        specification.
271
 
272
        The header files used in this scheme are version 2 AppleDouble
273
        header files.  Their format is described briefly in the section
274
        ``A Guide to Special File Formats'' in this document.  They are
275
        documented in detail in ``AppleSingle/AppleDouble Formats:
276
        Developer's Note (9/94)'', available from Apple's Developer
277
        Services Page .
278
 
279
        Note that the naming convention for the header file can cause
280
        name conflicts.  For instance, using Apple's 7-bit ASCII name
281
        conversion (see the names mount option) the name %Desktop could
282
        be interpreted either as the header file for the file Desktop or
283
        as the file with 0xDE as the hexadecimal representation of its
284
        first character, and "sktop" as the remaining 5 characters.  The
285
        problem arises when both files exist, since only one will be
286
        accessible.  The behavior of the HFS filesystem in the case of
287
        such a conflict is undefined, and may change in future releases.
288
        (If this causes problems for you, please don't report it as a
289
        bug; I didn't design this ``standard'', Apple did.)
290
 
291
     nneettaattaallkk
292
        The scheme used by the Netatalk afpd.
293
 
294
        Associated with each directory is a special directory and a
295
        metadata file.  The directory ./bar is represented by:
296
 
297
        ..//bbaarr
298
           The directory itself, containing subdirectories, the data
299
           forks of files, and the following special directory.
300
 
301
        ..//bbaarr//..AApppplleeDDoouubbllee
302
           A special directory holding AppleDouble header files for
303
           ./bar and the files it contains, but not for the
304
           subdirectories it contains.
305
 
306
        ..//bbaarr//..AApppplleeDDoouubbllee//..PPaarreenntt
307
           The header file for the directory ./bar, containing the
308
           Finder's metadata for the directory.
309
 
310
        The files in a directory are represented as two files:
311
 
312
        ..//ffoooo
313
           The data fork of the file ./foo.
314
 
315
        ..//..AApppplleeDDoouubbllee//ffoooo
316
           The header file for file ./foo, containing the resource fork
317
           and the Finder's metadata.
318
 
319
        The header files used in this scheme are version 1 AppleDouble
320
        header files.  They are described briefly in the section ``A
321
        Guide to Special File Formats'' in this document.  The format is
322
        documented in detail in the ``Apple II File Type Notes'' under
323
        the type ``$E0.0002/$E0.0003-AppleDouble'', and in Appendix B of
324
        the ``A/UX Toolbox: Macintosh ROM Interface'' manual.
325
 
326
  22..66..  ggiidd==nn
327
 
328
  default value: gid of the mounting process
329
 
330
  Specifies the group that owns all files and directories on the
331
  filesystem.  (Same as for the MS-DOS and HPFS filesystems.)
332
 
333
  22..77..  nnaammeess=={{77bbiitt,, 88bbiitt,, aallpphhaa,, ccaapp,, llaattiinn,, nneettaattaallkk,, ttrriivviiaall}}
334
 
335
  default value: varies as follows
336
 
337
  +o  If the fork option is set to double, then names defaults to alpha.
338
 
339
  +o  If the fork option is set to netatalk, then names defaults to
340
     netatalk.
341
 
342
  +o  If the fork option is set to cap (or has taken that value by
343
     default), then names defaults to cap.
344
 
345
  This option determines how to convert between valid Macintosh
346
  filenames and valid Linux filenames.  The 7bit, 8bit and alpha options
347
  correspond to Apple's recommended conventions named ``7-bit ASCII'',
348
  ``8-bit'' and ``7-bit alphanumeric''.
349
 
350
     77bbiitt
351
        When converting from Macintosh filenames to Linux filenames the
352
        NULL (0x00), slash (/) and percent (%) characters and the
353
        extended 8-bit characters (hexadecimal codes 0x80-0xff) are
354
        replaced by a percent character (%) followed by the two-digit
355
        hexadecimal code for the character.
356
 
357
        When converting from Linux filenames to Macintosh filenames the
358
        string "%YZ" is replaced by the character with hexadecimal code
359
        0xYZ.  If 0xYZ is not a valid hexadecimal number or is the code
360
        for NULL or colon (:) then the string "%YZ" is unchanged.  A
361
        colon (:) is replaced by a pipe character (|).
362
 
363
     88bbiitt
364
        When converting from Macintosh filenames to Linux filenames the
365
        NULL (0x00), slash (/) and percent (%) characters are replaced
366
        by a percent character (%) followed by the two-digit hexadecimal
367
        code for the character.
368
 
369
        When converting from Linux filenames to Macintosh filenames the
370
        string "%YZ" is replaced by the character with hexadecimal code
371
        0xYZ.  If 0xYZ is not a valid hexadecimal number or is the code
372
        for NULL or colon (:) then the string "%YZ" is unchanged.  A
373
        colon (:) is replaced by a pipe character (|).
374
 
375
     aallpphhaa
376
        When converting from Macintosh filenames to Linux filenames only
377
        the alphanumeric characters (a-z, A-Z and 0-9), the underscore
378
        (_) and the last period (.) in the filename are unchanged.  The
379
        remaining characters are replaced by a percent character (%)
380
        followed by the two-digit hexadecimal code for the character.
381
 
382
        When converting from Linux filenames to Macintosh filenames the
383
        string "%YZ" is replaced by the character with hexadecimal code
384
        0xYZ.  If 0xYZ is not a valid hexadecimal number or is the code
385
        for NULL or colon (:) then the string "%YZ" is unchanged.  A
386
        colon (:) is replaced by a pipe character (|).
387
 
388
     ccaapp
389
        The convention used by the Columbia AppleTalk Package's AUFS.
390
 
391
        When converting from Macintosh filenames to Linux filenames the
392
        characters from space ( ) through tilde (~) (ASCII 32-126) are
393
        unchanged, with the exception of slash (/).  The slash (/) and
394
        all characters outside the range 32-126 are replaced by a colon
395
        (:) followed by the two-digit hexadecimal code for the
396
        character.
397
 
398
        When converting from Linux filenames to Macintosh filenames the
399
        string ":YZ" is replaced by the character with hexadecimal code
400
        0xYZ.  If 0xYZ is not a valid hexadecimal number or is the code
401
        for NULL or colon (:) then the colon is replaced by a pipe
402
        character (|).
403
 
404
     llaattiinn
405
        When converting from Macintosh filenames to Linux filenames the
406
        characters from space ( ) through tilde (~) (ASCII 32-126) are
407
        unchanged, with the exception of slash (/) and percent (%).  The
408
        extended 8-bit Macintosh characters with equivalents in the
409
        Latin-1 character set are replaced by those equivalents.  The
410
        remaining characters are replaced by a percent character (%)
411
        followed by the two-digit hexadecimal code for the character.
412
 
413
        When converting from Linux filenames to Macintosh filenames the
414
        string "%YZ" is replaced by the character with hexadecimal code
415
        0xYZ.  If 0xYZ is not a valid hexadecimal number or is the code
416
        for NULL or colon (:) then the string "%YZ" is unchanged. The
417
        Latin-1 characters with equivalents in the extended 8-bit
418
        Macintosh character set are replaced by those equivalents.  A
419
        colon (:) is replaced by a pipe character (|).
420
 
421
        Thanks to Holger Schemel (aeglos@valinor.owl.de) for
422
        contributing this conversion mode.
423
 
424
     nneettaattaallkk
425
        The convention used by the Netatalk afpd.
426
 
427
        When converting from Macintosh filenames to Linux filenames the
428
        characters from space ( ) through tilde (~) (ASCII 32-126) are
429
        unchanged, with the exception of slash (/) and any initial
430
        period (.).  The slash (/) and any initial period (.)  and all
431
        characters outside the range 32-126 are replaced by a colon (:)
432
        followed by the two-digit hexadecimal code for the character.
433
 
434
        When converting from Linux filenames to Macintosh filenames the
435
        string ":YZ" is replaced by the character with hexadecimal code
436
        0xYZ.  If 0xYZ is not a valid hexadecimal number or is the code
437
        for NULL or colon (:) then the colon is replaced by a pipe
438
        character (|).
439
 
440
     ttrriivviiaall
441
        When converting from Macintosh filenames to Linux filenames a
442
        slash character (/) is replaced by a colon (:).
443
 
444
        When converting from Linux filenames to Macintosh filenames a
445
        colon (:) is replaced by a slash character (/).
446
 
447
  22..88..  ppaarrtt==nn
448
 
449
  default value: 0
450
 
451
  Specifies which HFS partition to mount from a Macintosh CDROM or hard
452
  drive.  Partitions are numbered from 0 and count only those identified
453
  in the partition table as containing HFS filesystems.  This option is
454
  only useful when the Linux platform doesn't fully support Macintosh
455
  partition tables.  In particular on MkLinux and Linux-Pmac this option
456
  is useless.
457
 
458
  Note that in versions before 0.8.3 partitions were numbered from 1.
459
 
460
  22..99..  qquuiieett
461
 
462
  If included in the options, then chown and chmod operations will not
463
  return errors, but will instead fail silently.  (Same as for the MS-
464
  DOS and HPFS filesystems.)
465
 
466
  22..1100..  ttyyppee==cccccccc
467
 
468
  default value: ``????''
469
 
470
  Specifies the 4-character string specifying the Finder's Type for new
471
  files.
472
 
473
  22..1111..  uuiidd==nn
474
 
475
  default value: uid of the mounting process
476
 
477
  Specifies the user that owns all files and directories on the
478
  filesystem.  (Same as for the MS-DOS and HPFS filesystems.)
479
 
480
  22..1122..  uummaasskk==nn
481
 
482
  default value: umask of the mounting process
483
 
484
  Specifies (in octal) the umask used for all files and directories.
485
  (Same as for the MS-DOS and HPFS filesystems.)
486
 
487
  33..  WWrriittiinngg ttoo HHFFSS FFiilleessyysstteemmss
488
 
489
  Each of the values of the fork mount option yields a different
490
  representation of the Macintosh-specific parts of a file within the
491
  structure of the Linux filesystem.  There are, therefore, slightly
492
  different steps involved in copying files if you want to preserve the
493
  resource forks and the Finder's metadata.
494
 
495
  It is important to remember not to use normal user-level tools to
496
  modify a filesystem mounted with the afpd mount option.
497
 
498
  Regardless of the value of the fork mount option you can do virtually
499
  everything to the data fork of a file that you can to a file on any
500
  other filesystem.  The limitations are essentially the same as those
501
  imposed by the MS-DOS filesystem:
502
 
503
  +o  You can't change the uid or gid of files.
504
 
505
  +o  You can't set the set-uid, set-gid or sticky permission bits.
506
 
507
  +o  You can't clear the execute permission bits.
508
 
509
  Likewise you can do virtually everything to a directory that you can
510
  to a directory on another file system with the following exceptions:
511
 
512
  +o  You can't create, delete or rename resource forks of files or the
513
     Finder's metadata.  Note, however, that they are created (with
514
     defaults values), deleted and renamed along with the corresponding
515
     data fork or directory.
516
 
517
  +o  You can't change permissions on directories.
518
 
519
  +o  You can't change the uid or gid of directories.
520
 
521
  +o  You can't create multiple links to files.
522
 
523
  +o  You can't create symlinks, device files, sockets or FIFOs.
524
 
525
  33..11..  WWrriittiinngg wwiitthh ffoorrkk==ccaapp
526
 
527
  Unlike the other schemes for representing forked files, the CAP scheme
528
  presents the resource fork as an independent file; the resource fork
529
  of ./foo is ./.resource/foo.  Therefore, you can treat it as a normal
530
  file.  You can do anything to a resource fork that you can do to a
531
  data fork, except that you cannot enable execute permissions on a
532
  resource fork.  Therefore, resource forks are not suitable for holding
533
  Linux executables or shared libraries.
534
 
535
  If you plan to use the resource fork on a Macintosh then you must obey
536
  the format of a valid resource fork.  This format is documented in
537
  Chapter 1 of Apple's _I_n_s_i_d_e _M_a_c_i_n_t_o_s_h_: _M_o_r_e _M_a_c_i_n_t_o_s_h _T_o_o_l_b_o_x.  The
538
  filesystem knows nothing about this format and so does nothing to
539
  enforce it.
540
 
541
  The current support for reading and writing is sufficient to allow
542
  copying of entire directories with tar, as long as both the source and
543
  destination are mounted with fork=cap.  tar may complain about being
544
  unable to change the uid, gid or mode of files.  This is normal and is
545
  an unavoidable side effect of the having a single uid, gid and umask
546
  for the entire filesystem.
547
 
548
  It is impossible to create a resource fork or a Finder metadata file.
549
  However, they are created automatically when the data fork is created.
550
  Therefore, if you wish to copy a single file including both forks and
551
  the Finder's metadata then you must create the data fork first.  Then
552
  you can copy the resource fork and the Finder's metadata.  For
553
  instance to copy the file foo to dir/bar you should do the following:
554
 
555
  1. cp foo dir/bar
556
 
557
  2. cp .resource/foo dir/.resource/bar
558
 
559
  3. cp .finderinfo/foo dir/.finderinfo/bar
560
 
561
  You may get ``Operation not permitted'' errors from cp when it tries
562
  to change the permissions on files.  These errors can safely be
563
  ignored.  This method will work even if the file dir/bar exists.
564
 
565
  If you wish to move foo to dir/bar and foo and dir are on the same
566
  filesystem then you only need to execute ``mv foo dir/bar'' and the
567
  resource fork and the Finder's metadata will move too.  However, if
568
  foo and dir are on different filesystem then this will lose the
569
  resource fork and metadata.  Therefore, it is safest to always move
570
  files as follows:
571
 
572
  1. cp foo dir/bar
573
 
574
  2. cp .resource/foo dir/.resource/bar
575
 
576
  3. cp .finderinfo/foo dir/.finderinfo/bar
577
 
578
  4. rm foo
579
 
580
  You may get ``Operation not permitted'' errors from cp when it tries
581
  to change the permissions on files.  These errors can safely be
582
  ignored.  This method will work even if the file dir/bar exists.
583
 
584
  Directories have no resource fork but you may wish to create a
585
  directory which has the same location and view on the Finder's screen
586
  as an existing one.  This can be done by copying the Finder metadata
587
  file.  To give the directory bar the same location, layout, creation
588
  date and modify date as foo you simply execute ``cp .finderinfo/foo
589
  .finderinfo/bar''.
590
 
591
  When copying an entire directory with ``cp -R'' you may also wish to
592
  copy the metadata for the directory:
593
 
594
  1. cp -R foo bar
595
 
596
  2. cp .finderinfo/foo .finderinfo/bar
597
 
598
  You may get ``Operation not permitted'' errors from cp when it tries
599
  to change the permissions on files.  These errors can safely be
600
  ignored.
601
 
602
  33..22..  WWrriittiinngg wwiitthh ffoorrkk==ddoouubbllee
603
 
604
  The current support for reading and writing header files is sufficient
605
  to allow copying of entire directories with tar, as long as both the
606
  source and destination are mounted with fork=double.  tar may complain
607
  about being unable to change the uid, gid or mode of files.  This is
608
  normal and is an unavoidable side effect of the having a single uid,
609
  gid and umask for the entire filesystem.
610
 
611
  It is impossible to create a header file.  However, they are created
612
  automatically when the data fork is created.  Therefore, if you wish
613
  to copy a single file including both forks and the Finder's metadata
614
  then you must create the data fork first.  Then you can copy the
615
  header file.  instance to copy the file foo to dir/bar you should do
616
  the following:
617
 
618
  1. cp foo dir/bar
619
 
620
  2. cp %foo dir/%bar
621
 
622
  You may get ``Operation not permitted'' errors from cp when it tries
623
  to change the permissions on files.  These errors can safely be
624
  ignored.  This method will work even if the file dir/bar exists.
625
 
626
  If you wish to move foo to dir/bar and foo and dir are on the same
627
  filesystem then you only need to execute ``mv foo dir/bar'' and the
628
  header file will move too.  However, if foo and dir are on different
629
  filesystem then this will lose the header file.  Therefore, it is
630
  safest to always move files as follows:
631
 
632
  1. cp foo dir/bar
633
 
634
  2. cp %foo dir/%bar
635
 
636
  3. rm foo
637
 
638
  You may get ``Operation not permitted'' errors from cp when it tries
639
  to change the permissions on files.  These errors can safely be
640
  ignored.  This method will work even if the file dir/bar exists.
641
 
642
  Directories have no resource fork but you may wish to create a
643
  directory which has the same location and view on the Finder's screen
644
  as an existing one.  This can be done by copying the corresponding
645
  header file.  To give the directory bar the same location, layout,
646
  creation date and modify date as foo simply execute ``cp %foo %bar''.
647
 
648
  When copying an entire directory with ``cp -R'' you may also wish to
649
  copy the header file for the directory as well:
650
 
651
  1. cp -R foo bar
652
 
653
  2. cp %foo %bar
654
 
655
  You may get ``Operation not permitted'' errors from cp when it tries
656
  to change the permissions on files.  These errors can safely be
657
  ignored.
658
 
659
  33..33..  WWrriittiinngg wwiitthh ffoorrkk==nneettaattaallkk
660
 
661
  The current support for reading and writing header files is sufficient
662
  to allow copying of entire directories with tar, as long as both the
663
  source and destination are mounted fork=netatalk.  tar may complain
664
  about being unable to change the uid, gid or mode of files.  This is
665
  normal and is an unavoidable side effect of the having a single uid,
666
  gid and umask for the entire filesystem.
667
 
668
  It is impossible to create a header file.  However, they are created
669
  automatically when the data fork is created.  Therefore, if you wish
670
  to copy a single file including both forks and the Finder's metadata
671
  then you must create the data fork first.  Then you can copy the
672
  header file.  instance to copy the file foo to dir/bar you should do
673
  the following:
674
 
675
  1. cp foo dir/bar
676
 
677
  2. cp .AppleDouble/foo dir/.AppleDouble/bar
678
 
679
  You may get ``Operation not permitted'' errors from cp when it tries
680
  to change the permissions on files.  These errors can safely be
681
  ignored.  This method will work even if the file dir/bar exists.
682
 
683
  If you wish to move foo to dir/bar and foo and dir are on the same
684
  filesystem then you only need to execute ``mv foo dir/bar'' and the
685
  header file will move too.  However, if foo and dir are on different
686
  filesystem then this will lose the header file.  Therefore, it is
687
  safest to always move files as follows:
688
 
689
  1. cp foo dir/bar
690
 
691
  2. cp .AppleDouble/foo dir/.AppleDouble/bar
692
 
693
  3. rm foo
694
 
695
  You may get ``Operation not permitted'' errors from cp when it tries
696
  to change the permissions on files.  These errors can safely be
697
  ignored.  This method will work even if the file dir/bar exists.
698
 
699
  Directories have no resource fork but you may wish to create a
700
  directory which has the same location and view on the Finder's screen
701
  as an existing one.  This can be done by copying the corresponding
702
  header file.  To give the directory bar the same location, layout,
703
  creation date and modify date as foo you simply execute ``cp
704
  foo/.AppleDouble/.Parent bar/.AppleDouble/.Parent''.
705
 
706
  Because the fork=netatalk scheme holds the header file for a directory
707
  within that directory, directories can safely be copied with ``cp -R
708
  foo bar'' with no loss of information.  However, you may get
709
  ``Operation not permitted'' errors from cp when it tries to change the
710
  permissions on files.  These errors can safely be ignored.
711
 
712
  44..  AA GGuuiiddee ttoo SSppeecciiaall FFiillee FFoorrmmaattss
713
 
714
  Each of the values of the fork mount option yields different special
715
  files to represent the Macintosh-specific parts of a file within the
716
  structure of the Linux filesystem.  You can write to these special
717
  files to change things such as the Creator and Type of a file.
718
  However, to do so safely you must follow certain rules to avoid
719
  corrupting the data.  Additionally, there are certain fields in the
720
  special files that you can't change (writes to them will fail
721
  silently).
722
 
723
  44..11..  CCAAPP ..ffiinnddeerriinnffoo FFiilleess
724
 
725
  The Finder's metadata for the file ./foo in held in the file
726
  ./.finderinfo/foo.  The file has a fixed format defined in hfs_fs.h as
727
  follows:
728
 
729
       ______________________________________________________________________
730
       struct hfs_cap_info {
731
               __u8    fi_fndr[32];            /* Finder's info */
732
               __u16   fi_attr;                /* AFP attributes */
733
               __u8    fi_magic1;              /* Magic number: */
734
       #define HFS_CAP_MAGIC1          0xFF
735
               __u8    fi_version;             /* Version of this structure: */
736
       #define HFS_CAP_VERSION         0x10
737
               __u8    fi_magic;               /* Another magic number: */
738
       #define HFS_CAP_MAGIC           0xDA
739
               __u8    fi_bitmap;              /* Bitmap of which names are valid: */
740
       #define HFS_CAP_SHORTNAME       0x01
741
       #define HFS_CAP_LONGNAME        0x02
742
               __u8    fi_shortfilename[12+1]; /* "short name" (unused) */
743
               __u8    fi_macfilename[32+1];   /* Original (Macintosh) name */
744
               __u8    fi_comln;               /* Length of comment (always 0) */
745
               __u8    fi_comnt[200];          /* Finder comment (unused) */
746
               /* optional:    used by aufs only if compiled with USE_MAC_DATES */
747
               __u8    fi_datemagic;           /* Magic number for dates extension: */
748
       #define HFS_CAP_DMAGIC          0xDA
749
               __u8    fi_datevalid;           /* Bitmap of which dates are valid: */
750
       #define HFS_CAP_MDATE           0x01
751
       #define HFS_CAP_CDATE           0x02
752
               __u8    fi_ctime[4];            /* Creation date (in AFP format) */
753
               __u8    fi_mtime[4];            /* Modify date (in AFP format) */
754
               __u8    fi_utime[4];            /* Un*x time of last mtime change */
755
       };
756
       ______________________________________________________________________
757
 
758
  The type __u8 is an unsigned character, and __u16 is an unsigned
759
  16-bit integer.
760
 
761
  Currently only the fields fi_fndr, fi_attr, fi_ctime and fi_mtime can
762
  be changed.  Writes to the other fields are silently ignored.
763
  However, you shouldn't write random bytes to the other fields, since
764
  they may be writable in the future.
765
 
766
  The fi_fndr field is the ``Finder info'' and ``Extended Finder info''
767
  for a file or directory.  These structures are described in various
768
  books on Macintosh programming.  The portion of the most interest is
769
  probably the first 8 bytes which, for a file, give the 4-byte Type
770
  followed by the 4-byte Creator.
771
 
772
  The fi_attr field is the AFP attributes of the file or directory.
773
  While you can write any value to this field, only the ``write-
774
  inhibit'' bit is significant.  Setting or clearing this bit will clear
775
  or set the write bits in the file's permissions.  When you read from
776
  this field anything you may have written is lost.  If the file has
777
  write permissions enabled then you will read zero from this field.
778
  With write permission disabled you will read back 0x01 0xA0, which
779
  corresponds to setting the ``write-inhibit'', ``rename-inhibit'' and
780
  ``delete-inhibit'' bits.
781
 
782
  The fi_ctime and fi_mtime are the Macintosh created and modified time
783
  for the file or directory, and are 32-bit signed integers in network
784
  byteorder giving seconds from 00:00 GMT Jan. 1, 2000.
785
 
786
  44..22..  AApppplleeDDoouubbllee HHeeaaddeerr FFiilleess
787
 
788
  Both the fork=double and fork=netatalk schemes for representing forked
789
  files use AppleDouble header files to contain the resource fork and
790
  the Finder's metadata together in a single file.
791
 
792
  The AppleDouble format specifies a fixed-format header which describes
793
  which fields are contained in the remainder of the file, where they
794
  are located in the file and how long they are.  A full description of
795
  the version 1 format used when fork=netatalk is available from ??????.
796
  The version 2 format used when fork=double is documented in ??????.
797
  The discussion that follows assumes you have read and understood these
798
  documents, which may be difficult until I've replaced the ``??????''s
799
  above with something more informative :-).
800
 
801
  Due to the variable structure of an AppleDouble header file you must
802
  not use buffered I/O when reading or writing them; you should only use
803
  the read() and write() system calls.  It is also important that you
804
  make some effort to coordinate processes that are reading and writing
805
  the same header file, since a reader will receive the wrong data if
806
  the location of a given entry has changed since it read the descriptor
807
  for the entry.  If a process tries to read the descriptor table while
808
  it is changing then it is possible to read totally meaningless data.
809
 
810
  When a header file is opened it is initially presented with a default
811
  header layout.  You may write to the header to change the layout, but
812
  when all file descriptors for the file or directory have been closed
813
  the change in format is lost and subsequent opens will yield the
814
  default layout.  Changes to supported entries are made directly to the
815
  filesystem and are thus preserved when the file is closed and
816
  reopened.
817
 
818
  The HFS filesystem currently uses a fixed-size table to hold the
819
  descriptors.  Therefore you are limited to HFS_HDR_MAX (currently 10)
820
  descriptors.  In the unlikely event that you try to write a header
821
  with more descriptors, a warning will be issued by the kernel, and
822
  extra descriptors will be ignored.  This should be considered a bug
823
  and will hopefully change sooner rather than later.
824
 
825
  The results of specifying overlapping entries is undefined and should
826
  not be relied upon to remain unchanged from one version of the HFS
827
  filesystem to the next.  There is no valid reason to define
828
  overlapping entries, so just don't do it!
829
 
830
  Changes to the magic number and version fields are preserved until all
831
  file descriptors are closed, however the only significance given to
832
  them internally is that the 16 bytes following the version changes
833
  meaning according to the version.  For version 1 header files these 16
834
  bytes contain the string ``Macintosh'' followed by 7 spaces.  For any
835
  other value of the version field these 16 bytes are all zeros.  In
836
  either case writes to these 16 bytes are silently ignored.
837
 
838
  Since the magic number and version are given no other significance
839
  internally, you are free to do many things that violate the official
840
  formats.  For instance you can create an entry for the data fork in a
841
  header file with an AppleDouble magic number or create ``File Info''
842
  (id=7) entries in version 2 header files and ``File Dates Info''
843
  (id=8) entries in version 1 header files.  However, future versions of
844
  the filesystem may enforce the format more strictly.
845
 
846
  Entry id 1 (``Data Fork'') is read-only.  You should use the data file
847
  to modify the data fork.  The data fork is, of course, not supported
848
  for directories.
849
 
850
  Entry ids 2, 7, 8, 9 and 10 (``Resource Fork'', ``File Info'', ``File
851
  Dates Info'', ``Finder Info'' and ``Macintosh File Info'') are fully
852
  supported, meaning that their contents may be read and written and
853
  that data written is preserved when the file is closed and reopened.
854
  The resource fork is, of course, not supported for directories.
855
 
856
  Entry id 7 specifies some of the same data given by ids 8 and 10.  If
857
  you create a header file with an entry for id 7 and for ids 8 or 10,
858
  then the behavior with respect to their interaction is undefined.  A
859
  header that contains an entry for id 7 and for ids 8 or 10 is not
860
  valid as either a version 1 or a version 2 header file, so there is no
861
  reason to do this and future versions may prevent it.
862
 
863
  Entry id 3 (``Real Name'') is read-only, since it will change
864
  automatically when a file is renamed.  Writes to the corresponding
865
  entry are silently ignored.
866
 
867
  All other entry ids are ignored.  You may create descriptors for them;
868
  in fact the default header layout when fork=netatalk includes a
869
  descriptor for id 4 (``Comment'').  However writes to the entries
870
  corresponding to the ignored ids fail silently and reads from the
871
  entries always return zeros.  However, you shouldn't write random
872
  bytes to unsupported entries, since they may be supported in the
873
  future.
874
 
875
  All of the supported entry types except the data and resource forks
876
  have a fixed length.  If you give them a smaller length in the
877
  descriptor then you are unable to access part of the corresponding
878
  entry.  If you give them a larger length in the descriptor, then the
879
  corresponding entry is padded with zeros and writes to the extra space
880
  are silently ignored.
881
 
882
  Writes to the length field of descriptors for the data and resource
883
  forks will cause the corresponding fork to grow (with zero padding) or
884
  shrink to the indicated length.
885
 
886
  If you have an entry for the data fork then the descriptor's length
887
  field does not change automatically to reflect any modification of the
888
  data fork directly (the data does change however).  If the data fork
889
  is longer than the descriptor indicates, then a portion of it is
890
  inaccessible.  If the data fork is shorter than the descriptor
891
  indicates then reads will be padded with zeros.
892
 
893
  Writes beyond the end of the resource fork that extend into empty
894
  space between entries or beyond the end of the file will extend the
895
  fork, automatically changing the length field of the corresponding
896
  descriptor.  Writes to any other space between entries are silently
897
  ignored and read of such spaces always return zeros.
898
 
899
  Calling truncate() on a header file can change the length of the
900
  resource fork and such a change will automatically be reflected in the
901
  length field of the corresponding descriptor.  If truncate() shortens
902
  the file so that the entry for the resource fork would extend beyond
903
  the new end of the file then the fork is shortened to fit in the space
904
  that remains, or to zero bytes if the entry is now entirely beyond the
905
  end of the file.  If the last entry in a header file is the resource
906
  fork then a call to truncate() that extends the header file will
907
  extend the fork with zeros.  Note that this happens even if there was
908
  previously space between the end of the fork and the end of the file.
909
 
910
  55..  RReeppoorrttiinngg BBuuggss
911
 
912
  If you'd like any problems you encounter fixed, you'll need to provide
913
  a detailed bug report.  However, you should check the FAQ (available
914
  from the HFS for Linux Page )
915
  first to be certain that your problem is not a known limitation of the
916
  filesystem.  If your bug doesn't appear in the FAQ then you should e-mail
917
  me at hargrove@sccm.Stanford.EDU.
918
 
919
  55..11..  WWhhaatt GGooeess iinn aa BBuugg RReeppoorrtt
920
 
921
  When writing your bug report, include any facts you think might be
922
  relevant; I'd much rather have a bunch of extra facts than need to
923
  e-mail you to get the information.  At a minimum the following
924
  information should be included:
925
 
926
  +o  The version of the HFS filesystem you are using (see
927
     linux/fs/hfs/version.h).
928
 
929
  +o  The kernel version you are using.
930
 
931
  +o  Any unofficial kernel patches or loadable modules you are using.
932
 
933
  +o  If you are loading the HFS filesystem as a module, then version of
934
     the module utilities used to load hfs.o.
935
 
936
  +o  The type of media you are working with (floppy, CDROM, ZIP Drive,
937
     etc.).
938
 
939
  +o  The steps required to reproduce the bug, including mount options
940
     used.  (If you can't reproduce the bug tell me everything you did
941
     the one time it did occur, but be warned that non-reproducible bugs
942
     can only rarely be fixed.)
943
 
944
  55..22..  HHooww ttoo RReeppoorrtt aa KKeerrnneell OOooppss oorr GGPPFF
945
 
946
  If you encounter a bug that causes a kernel Oops or a General
947
  Protection Fault then you'll need to collect some additional
948
  information for the bug report.  If you are loading the HFS filesystem
949
  as a module, then is important that you do this before rebooting,
950
  since the module is unlikely to be loaded at the same address after
951
  the reboot.
952
 
953
  You should include all the information that the kernel prints to the
954
  console or to the system logs.  However, the EIP and Stack Trace are
955
  addresses in _y_o_u_r kernel and mean nothing to me without more
956
  information.  Using your System.map file (or either ksymoops or klogd)
957
  determine which functions the EIP and Stack Trace are in.  If you do
958
  this by hand using your System.map file then the correct symbol is the
959
  one of type t or T with the largest address less than or equal to the
960
  one you are resolving.
961
 
962
  If you are loading the HFS filesystem as a module and the Oops or GPF
963
  was in the HFS code then the EIP and the top levels of the Stack Trace
964
  will be in a loadable module, rather than in the kernel proper.  So,
965
  their symbols will not be in the file System.map.  Therefore, you will
966
  need to use /proc/ksyms, or a loadmap produced by passing the -m
967
  option to insmod, to locate those symbols.
968
 
969
  66..  LLeeggaall NNoottiicceess
970
 
971
  66..11..  TThhiiss DDooccuummeenntt
972
 
973
  This document is Copyright (c) 1996, 1997 by Paul H. Hargrove.
974
 
975
  Permission is granted to make and distribute verbatim copies of this
976
  document provided the copyright notice and this permission notice are
977
  preserved on all copies.
978
 
979
  Permission is granted to copy and distribute modified versions of this
980
  document under the conditions for verbatim copies above, provided a
981
  notice clearly stating that the document is a modified version is also
982
  included in the modified document.
983
 
984
  Permission is granted to copy and distribute translations of this
985
  document into another language, under the conditions specified above
986
  for modified versions.
987
 
988
  Permission is granted to convert this document into another media
989
  under the conditions specified above for modified versions provided
990
  the requirement to acknowledge the source document is fulfilled by
991
  inclusion of an obvious reference to the source document in the new
992
  media. Where there is any doubt as to what defines ``obvious'' the
993
  copyright owner reserves the right to decide.
994
 
995
  66..22..  TThhee SSooffttwwaarree
996
 
997
  The HFS filesystem for Linux is Copyright (c) 1994-1997 by Paul H.
998
  Hargrove.
999
 
1000
  This software is free software; you can redistribute it and/or modify
1001
  it under the terms of the GNU General Public License as published by
1002
  the Free Software Foundation; either version 2, or (at your option)
1003
  any later version.
1004
 
1005
  This software is distributed in the hope that it will be useful, but
1006
  WITHOUT ANY WARRANTY; without even the implied warranty of
1007
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1008
  General Public License for more details.
1009
 
1010
  You should have received a copy of the GNU General Public License
1011
  along with this software in the file ``COPYING''; if not, write to the
1012
  Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
1013
  USA.
1014
 
1015
  66..22..11..  TThhee CCoolluummbbiiaa AApppplleeTTaallkk PPaacckkaaggee ffoorr UUNNIIXX
1016
 
1017
  The source code distribution of the Columbia AppleTalk Package for
1018
  UNIX, version 6.0, (CAP) was used as a _s_p_e_c_i_f_i_c_a_t_i_o_n of the location
1019
  and format of files used by CAP's Aufs.  No code from CAP appears in
1020
  the HFS filesystem. The HFS filesystem is not a work ``derived'' from
1021
  CAP in the sense of intellectual property law.
1022
 
1023
  66..22..22..  NNeettaattaallkk
1024
 
1025
  The source code distributions of Netatalk, versions 1.3.3b2 and 1.4b2,
1026
  were used as a _s_p_e_c_i_f_i_c_a_t_i_o_n of the location and format of files used
1027
  by Netatalk's afpd.  No code from Netatalk appears in the HFS
1028
  filesystem.  The HFS filesystem is not a work ``derived'' from
1029
  Netatalk in the sense of intellectual property law.
1030
 
1031
  66..33..  TTrraaddeemmaarrkkss
1032
 
1033
  +o  ``Finder'' is a trademarks of Apple Computer, Inc.
1034
 
1035
  +o  ``Apple'', ``AppleShare'', ``AppleTalk'' and ``Macintosh'' are
1036
     registered trademarks of Apple Computer, Inc.
1037
 
1038
  +o  ``Microsoft'' and ``MS-DOS'' are registered trademarks of Microsoft
1039
     Corporation.
1040
 
1041
  +o  All other trademarks are the property of their respective owners.
1042
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.