<<

clt4iLS*rBBbr*wmn*uh*·mu·-;u- .- ur aalLrr· 1----_.-I- -_ . - -, - -_ ~ I ~ ~, _- ,i~ ~~Y ,lr~a r,.~r ;.. rrr- _1.....,...... , = - ^ lw - - j- -...... *~__

Nc Designinga Us -Once |tI I Ageneral-purpose optical storage software technology

Simson Garfinkel

estorage systems are than being mass-produced. hree different opti- WORM cartridges can store two to ige technologies to four times more data than similarly- over the last dec- sized rewritable ones. Today, 5.25- rite-once systems inch drives are available that can store (called WORMs, for Write Once, more than 500 Mbytes per side, and 14- Multiple) are the oldest of the optical inch write-once systems can store two systems and in many ways the most to four gigabytes. As stated earlier, the successful to date. unique virtue of write-once technology Once a block is written into WORM, is the permanence it offers for valuable it can't be changed. This unique char- data. In many application areas, such acteristic of WORM is at once its virtue as financial and medical applications, and its handicap: WORM offers data this feature is extremely critical. permanence, but traditional computer systems can't use WORM without spe- WORM in Use cial software. Operating systems like There are three approaches to using MS-DOS and Unix, for example, need write-once technology in computer ap- to be able to update the blocks used plications. In the first, a specialized to store directories when files are cre- application uses the optical disk for ated or deleted. storing large datafiles (such as images). In 1985 I started a research project The application may track these files at the MIT Media Lab to develop a file using its own dedicated routines, or A*AACNaWe- o system designed for write-once devices. cal storage technology has advantages use a ataDaseL I+~ management system uor This article describes the design and anddisadvantages. this purpose. evolution of this software component, CD-ROM, with more than 500 Mbytes The second approach is to use a known as the Write-Once File System on a 4.77-inch disk that costs less than special device driver that lets the write- (WOFS). a dollar to manufacture, is an ideal once disk simulate a rewritable disk. system for publishing databases and When the operating system tries to re- Why WORM? distributing large software systems. But write a block, the driver writes a new Comparing WORM disks with read- CD-ROM can't be written, and thus isn't block and remembers the translation. only CD-ROMs and rewritable magneto- a replacement for conventional storage. This article focuses on the third ap- optical systems, we find that each opti- Rewritable magneto-optical disks are proach: A file system designed specifi- much slower than magnetic disks, and cally for use with write-once optical Simson is the principalscientist at N/ don't hold as much as CD-ROM, or disks. The goal of our WOFS project HIance Systems, which sells a variety even magnetic disks of the same size. was twofold: To invent a file system ofproducts based upon WOFS. He can Although rewritable cartridges are re- standard which defined the means of be reached at 52 1/2 Pleasant, Cam- movable, they cannot easily serve as a arranging information into files on the bridge, MA 02139, or Internetmail as publication format, because each disk optical disk; and to create a file system simsong@next. cambridge.ma. us. be individually recorded, rather implementation - a function librarywrit- must j 78 Dr. Dobb'sJournal,January 1991 WO FS

