throbber

`
`
`
`
`
`
`
`Files
`
`I N S I D E M A C I N T O S H
`
`Addison-Wesley Publishing Company
`
`Reading, Massachusetts Menlo Park, California New York
`Don Mills, Ontario Wokingham, England Amsterdam Bonn
`Sydney Singapore Tokyo Madrid San Juan
`Paris Seoul Milan Mexico City Taipei
`
`Petitioner Apple Inc. - Exhibit 1008, p. 1
`
`(cid:240)
`

`

`Apple Computer, Inc.
`© 1992, Apple Computer, Inc.
`All rights reserved.
`No part of this publication may be
`reproduced, stored in a retrieval
`system, or transmitted, in any form or
`by any means, mechanical, electronic,
`photocopying, recording, or otherwise,
`without prior written permission of
`Apple Computer, Inc. Printed in the
`United States of America.
`No licenses, express or implied, are
`granted with respect to any of the
`technology described in this book.
`Apple retains all intellectual property
`rights associated with the technology
`described in this book. This book is
`intended to assist application
`developers to develop applications only
`for Apple Macintosh computers.
`Apple Computer, Inc.
`20525 Mariani Avenue
`Cupertino, CA 95014-6299
`408-996-1010
`Apple, the Apple logo, APDA,
`AppleShare, AppleTalk, A/UX,
`LaserWriter, Macintosh, MPW,
`and ProDOS are trademarks of
`Apple Computer, Inc. registered in the
`United States and other countries.
`Apple SuperDrive, Balloon Help, Disk
`First Aid, Finder, ResEdit, and System 7
`are trademarks of Apple Computer, Inc.
`Adobe Illustrator and PostScript are
`trademarks of Adobe Systems
`Incorporated, which may be registered
`in certain jurisdictions.
`AGFA is a trademark of Agfa-Gevaert.
`FrameMaker is a registered trademark
`of Frame Technology Corporation.
`Helvetica and Palatino are registered
`trademarks of Linotype Company.
`ITC Zapf Dingbats is a registered
`trademark of International Typeface
`Corporation.
`MS-DOS is a registered trademark of
`Microsoft Corporation.
`Sony is a registered trademark of Sony
`Corporation.
`Simultaneously published in the United
`States and Canada.
`
`LIMITED WARRANTY ON MEDIA AND
`REPLACEMENT
`
`ALL IMPLIED WARRANTIES ON THIS
`MANUAL, INCLUDING IMPLIED
`WARRANTIES OF MERCHANTABILITY
`AND FITNESS FOR A PARTICULAR
`PURPOSE, ARE LIMITED IN DURATION
`TO NINETY (90) DAYS FROM THE DATE
`OF THE ORIGINAL RETAIL PURCHASE
`OF THIS PRODUCT.
`
`Even though Apple has reviewed this
`manual, APPLE MAKES NO WARRANTY
`OR REPRESENTATION, EITHER EXPRESS
`OR IMPLIED, WITH RESPECT TO THIS
`MANUAL, ITS QUALITY, ACCURACY,
`MERCHANTABILITY, OR FITNESS FOR A
`PARTICULAR PURPOSE. AS A RESULT,
`THIS MANUAL IS SOLD “AS IS,” AND
`YOU, THE PURCHASER, ARE ASSUMING
`THE ENTIRE RISK AS TO ITS QUALITY
`AND ACCURACY.
`
`IN NO EVENT WILL APPLE BE LIABLE
`FOR DIRECT, INDIRECT, SPECIAL,
`INCIDENTAL, OR CONSEQUENTIAL
`DAMAGES RESULTING FROM ANY
`DEFECT OR INACCURACY IN THIS
`MANUAL, even if advised of the possibility
`of such damages.
`
`THE WARRANTY AND REMEDIES SET
`FORTH ABOVE ARE EXCLUSIVE AND IN
`LIEU OF ALL OTHERS, ORAL OR
`WRITTEN, EXPRESS OR IMPLIED. No
`Apple dealer, agent, or employee is
`authorized to make any modification,
`extension, or addition to this warranty.
`
`Some states do not allow the exclusion or
`limitation of implied warranties or liability
`for incidental or consequential damages, so
`the above limitation or exclusion may not
`apply to you. This warranty gives you
`specific legal rights, and you may also have
`other rights which vary from state to state.
`
`ISBN 0-201-63244-6
`1 2 3 4 5 6 7 8 9-MU-9695949392
`First Printing, August 1992
`
`Petitioner Apple Inc. - Exhibit 1008, p. 2
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`P R E F A C E
`
`About This Book
`
`This book,
` describes the parts of the Macintosh
`Inside Macintosh: Files,
`Operating System that allow you to manage files. It shows in detail how your
`application can handle the commands typically found in a File menu. It also
`provides a complete technical reference to the File Manager, the Standard File
`Package, the Alias Manager, and other file-related services provided by the
`system software.
`If you are new to the Macintosh Operating System, you should begin with the
`chapter “Introduction to File Management.” This chapter describes the basic
`structure of Macintosh files and the hierarchical file system (HFS) used with
`Macintosh computers, and it shows how you can use the services provided by
`the Standard File Package, the File Manager, the Finder, and other system
`software components to create, open, update, and close files. Because this
`chapter is designed to be largely self-contained, the reference and summary
`sections in this chapter are subsets of the corresponding sections from the
`other chapters in this book.
`Once you are familiar with basic file management on Macintosh computers,
`you might want to read other chapters in this book. The chapter “File
`Manager” describes how your application can manage shared files; search
`for specific files in a volume; obtain information about files, directories, and
`volumes; and perform other advanced operations. This chapter also describes
`how the File Manager organizes file and directory data on disk and in
`memory. Much of this information is of interest only to designers of very
`specialized applications or file-system utility programs.
`If you want to customize the user interface for naming and identifying files,
`you need to read the chapter “Standard File Package.” It provides complete
`information on how to customize and display the dialog boxes that let the
`user specify the names and locations of files to be saved or opened.
`If your application needs to keep track of particular files, directories, or
`volumes, you might want to use the Alias Manager. It helps you find objects
`in the file system, even if those objects have been moved or renamed. See the
`chapter “Alias Manager” for complete details.
`The chapter “Disk Initialization Manager” shows how you can initialize disks
`and erase the contents of previously initialized disks. The Disk Initialization
`Manager provides a routine that allows you to present the standard user
`interface for initializing and naming disks. Most applications should call that
`routine whenever they receive a disk-inserted event and the inserted disk
`is invalid.
`
`xv
`
`Petitioner Apple Inc. - Exhibit 1008, p. 3
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`P R E F A C E
`
`Format of a Typical Chapter
`
`0
`
`Almost all chapters in this book follow a standard structure. For example, the
`chapter “Standard File Package” contains these sections:
`
`n
`
`n
`
`n
`
`n
`
`“About the Standard File Package.” This section provides an overview of the
`features provided by the Standard File Package.
`“Using the Standard File Package.” This section describes the tasks you can
`accomplish using the Standard File Package. It describes how to use the
`most common routines, gives related user interface information, provides
`code samples, and supplies additional information.
`“Standard File Package Reference.” This section provides a complete
`reference to the Standard File Package by describing the data structures and
`routines that it uses. Each routine description also follows a standard format,
`which gives the routine declaration and a description of every parameter of
`the routine. Some routine descriptions also give additional descriptive
`information, such as assembly-language information or result codes.
`“Summary of the Standard File Package.” This section provides the
`Standard File Package’s Pascal interface, as well as the C interface, for the
`constants, data structures, routines, and result codes associated with the
`Standard File Package. It also includes relevant assembly-language
`interface information.
`Some chapters contain additional main sections that provide more detailed
`discussions of certain topics. For example, the chapter “File Manager”
`contains the section “Identifying Files, Directories, and Volumes,” which
`describes the many ways to identify objects in the file system. That chapter
`also contains the two advanced sections “Data Organization on Volumes”
`and “Data Organization in Memory.”
`
`Conventions Used in This Book
`
` uses various conventions to present information. Words that
`Inside Macintosh
`require special treatment appear in specific fonts or font styles. Certain
`information, such as parameter blocks, use special formats so that you can
`scan them quickly.
`
`Special Fonts
`
`All code listings, reserved words, and the names of actual data structures,
`constants, fields, parameters, and routines are shown in Courier (
`this
`).
`is Courier
`Words that appear in
` are key terms or concepts and are defined in
`boldface
`the Glossary.
`
`0
`
`0
`
`xvi
`
`Petitioner Apple Inc. - Exhibit 1008, p. 4
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`P R E F A C E
`
`Types of Notes
`
`There are several types of notes used in this book.
`
`Note
`A note like this contains information that is interesting but possibly not
`essential to an understanding of the main text. (An example appears on
`page 1-6.)
`u
`
`IMPORTANT
`A note like this contains information that is essential for an
`understanding of the main text. (An example appears on page 1-6.)
`
`ss
`
`W A R N I N G
`Warnings like this indicate potential problems that you should be aware
`of as you design your application. Failure to heed these warnings could
`result in system crashes or loss of data. (An example appears on
`page 1-46.)
`
`Assembly-Language Information
`
`0
`
`0
`
` provides information about the registers for specific routines
`Inside Macintosh
`like this:
`
`Registers on entry
`A0
`Contents of register A0 on entry
`
`Registers on exit
`D0
`Contents of register D0 on exit
`
`In addition,
` presents information about the fields of a
`Inside Macintosh
`parameter block in this format:
`
`Parameter block
`
`inAndOut
`
`Integer
`
`output1
`
`input1
`
`Ptr
`
`Ptr
`
`Input/output parameter.
`Output parameter.
`Input parameter.
`
`The arrow in the far left column indicates whether the field is an input
`parameter, output parameter, or both. You must supply values for all input
`parameters and input/output parameters. The routine returns values in
`output parameters and input/output parameters.
`The second column shows the field name as defined in the MPW Pascal
`interface files; the third column indicates the Pascal data type of that field.
`The fourth column provides a brief description of the use of the field. For a
`complete description of each field, see the discussion that follows the
`parameter block or the description of the parameter block in the reference
`section of the chapter.
`
`xvii
`
`Petitioner Apple Inc. - Exhibit 1008, p. 5
`
`s