.. (continuedfrompage 78) When working %withwrite-oncc de- 16-bit values to 32-bit values. ,,ten in the C programming language vices, however, things are more com- Tlo get around these problems. x' OFS ^,hich would let us test the tdesign. plicated. Because the physicadl blocks stores all directories and other file ss- From the beginning, we had high on a write-once disk cannot be changed, tem information ith a small set ol hopes for our project. We designed the files and directories that are logically predefined structures which were spe- file system so that it would be applica- changed must be rewritten to new lo- cifically designed to be portable and t ble to both read-only and rewritable cations. The role of the w rite-once file readlable by many different kinds of optical disks, in addition to write-once. microcomputers. The only two data (Our system was designed one year types in the structures are 32-bit un- before the High Sierra CD-ROM stan- Making WOFS CPU- signed numlllxrs and null-termlinated clhar- dard.) We chose not to take advantage acter strings. Strings are always padded of special features that were present in independent was tricky to a multiple of 4 bytes. WOFS solves during t the drives made by certain manufactur- word-alignment problems by storing shipping ers, so that the software would work all data on 4-byte boundaries. WOFS *Not va with any drive. (See the accompanying because different also has a mechanism for detecting and text box entitled "The Problem with swapping byte order when necessary. Post Fields.") Most importantly, we de- microprocessorsstore signed the file system to be operating data in different ways Basic Structures system independent, so that files writ- WOFS records new data and updates Name _ ten to a disk with one operating system to the optical file system as a series of could be read back with another. sequential block-write operations, start- Naille o Over the past five years, WOFS has ing with the first block on the disk and undergone three major redesigns, most system is to keep track of the most continuing until the end. Address recently in November 1989. Today it is recent version of each and The WOFS approach divides the disk City a full-fledged file system that provides file on the disk and permit them to be into two discrete regions: One in which Val to r da muOst many of the function calls specified by found quickly. A good write-once file blocks have been recorded and one in BookSoc the POSIX standard, including (), system also minimizes the number of which they are blank. The transition (), read(), and write(). WOFS blocks' that have to be written for any point between the two regions is called has been ported to both MS-DOS and given operation. the "last written block." Unix; optical cartridges can be moved WOFS does not store information By not having a specific part of the between the two systems, and files from on the optical disk in MS-DOS, Unix, disk dedicated to directories or file point- one operating system can be shared Macintosh, or any other "standard" for- ers (such as Unix inodes), WOFS elimi- with the other, even if the two operat- mat. WOFS uses its own format, nates a problem that is common with ing systems are running on processors instead; an operating system specific other file systems: Part of the disk fills that use different byte orders. WOFS interface allows existing operating sys- up, making the disk unable to hold also allows the user to access previous tems to read and write files on the more information, while other parts of versions of files, as well as take the optical. the disk remain empty. entire disk "into the past." Making WOFS CPU-independent was When a disk is mounted, WOFS finds 329C tricky, however, because different kinds the last written block with a binary Col l Differences from Conventional Systems of microprocessors store data in differ- search: If the block examined contains Magnetic file systems update the data ent ways. The Intel 80286 microproces- valid data, WOFS searches higher on stored in files by rewriting the blocks sor, for example, stores 16-bit integer the disk for the last written block; if the that the data is stored in. Files are de- values on 2-byte boundaries; the Mo- block does not contain data, WOFS leted from directories by rewriting the torola 68020 processor stores 16-bit in- searches lower on the disk. directory with the file's name missing, tegers on 4-byte boundaries. Different Although a binary search across the and returning the blocks associated with microprocessors use different strategies disk requires much "seeking" (move-

the file to the pool of unused blocks. for signO extension. . when. . converting. . O from. ...ment .._ of .theX .ontical. .----. head)..._ , each_- - seek is

TheS- ;*<$ ProblemWith Post Fields >*.afroblemg 4.+ In the eariy days'of wit-6roni&some 'i 'Would be set to "567." ability of write-once disks. WORM manufacturers tried to add spial fTa-,. There are two primary difficulties disks frequently contain blocks with tures to their drives to orerco'ie'thei-; with post fields: speed and reliability., bad bytes in them. WORM drives get difficulty'ofusing write-once with tra-a "Te more often a block is modified around this problem by reading back ditional operating systems. One popu- . with a post field-based file system, every block after it is written and re- 31 lar system was called "post fields," the longer it takes to find that block. writing it in another location if re- small records at the end of each block is is a big problem with blocks that quired. The problem with a post field of data that could be recoided inde- 'are used to store directories, for if the based-scheme is that occasionally it pendently from the block'itself. Post -:'irectory is modified 100 times, then is the bytes in the post field itself that fields were used as pointers to newer .'1:xOt blocks and post fields have to be are bad, which inakes it impossible versions of blocks. If the operating read in order to find the most recent to make the post field point at the system had to rewrite block 500, the; .version rewritten data. new data might be written In block" ' "'A second problem with post fields -S.G. 567 and the post field of block 500' :arises because of the inherent unreli- 32

All boot 80 I)r I)obb sJournal,January 1991 It card i WOFS

(continuedfrom page 80) * Ordinal (the byte position in the logi- as lseek(). Likewise, filestr_readworks iimp precisely half the distance of the previ- cal file where this data fragtnent starts) like read(), and filestr_write is like L ous seek. If there are ' blocks on the * Length (the number of bytes in this write(). The function filestr insert has sulb disk, the total number of seeks is guar- data fragment) no equivalent in other file systems. This fra~ anteed to be LOG2(). In practice, * Starting block (the point on the disk function opens up the file and inserts are WOFS takes less than four seconds to where the data fragment is located) bytes at the current position within the lenl find the last written block on a 5.25- file, making the file longer. A converse tot inch optical disk drive. Because WOFS writes most files con- function,filestr delete, also has no stan- tiguously on the optical disk, most files are dard equivalent and deletes bytes at relc Transactions and Filemaps represented by a single fragment. For the current position, making the file OxO WOFS writes to the optical disk in example, a file consisting of 65,536 bytes smaller. inst groups of operations called transac- starting at block 1000 might have a file- vall tions. A transaction might be creating map that looked like that in Figure 1. byt, a file, changing its data, or erasing a file The filemap allows programs that WOFS is afile system the or directory; it also might consist of update records within a file (such as VA many operations grouped together. At database programs) to be used with specifically designedfor pre the end of each transaction, WOFS the optical disk. If a program were to Stol writes a special block called the End reopen file AAA, as in Figure 1, and write-once optical disks, ver of Transaction Block, or EOT. rewrite the first 1024 bytes of the file ant When a disk is mounted, WOFS lo- with new information, the new filemap cates the last written block on the drive might look like that shown in Figure 2 yet it can be used with ore and checks to see if it is an EOT. If it when the file is closed (assuming a use isn't, then the last transaction was inter- disk-block size of 512 bytes). rewritable systems rupted by a hardware failure (for ex- If this file is then opened for reading, rur ample, a loss of power or a pulled WOFS will return to the calling pro- tor cable); WOFS then searches backwards gram the 1024 bytes starting at block VAi on the disk, block-by-block, to find the 1140, followed by the 64,512 bytes that ue" last complete transaction. start at block 1024. Finally, filestr check provides a con- tha Every EOT contains a pointer to a Of course, the filemap for version 1 sistency check, by checking the vari- sot block (or blocks, if necessary) that stores of file AAA is still on the write-once ables used by the state machines for mix a list of current directories. The first disk; the user can still access the origi- self-consistency. Frequently, use of this eve directory in the list is the root directory. nal version of the file by reading the function made it relatively easy to find VA Additional fields in the EOT are used file with the first filemap instead of the and isolate programming errors during to maintain the disk volume name and second. A special function allows the the file system's development. t accounting information, such as the calling program to find out which ver- The Insert and Delete functions are ri t time of the last transaction. The EOT sion of the file it is reading. Another used primarily to maintain directories; 1 also has a pointer to the previous EOT, special function is provided which can by keeping the directory entries in sorted which is used for stepping the disk into step individual files - or an entire op- order, WOFS reduces the average time the past. tical cartridge - backwards in time. needed to create a file by a factor of two. WOFS uses the same basic structure At the heart of WOFS is a set of state The state machines are optimized to remember where both files and di- machines that manipulate filemaps and to transfer data directly between the rectories are stored. We call it a frag- transfer information to and from the optical disk interface and user memory ment table, but it can be thought of as optical disk. These state machines pro- when more than a complete block of a list of regions on the disk where data vide many standard file-system func- data is transferred. Thus, WOFS often is located and pointers that tell the file tions, as well as some that are only performs reads and writes of large files system how to assemble the data into possible because of the WOFS filemaps. at the maximum possible transfer rate 'C a continuous file. These fut ns include the following: of the hardware. When a file that has been written is closed (or when a modified directory * filestrseek Directory Entries entry is written to the disk), WOFS * filestrread All of the operations that file systems writes two additional blocks to the disk * filestr_write perform can be broken down into four for that file: a "filemap," and a "file * filestrinsert main categories: header." * filestrdelete . The filemap is the database that tells * filestrcheck * Looking up a name in a directory WOFS where on the disk the data in * Making an entry in a directory (for a the logical file is actually written. Each The filestr seek function repositions file or a subdirectory) record in the database has three fields: the file pointer in much the same way * Removing an entry in a directory * Transferring data between an open 'C' -; File AAA Version 2 filemap file (or directory) and the operating File AAA Version 1 filemap systems Ordinal Start Blockt Length Ordinal Start Block # Length To resolve a , WOFS starts 0 1140 1024 dabo at the root directory and searches for 0 1000 165536 1024 1002 64512 onginal the names of each successive subdirec- tory, one-by-one. Eventually, WOFS de- termines the location on the disk of the Figure 1: A samplefile in its initial Figure 2: Sample file in subsequent file's containing directory. These trans- state state lations are cached, which substantially