`‹
`fi
`

`

`
`
`
`
`
`
`
`
`
`P R E F A C E
`
`Development Environment
`
`0
`
`The system software routines described in this book are available using
`Pascal, C, or assembly-language interfaces. How you access these routines
`depends on the development environment you are using. This book shows
`system software routines in their Pascal interface using the Macintosh
`Programmer’s Workshop (MPW).
`All code listings in this book are shown in Pascal. They show methods of
`using various routines and illustrate techniques for accomplishing particular
`tasks. All code listings have been compiled and, in most cases, tested.
`However, Apple Computer does not intend that you use these code samples
`in your application.
` as the name of a sample application for
`This book occasionally uses
`SurfDraw
`illustrative purposes; this is not an actual product of Apple Computer, Inc.
`APDA, Apple’s source for developer tools, offers worldwide access to a broad
`range of programming products, resources, and information for anyone
`developing on Apple platforms. You’ll find the most current versions of
`Apple and third-party development tools, debuggers, compilers, languages,
`and technical references for all Apple platforms. To establish an APDA
`account, obtain additional ordering information, or find out about site
`licensing and developer training programs, contact
`APDA
`Apple Computer, Inc.
`20525 Mariani Avenue, M/S 33-G
`Cupertino, CA 95014-6299
`Telephone:
`800-282-2732 (United States)
`800-637-0029 (Canada)
`800-562-3910 (elsewhere in the world)
`408-562-3971
`171-576
`
`Fax:
`Telex:
`
`If you provide commercial products and services, call 408-974-4897 for
`information on the developer support programs available from Apple.
`For information on registering signatures, file types, Apple events, and other
`technical information, contact
`Macintosh Developer Technical Support
`Apple Computer, Inc.
`20525 Mariani Avenue, M/S 75-3T
`Cupertino, CA 95014-6299
`
`xviii
`
`Petitioner Apple Inc. - Exhibit 1008, p. 6
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Figures, Tables, and Listings
`
`Preface
`
`About This Book
`
`xv
`
`Chapter 1
`
`Introduction to File Management
`
`1-3
`
`Figure 1-1
`Figure 1-2
`Figure 1-3
`Figure 1-4
`Figure 1-5
`Figure 1-6
`Listing 1-1
`Listing 1-2
`
`Listing 1-3
`Listing 1-4
`Listing 1-5
`Listing 1-6
`Figure 1-7
`Listing 1-7
`Listing 1-8
`Listing 1-9
`Listing 1-10
`Listing 1-11
`Listing 1-12
`Figure 1-8
`Figure 1-9
`Figure 1-10
`Listing 1-13
`Figure 1-11
`Listing 1-14
`Listing 1-15
`Listing 1-16
`Listing 1-17
`Listing 1-18
`Listing 1-19
`
`1-5
`
`1-8
`1-10
`
`1-16
`1-17
`1-19
`
`1-26
`1-27
`
`The two forks of a Macintosh file
`1-7
`Logical blocks and allocation blocks
`Logical end-of-file and physical end-of-file
`The Macintosh hierarchical file system
`The disk switch dialog box
`1-11
`A typical File menu
`1-12
`1-13
`Handling the File menu commands
`Testing for the availability of routines that operate on
`
`FSSpec
`records
`1-14
`1-15
`A sample document record
`Handling the New menu command
`Creating a new document window
`Handling the Open menu command
`The default Open dialog box
`1-19
`Opening a file
`1-20
`1-22
`Reading data from a file
`1-24
`Writing data into a file
`1-25
`Updating a file safely
`Handling the Save menu command
`Handling the Save As menu command
`The default Save dialog box
`1-28
`The new folder dialog box
`1-29
`The name conflict dialog box
`1-29
`Copying a resource from one resource fork to another
`A Revert to Saved dialog box
`1-30
`Handling the Revert to Saved menu command
`Handling the Close menu command
`1-32
`Closing a file
`1-33
`Opening files at application launch time
`Opening a preferences file
`1-36
`Adjusting the File menu
`1-37
`
`1-30
`
`1-31
`
`1-35
`
`Chapter 2
`
`File Manager
`
`2-5
`
`Table 2-1
`Table 2-2
`Table 2-3
`Table 2-4
`Table 2-5
`
`2-7
`Routines for opening file forks
`2-9
`Routines for operating on open file forks
`2-9
`Routines for operating on closed files
`2-10
`Routines for operating on directories
`Routines for manipulating working directories
`
`2-11
`
`xi
`
`Petitioner Apple Inc. - Exhibit 1008, p. 7
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Table 2-6
`Table 2-7
`Table 2-8
`Figure 2-1
`Table 2-9
`Figure 2-2
`Figure 2-3
`Listing 2-1
`Table 2-10
`Listing 2-2
`Table 2-12
`
`Table 2-11
`
`Listing 2-3
`Listing 2-4
`Listing 2-5
`Listing 2-6
`Listing 2-7
`Listing 2-8
`Listing 2-9
`Listing 2-10
`Figure 2-4
`Figure 2-5
`Figure 2-6
`Figure 2-7
`Figure 2-8
`Figure 2-9
`Figure 2-10
`Listing 2-11
`
`2-13
`
`2-16
`
`2-19
`
`2-36
`
`2-12
`Routines for operating on volumes
`Routines for manipulating working directories
`Shared environment routines
`2-15
`Access and deny mode synchronization
`Access mode translation
`2-17
`Access privileges information in the
` field
`ioACAccess
`Identifying a file in HFS
`2-30
`Testing for
`PBCatSearch
`2-34
`How
` interprets its parameters
`FSMakeFSSpec
`Deleting a file’s resource fork
`2-38
`Fields in
` and
` used for a
`ioSearchInfo1
`ioSearchInfo2
`directory
`2-40
`Fields in
` and
` used for a
`ioSearchInfo1
`ioSearchInfo2
`file
`2-40
`Searching a volume with
`2-42
`PBCatSearch
`Searching a volume using a recursive, indexed search
`Constructing the full pathname of a file
`2-46
`Determining the amount of free space on a volume
`Determining whether a volume is sharable
`2-49
`Determining whether file sharing is enabled
`2-50
`Determining whether a file can have ranges locked
`Locking a file range to append data to the file
`2-52
`Organization of partitions on a disk
`2-56
`Organization of a volume
`2-57
`The structure of a B*-tree file
`2-64
`The structure of a node
`2-65
`Structure of a B*-tree node record
`A sample B*-tree
`2-68
`2-69
`Header node structure
`Reading a drive queue element’s flag bytes
`
`2-44
`
`2-48
`
`2-51
`
`2-67
`
`2-86
`
`Chapter 3
`
`Standard File Package
`
`3-3
`
`Figure 3-1
`Figure 3-2
`Figure 3-3
`Figure 3-4
`Figure 3-5
`Figure 3-6
`Figure 3-7
`Figure 3-8
`
`Figure 3-9
`Figure 3-10
`
`Figure 3-11
`Listing 3-1
`Listing 3-2
`Listing 3-3
`Listing 3-4
`Listing 3-5
`
`xii
`
`3-5
`The default Open dialog box
`3-6
`The default Save dialog box
`3-6
`The New Folder dialog box
`3-7
`The name conflict dialog box
`The Save dialog box customized with radio buttons
`The Save dialog box customized with a pop-up menu
`The Open dialog box customized with a pop-up menu
`The Open dialog box customized to allow selection of a
`directory
`3-10
`The Open dialog box when no directory is selected
`The Open dialog box with a long directory name
`abbreviated
`3-11
`3-12
`A volume selection dialog box
`3-14
`Handling the Open menu command
`3-15
`Specifying more than four file types
`Presenting a customized Open dialog box
`The definition of the default Open dialog box
`The definition of the default Save dialog box
`
`3-8
`3-9
`3-9
`
`3-11
`
`3-17
`3-18
`3-18
`
`Petitioner Apple Inc. - Exhibit 1008, p. 8
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`Listing 3-6
`Listing 3-7
`Listing 3-8
`Listing 3-9
`Listing 3-10
`Listing 3-11
`Listing 3-12
`Listing 3-13
`Listing 3-14
`Listing 3-15
`Listing 3-16
`Listing 3-17
`Listing 3-18
`
`Listing 3-19
`Listing 3-20
`Listing 3-21
`
`Listing 3-22
`
`3-18
`3-19
`
`The item list for the default Open dialog box
`The item list for the default Save dialog box
`A sample file filter function
`3-21
`A sample dialog hook function
`3-27
`3-30
`A sample modal-dialog filter function
`3-31
`Determining the current directory
`3-32
`Determining the current volume
`3-32
`Setting the current directory
`3-32
`Setting the current volume
`3-33
`Setting the current directory
`A file filter function that lists only directories
`Setting a button’s title
`3-35
`Handling user selections in the directory selection dialog
`box
`3-35
`3-37
`Presenting the directory selection dialog box
`3-38
`A file filter function that lists only volumes
`Handling user selections in the volume selection dialog
`box
`3-39
`Presenting the volume selection dialog box
`
`3-34
`
`3-40
`
`Chapter 4
`
`Alias Manager
`
`4-3
`
`Figure 4-1
`Listing 4-1
`Listing 4-2
`
`4-6
`Resolving a relative path
`4-9
`Creating an alias record
`Storing an alias record as a resource
`
`4-12
`
`Chapter 5
`
`Disk Initialization Manager
`
`5-3
`
`Figure 5-1
`Figure 5-2
`Figure 5-3
`Figure 5-4
`Figure 5-5
`Listing 5-1
`Listing 5-2
`Listing 5-3
`
`Listing 5-4
`
`Listing 5-5
`
`5-6
`
`5-5
`The disk initialization dialog box
`Alternate buttons for the disk initialization dialog box
`The disk initialization warning
`5-6
`The disk naming dialog box
`5-6
`The Finder’s disk erasing dialog box
`Responding to disk-inserted events
`Reinitializing a valid disk
`5-11
`Reinitializing a validly formatted disk without using the standard
`interface
`5-12
`Initializing an uninitialized disk without using the standard
`interface
`5-13
`Changing default volume characteristics
`
`5-7
`5-10
`
`5-15
`
`xiii
`
`Petitioner Apple Inc. - Exhibit 1008, p. 9
`
`

`