82 l)r. obb'sJournal,January 1991 -

rcorks improves the file system's performance. filestrinsert()function; likewise, they File System Blocks like, Like the data in files, each WOFS are deleted with thefilestrdelete( func- EOTs, File Headers, and Fragment Ta- -t ha, subdirectory is stored in one or more tion. A function called wofsfile_read- bles are all stored on the optical disk .This fragments. The actual directory entries dir() reads directory entries and trans- within a special kind of data structure iserts are built out of one or more variable- lates them into a form appropriate for called a File System Block (FSB). The n the length records. The contents of a direc- Unix, MS-DOS, or the Macintosh oper- FSB has a special 12-byte header that verse tory entry are shown in Figure 3. ating system. makes it possible to identify the block stan- The first four bytes of the directory When a file is opened for reading or in the event of a media failure, which es at record are the directory entry flag, writing, that file's fragment table is allows for quick and reliable recovery . file 0xOO001000. If WOFS reads 0x00100000 loaded into memory and a state ma- of the data on the WORM disk. instead of Ox00001000, all of the binary chine is set up to handle data transfer. The FSB header contains a 4-byte FSB values stored in the directory entry are When the file is closed, the fragment flag, a 4-byte "type" field which indi- byte-swapped. This might happen if table is written back to the optical disk, cates whether the FSB holds an EOT, the directory entry was written by a followed by a file header. a file header or a fragment table, and a VAX and read back by a SPARC micro- 4-byte self-referential pointer that con- processor--the VAX and the SPARC Individual Files tains the disk block address where the store the same binary value in the re- Every WOFS file has a file header. File FSB was actually written. In C, the FSB verse order. By detecting byte-swaps headers contain all of the information has the structure shown in Figure 5. and swapping the data back, WOFS in the directory entry - allowing the In the event of media failure, the allows cartridges written with one byte directory entry to be reconstructed in user can scan the entire optical car- ,th order to be read back on a system that the event of media damage - as well uses another. as additional information used by op- * directory entry flag (0xO0001000, used for WOFS only swaps on read. If WOFS erating systems other than MS-DOS. byte-swap detections .. - running on a SPARC updates a direc- File headers can be extended to in- size of directory entry .>ti. .r , 5, tory written by WOFS running on a clude security-related information such VAX, it does not swap the binary val- as access control lists used by newer, ., modification time ~tiyt ;' . I...:~i;. .. ues back before writing. Chances are security-conscious operating systems. aele version number ,. .- -.-, 14f ,7-, Normally, however, the file header is * xlCbationo- (for Maintosh OS): .-c?.i. : ~ , con- ,.,; A.-V , tat data written by one microproces- Ifile header location :' vari- sor will be read back by that same used only by WOFS and remains invis- - file length Inbytes .:. ; : .. .s for microprocessor; if the directory entry is ible to the user. * filename 3f this eventually read again by a VAX, the The file header fits within a single ) find VAX will swap the data when it reads it. WORM block. The information it con- Figure 3 Contents of a directory lurinP- Directory entries are created with the tains is shown in Fizure 4. entry

is are ories; sorted . time iftwo. mized .n the .mory )ck of often e files :r rate oIAq&IWW':7urUpW~ll IJV uarU0la mlyUie. IwU want vour interface tool to allow you to create what The tools for software developers who need a portable you have in mind. Without it getting in your way. Of "nuts and bolts" solution for window and keyboard course, you want: Speed. Power. Simplicity. Flexibility. control. Afull Unix System \'.3 style Curses. including stems Portability. We did too. That's wh? we created tools color support. Make your Csource and executable o four that help you be yourself. completely device independent. Supports EGA 43 and VGA50 line modes. CURSESA'MIS supports \T100, \1T220 and all terminals defined bv \VMSTEMITABE.

compatibility. Mouse Support. Resource and Style supports a tightly coupled multithreaded Management. On-Line Help Engine. DOS, UNIX. OS/2, / programming paradigm. Streamline our C'C + + \'MS compatibility. Want it all? FORtATION DESKTOI ASPEN SCIENTIFIC programs with multithreaded constructs, which allow gives it all to you in a small but extremely powerful a single process to execute several processing paths A'l. This isthe tool you need to create state of the art simultaneously. Portable? Yes! Your programs are starts Gl'l-like interfaces in fast, portable character mode. P.O. BOX 72 portable to many operating systems from small PCsto les for WHEAT RIDGE, COLORADO high-end mainframes. 80034-0072 Escape from grunt work. Call 303-423-8088 ,m:S (. 303-423-8088 of the to order. trnllls- Germany - Kickstein Software 0821-81 46 66 nti.lly'

r. l)obbs' /oolrnla/..j )uany 1991 83 WOF S tridge with a special recovery program implementations running on comput- to access write-once optical disks DOS that searches for FSBs that hold file ers with one byte order to use files through the operating system. Having DOS ft headers. The entire directory hierarchy written by implementations using an- the WORM disk behave like a regular Along can then be automatically recovered. other byte order. If the WOFS function magnetic drive lets developers develop applic; In practice, this procedure takes less that reads the EOT discovers that the and test and their programs with con- marke than 20 minutes for a 400-Mbyte car- byte order of the FSB flag is reversed, ventional hard disks, before they go to the Fil tridge. it reverses the byte order of every 4- the expense of purchasing an optical access Identifying a file-system block by both byte integer value stored in the EOT. subsystem. DOS self-referential pointer and 4-byte flag Like the byte-swapping for directory Presently, WOFS runs transparently fact t: minimizes the chance that a random entries, this swapping happens only under NIS-DOS and Unix. The NIS-DOS 2.0, MI block of data will appear to be an FSB. on read operations. When the EOT is implementation uses a terminate-and- tions, WOFS also uses the FSB to allow written to the disk at the conclusion of stay-resident (TSR) program that inter- to avc the next transaction, it is written in the cepts all uses of software interrupt 0x21. that it new byte order. The functions which Each software interrupt is examined to * File header version number pleme * File number read file headers and fragment tables see if it should be handled by WOFS it took * File type swap similarly when necessary. or by MS-DOS, and then the appropri- ing bx * File version number ate functions are called. This is the lems v * Location of previous version The Operating System Interface same technique used by a variety of One * Directory number of containing Although it is possible to link an appli- network systems available for MS-DOS. WOFS directory cation program directly with the WOFS One significant problem we encoun- WOFS * Filename (without directory name prefix) function library, most developers choose tered in writing the TSR was that many Kbyte: * Time of last write of dcau · Time of file.creation i;: : . ;. ', .' ,..;.. typedef struct ( : ' i '*'.,y(for Macintosh OS iJ;:¥- $1 ?. -" {,,u long- flag; , . . j .; tern e .' Location'on dik'of fragment table, ,,-.'.i - '...< -:.u,< long., location; . of MS Nmber. of fragirients infragment;C.; : a vert . table <, -,'.,, -4,t', ,., markE . Name andverslonof operating ,'-...3. EMM- ';systeni thatcreatedtfl . 4 the M' -Name of sitdthat tetfle' . , to [.¢ chfs ' data( BLOCK SIzE,, sizeo(fs.hdr). I; from! 4,Q; i z ET , ,i7 ,. Pec Figure 4: Contents of thefile header syster block Figure 5: FSB structure declarations we h: tems' tion ( moun T it won EXT MO1)1E)f + W//t9W4S The s IT WAS NEVER THIS E4SI work WOF' '-'il# l.r_ Ir._ The o M . Wz r M- i Mt.. ..4 2 availa users A ) a I 1 ) z i l - d tS opera (F't 11( 1 I C5phIW velop i ' [ 1 Ult Pr users L;1 [ C. I l .d whicl alterr transl com MEWELversion Wmdws vesion systel

The only SAA-compliant win- Our MS Windows compatible The Et dow library. Make your apps API makes porting between Thec look like a Windows/PM/Mac sever c~i~iEl text mode and Windows a was program! snap! file s, Dialog boxes, scrollbars, combo boxes, list boxes, push buttos, radio buttons, chk boxes, multi-line edit fields, static text, icons, multi4level hierarchical sic cc menus, full mouse support, accelerators, Windows-imilar resource fies, message-passing based, system menus, floating popups, EGA/VGA support Medi write If you don't believe it, call our free BBS for lot of demos and source code! used of Cr Microsoft and Tuibo C libaries $195. With full source code $495 tegra ucaOWr Please add $5 for shipping, 520 outside the US Spedfy DOS or OS/2 Protected Mode version ten- soFTWruaR sYsTEILs was t 15 Bodvcll Terrace, Millburn, NJ 0X)41 (201) 9120192 (voice) (201) 912-06 (BBS, 2400/1200 baud N-8-1) tigum bufk 1, 84 Dr. Dobb'sJournal,January 1991 Dr. I :isks DOS application programs use MS- lying DOS functions that are undocumented. CodeCheck gular-. Along the way, we learned that many Version 2.0 reioi application programs currently on the Professional con- market - such as WordPerfect - use Source Code go to the File Control Block (FCB) disk I/O Analyst tical access mechanism left over from MS- Includes "Drop-In" rules for compliance analysis, adherence to DOS Version 1.0. This is despite the specifications, measures of complexity, silent error detection, ently fact that ever since MS-DOS Version code maintainability, and portability. -DOS 2.0, Microsoft has declared these func- CodeCheckVersion 2.0 is a programmable tool for analyzing all C and C++ source code on -and- tions obsolete and asked developers a file or project basis. CodeCheck is input compatible with all variants of K&R, H&S, ANSI C and inter- C+ +.CodeCheck is designed to solve all of your Portability, Maintainability, Complexity, to avoid using them. The problem is Reusability, Quality Assurance, Style Analysis, Library/Class Management, Code Review, 0x21. that it is very difficult to properly im- Software Metric, Standards Adherence, and Corporate Compliance Problems. ed to plement all of the subtleties of the FCB; * Maintalnabillty-CODECHECK Identifies Complexity-Measures program size VOFS it took several months of trial and test- and measures complex, sloppy, and (Halstead) and Program Complexity 'opri- hard to maintain code. (McCabe). ing before we stopped finding prob- * Portability-CODECHECK Identifies * Complliance-CODECHECK allows your s the lems with our implementation. code that will not port between DOS, corporate coding and project speci- ty of OS/2, Unix, VMS, and the Macintosh, fication standards to be completely One problem that remains with and checkfor compatibility with ANSI automated for compliance validation. DOS. WOFS is memory consumption. The and other standards. ,oun- WOFS core requires approximately 50 CodeCheck includes pre-written expert system Rule Files for: ANSI C compatibility testing, many Kbytes of code and another 40 Kbytes Program Complexity (McCabe), Program Size (Halstead), General Maintainability, Plum Hall C Standards, Hungarian prefix Checking, Corporate Compliance Analysis, Comeau's Style -' of data space. These memory constraints Guidelines, and K&R/VAX/Macintosh Portability testing. are modest under every operating sys- DOS Professional Version $495. Macintosh $495. ·OS/2 $695. ·UNIX$995. tem environment with the exception 30 day Money back guaranteel FreeAIR Shippinganywhere Inthe worldl of MS-DOS. Unfortunately, MS-DOS is To Order Call 1-800-347-5214 a very large part of today's write-once market. We are currently working an ABRAXASTM EMM-version of WOFS which will lower Software,Inc. the MS-DOS low-memory requirements 7033 SW Macadam Ave., Portland, Oregon 97219 USA from 90 Kbytes to less than 50 Kbytes. TEL (503) 244-5253. FAX (503) 244-8375' ADpleLink D2205 People who have the Unix operating system can use WOFS with a server CIRCLE NO. 58 ON READER SERVICE CARD we have developed for Sun Microsys- tems' Network File System. A worksta- tion on a local area network simply mounts the WOFS disk the same way it would any other remote file system. The server program translates all net- work requests into the appropriate WOFS operations on the optical drive. The WOFS NFS server makes WOFS available to an extremely large base of users. A WOFS interface for the Macintosh operating system is currently under de- velopment. One of the biggest expected users is the graphics arts community, which will be able to use WOFS as an alternative to local area networks for transporting large image files between computers running different operating systems.

The Evolution of the Design The design of WOFS has undergone several iterations. The original system was developed in 1985 as a research file system for experimenting with ba- sic concepts. This was used at the MIT Media Lab for work with read-only and write-once compact disks. Although we 4 used that version to master a number of CD-ROMs, we never successfully in- tegrated it into a running operating sys- tem. The limitation of the first WOFS was that files could only be stored con- tiguously, and directories had to be huffered in memory in their entirety.

-.in.Lc Nl. vn ;JO1AU:r t1HVC1 L;AHU Dr Dobb'sJournal.Januay 1991 85 . -w -w...- @ -~~~M b es Oe-_

WOFS

The first major rewrite introduced that would work reliably and efficiently be permanently archived. Furthermore, the idea of fragmented files, which al- under a variety of different operating high performance and price of re- ""'owed files and directories to be up- criteria; every time we thought we had writable disks is now improving at a dated a piece at a time. The second solved the problem, we discovered a greater rate than write-once due to mar- rewrite eliminated dynamic allocation way to improve the structures that ket pressure. For this reason I am now of memory inside the WOFS core, which would make them either more efficient, in the process of designing an improved was necessary to allow the WOFS to more portable, or interpretable with version of WOFS, "WOFS 2," which interface with the kernels of real oper- less lines of code. will work interchangeably with write- ating systems, such as MS-DOS and We were not alone in encountering once and rewritable optical disks. Unix. The third rewrite replaced all 2- these difficulties. Indeed, one of the Why use a WOFS 2 with a rewritable byte integers stored in the file system reasons that write-once optical drives optical disk when you can just as well structures with 4-byte integers, to facili- have failed to catch on is the dismal use rewritable optical disks with native tate adopting WOFS to computer archi- state of most write-once software. Unix or MS-DOS file systems? There tectures such as the 68000, which can are two reasons: portability and speed. store integers only on arbitrary 4-byte The Rewritable Future WOFS 2 will retain WOFS's ability to boundaries. Perhaps the industry's current excite- move disks between operating systems WOFS's feature set has remained ba- ment about rewritable optical disks and CPU types. And because it will be sically unchanged for the past five years. comes from a belief that finally, here specifically optimized for the perfor- From the beginning, the system had to is a high-density mass storage system mance characteristics of optical disks, provide all of the basic Unix functions that can be used unmodified with ex- it will be faster and more reliable when for file and directory access with off-the- isting operating systems. used with optical disks than file sys- shelf write-once optical disks. Unfortunately, in jumping on the re- tems developed for the hard-disk tech- The biggest surprise in developing writable bandwagon, I believe that we nologies of the 1970s. WOFS was that it was much harder to will be losing the very characteristic Write-once compact disks, the me- achieve our original design goals than that attracted me to write-once in the dia that WOFS was designed to be used we ever anticipated. It took four years first place: data permanence. I have with, may be several years in the fu- of thinking about the byte-swapping always been comforted by the idea of ture. But WOFS exists today and is in problem before we realized that we being-able to undelete any file that I productive use. could support heterogeneous byte or- have previously deleted. You can do ders on the same disk--to the point that with WOFS. You can't do that with DDJ of switching byte orders on successive Unix or MS-DOS file systems running directory entries. Likewise, it was diffi- on rewritable optical disks. Vote for your favorite feature/article. ,cult to develop a set of file structures Nevertheless, not all data needs to Circle Reader Service No. 5. ] IaRomFtemQEgei 3aRm3pRm3eaiW Cc Har fror USERS OF LESS MATURE TOOLKITS. true DIRE CONSEQUENCES.. AWAIT ...... , . Several oolsao incle aC preprssor that non * Youve ottopayvour a K&RAN andherC daled Re dues. Belre you pend a Handlingany sizeprom the Toolbox is Our singe minue, we will have spent exte incmeib no yean wilh ourC PmmmerisToolbox fbqtad the Timintineri makingsure halyou bat exemely

will.... send [ ...... less I I , I eaylonsc. ofyour Rime . MaheinoshbPlV.andSun'sUNI. The Callnowfor uingwhayou Pmer'sToolbo l includes support for more deailed want don ANSI C.Mirosof C(new support for 6.0) informa/ion. : Conlainingmore Tulbo C,Sn l C,Madlosh MW C, andlogdeyoar han 20 ools for THINC (newsupport for 4. OPs), and more handson our' ,1 I serious C fredemo d pruummemili / IPnlmmr' TnnlnM,i qn;lUllMinshI.' k If· ,,,u~ ...... - III , ,"- MMC AD O Hne i afferenteopment envirnment DOSD . .. TM I (415)7700858; CIRCLE NO. 512 ON READER SERVICE CARD:, The C n Secast (1 0.Wai -u , rs,~~~~nh./. i.!i,,,e

hC F isecrhs~CldsklW tolal5~adthIWCAD~ax~u~uts~h~tIC AU~va~n~AU~r~wtiankp~a~iud~hik~dlwowuL. 86