`Petitioner Apple Inc. - Exhibit 1008, p. 10
`
`Petitioner Apple Inc. - Exhibit 1008, p. 10
`
`

`

`1
`
`Introduction to File Management
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C H A P T E R 1
`
`Introduction to File Management
`
`1
`
`This chapter is a general introduction to file management on Macintosh computers. It
`explains the basic structure of Macintosh files and the hierarchical file system (HFS) used
`with Macintosh computers, and it shows how you can use the services provided by the
`Standard File Package, the File Manager, the Finder, and other system software
`components to create, open, update, and close files.
`You should read this chapter if your application implements the commands typically
`found in an application’s File menu—except for printing commands and the Quit
`command, which are described elsewhere. This chapter describes how to
`
`n
`
`n
`
`n
`
`n
`
`n
`
`n
`
`n
`
`create a new file
`open an existing file
`close a file
`save a document’s data in a file
`save a document’s data in a file under a new name
`revert to the last saved version of a file
`create and read a preferences file
`Depending on the requirements of your application, you may be able to accomplish all
`your file-related operations by following the instructions given in this chapter. If your
`application has more specialized file management needs, you’ll need to read some or all
`of the remaining chapters in this book.
`This chapter assumes that your application is running in an environment in which the
`routines that accept file system specification records (defined by the
` data type)
`FSSpec
`are available. File system specification records, introduced in system software version 7.0,
`simplify the identification of objects in the file system. Your development environment
`may provide “glue” that allows you to call those routines in earlier system software
`versions. If such glue is not available and you want your application to run in system
`software versions earlier than version 7.0, you need to read the discussion of HFS
`file-manipulation routines in the chapter “File Manager” in this book.
`This chapter begins with a description of files and their organization into directories and
`
`volumes. Then it describes how to test for the presence of the routines that accept
`FSSpec
`records and how to use those routines to perform the file management tasks listed above.
`The chapter ends with descriptions of the data structures and routines used to perform
`these tasks. The “File Management Reference” and “Summary of File Management”
`sections in this chapter are subsets of the corresponding sections of the remaining
`chapters in this book.
`
`1-3
`
`Petitioner Apple Inc. - Exhibit 1008, p. 11
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C H A P T E R 1
`
`Introduction to File Management
`
`About Files
`
`1
`
`To the user, a file is simply some data stored on a disk. To your application, a
` is a
`file
`named, ordered sequence of bytes stored on a Macintosh volume, divided into two forks
`(as described in the following section, “File Forks”). The information in a file can be used
`for any of a variety of purposes. For example, a file might contain the text of a letter or
`the numerical data in a spreadsheet; these types of files are usually known as documents.
`Typically a
` is a file that a user can create and edit. A document is usually
`document
`associated with a single application, which the user expects to be able to open by
`double-clicking the document’s icon in the Finder.
`A file might also contain an application. In that case, the information in the file consists
`of the executable code of the application itself and any application-specific resources and
`data. Applications typically allow the user to create and manipulate documents. Some
`applications also create special files in which they store user-specific settings; such files
`are known as
`preferences files.
`The Macintosh Operating System also uses files for other purposes. For example, the File
`Manager uses a special file located in a volume to maintain the hierarchical organization
`of files and folders in that volume. This special file is called the volume’s
`
`catalog file.
`Similarly, if virtual memory is in operation, the Operating System stores unused pages of
`memory in a disk file called the
`backing-store file.
`No matter what its function, each file shares certain characteristics with every other file.
`This section describes these general characteristics of Macintosh files, including
`
`n
`
`n
`
`n
`
`n
`
`file forks
`file size and access characteristics
`file system organization
`file naming and identification
`
`1
`
`File Forks
`Many operating systems treat a file simply as a named, ordered sequence of bytes
`(possibly terminated by a byte having a special value that indicates the end-of-file). As
`illustrated in Figure 1-1, however, each Macintosh file has two
` known as the data
`forks,
`fork and the resource fork.
`A file’s
` contains that file’s resources. If the file is an application, the
`resource fork
`resource fork typically contains resources that describe the application’s menus, dialog
`boxes, icons, and even the executable code of the application itself. A particularly
`important resource is the application’s
` resource, which contains information
`'SIZE'
`about the capabilities of the application and its run-time memory requirements. If the file
`is a document, its resource fork typically contains preference settings, window locations,
`and document-specific fonts, icons, and so forth.
`
`1-4
`
`About Files
`
`Petitioner Apple Inc. - Exhibit 1008, p. 12
`
`

`

`1
`
`Introduction to File Management
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C H A P T E R 1
`
`Introduction to File Management
`
`Figure 1-1
`
`The two forks of a Macintosh file
`
`Resource map(cid:13)
`
`Data(cid:13)
`
`Resources(cid:13)
`
`Data fork(cid:13)
`
`Resource fork(cid:13)
`
`A file’s
` contains the file’s data. It is simply a series of consecutive bytes of data.
`data fork
`In a sense, the data fork of a Macintosh file corresponds to an entire file in operating
`systems that treat a file simply as a sequence of bytes. The bytes stored in a file’s data
`fork do not have to exhibit any internal structure, unlike the bytes stored in the resource
`fork (which consists of a resource map followed by resources). Rather, your application
`is responsible for interpreting the bytes in the data fork in whatever manner is appropri-
`ate. The data fork of a document file might, for example, contain the text of a letter.
`Even though a Macintosh file always contains both a resource fork and a data fork, one
`or both of those forks can be empty. Document files sometimes contain only data (in
`which case the resource fork is empty). More often, document files contain both
`resources and data. Application files generally contain resources only (in which case, the
`data fork is empty). Application files can, however, contain data as well.
`Whether you store specific data in the data fork or in the resource fork of a file depends
`largely on whether that data can usefully be structured as a resource. For example, if you
`want to store a small number of names and telephone numbers, you can easily define a
`resource type that pairs each name with its telephone number. Then you can read names
`and corresponding numbers from the resource file by using Resource Manager routines.
`To retrieve the data stored in a resource, you simply specify the resource type and ID;
`you don’t need to know, for instance, how many bytes of data are stored in that resource.
`In some cases, however, it is not possible or advisable to store your data in resources.
`The data might be too difficult to put into the structure required by the Resource
`Manager. For example, it is easiest to store a document’s text, which is usually of
`variable length, in a file’s data fork. Then you can use File Manager routines to access
`any byte or group of bytes individually.
`
`About Files
`
`1-5
`
`Petitioner Apple Inc. - Exhibit 1008, p. 13
`
`

`

`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C H A P T E R 1
`
`Introduction to File Management
`
`Even when it is easy to define a resource type for your data, limitations on the Resource
`Manager might compel you to store your data in the data fork instead. A resource fork
`can contain at most about 2700 resources. More importantly, the Resource Manager
`searches linearly through a file’s resource types and resource IDs. If the number of types
`or IDs to be searched is large, accessing the resource data can become slow. As a rule of
`thumb, if you need to manage data that would occupy more than about 500 resources
`total, you should use the data fork instead.
`
`IMPORTANT
`In general, you should store data created by the user in a file’s data fork,
`unless the data is guaranteed to occupy a small number of resources.
`The Resource Manager was not designed to be a general-purpose data
`storage and retrieval system. Also, the Resource Manager does not
`support multiple access to a file’s resource fork. If you want to store data
`that can be accessed by multiple users of a shared volume, use the
`data fork.
`Because the Resource Manager is of limited use in storing large amounts of
`user-generated data, most of the techniques in “Using Files” (beginning on page 1-12)
`illustrate the use of File Manager routines to manage information stored in a file’s data
`fork. See the section “Using a Preferences File” on page 1-36 for an example of the use of
`the Resource Manager to access data stored in a file’s resource fork.
`
`File Size
`The size of a file is usually limited only by the size of its volume. A
` is a portion
`volume
`of a storage device that is formatted to contain files. A volume can be an entire disk or
`only a part of a disk. A 3.5-inch floppy disk, for instance, is always formatted as one
`volume. Other memory devices, such as hard disks and file servers, can contain multiple
`volumes.
`
`1
`
`Note
`Actually, a file on an HFS volume can be as large as 2 GB ($7FFFFFFF
`bytes). Most volumes are not large enough to hold a file of that size. An
`HFS volume currently can be as large as 2 GB.
`u
`The size of a volume varies from one type of device to another. Volumes are formatted
`into chunks known as
` each of which can contain up to 512 bytes. A
`logical blocks,
`double-sided 3.5-inch floppy disk, for instance, usually has 1600 logical blocks, or 800 KB.
`Generally, however, the size of a logical block on a volume is of interest only to the disk
`device driver. This is because the File Manager always allocates space to a file in units
`called allocation blocks. An
` is a group of consecutive logical blocks. The
`allocation block
`File Manager can access a maximum of 65,535 allocation blocks on any volume. For
`small volumes, such as volumes on floppy disks, the File Manager uses an allocation
`block size of one logical block. To support volumes larger than about 32 MB, the File
`
`1-6
`
`About Files
`
`Petitioner Apple Inc. - Exhibit 1008, p. 14
`
`s
`

`

`1
`
`Introduction to File Management
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`
`C H A P T E R 1
`
`Introduction to File Management
`
`Manager needs to use an allocation block size that is at least two logical blocks. To
`support volumes larger than about 64 MB, the File Manager needs to use an allocation
`block that is at least three allocation blocks. In this way, by progressively increasing
`the number of logical blocks in an allocation block, the File Manager can handle
`larger and larger volumes. Figure 1-2 illustrates how logical blocks are grouped into
`allocation blocks.
`
`Figure 1-2
`
`Logical blocks and allocation blocks
`
`Macintosh volume(cid:13)
`
`File A(cid:13)
`
`File B(cid:13)
`
`File C(cid:13)
`
`Allocation(cid:13)
`Blocks(cid:13)
`0(cid:13)
`
`1(cid:13)
`
`2(cid:13)
`
`Logical(cid:13)
`Blocks(cid:13)
`0(cid:13)
`1(cid:13)
`2(cid:13)
`3(cid:13)
`4(cid:13)
`5(cid:13)
`6(cid:13)
`7(cid:13)
`
`2n(cid:13)
`2n+1(cid:13)
`
`3(cid:13)(cid:13)(cid:13)
`
`n(cid:13)
`2(cid:13)
`
`The size of the allocation blocks on a volume is determined when the volume is
`initialized and depends on the number of logical blocks it contains. In general, the
`Disk Initialization Manager uses the smallest allocation block size that will allow the
`File Manager to address the entire volume. A nonempty file fork always occupies at least
`one allocation block, no matter how many bytes of data that file fork contains. On a
`40 MB volume, for example, a file’s data fork occupies at least 1024 bytes (that is, two
`logical blocks), even if it contains only 11 bytes of actual data.
`To distinguish between the amount of space allocated to a file and the number of bytes of
`actual data in the file, two numbers are used to describe the size of a file. The
`physical
` is the number of bytes currently allocated to the file; it’s 1 greater than the
`end-of-file
`number of the last byte in its last allocation block (since the first byte is byte number 0).
`As a result, the physical end-of-file is always an exact multiple of the allocation block
`size. The
` is the number of those allocated bytes that currently contain
`logical end-of-file
`data; it’s 1 greater than the number of the last byte in the file that contains data. For
`example, on a volume having an allocation block size of two logical blocks (that is,
`1024 bytes), a file with 509 bytes of data has a logical

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket