1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
|
{$MACRO ON}
{$define Rsc := }
(******************************************************************************
*
* Copyright (c) 2000 Palm, Inc. or its subsidiaries.
* All rights reserved.
*
* File: VFSMgr.h
*
* Release: Palm OS SDK 4.0 (63220)
*
* Description:
* Header file for VFS Manager.
*
* History:
* 02/25/00 jed Created by Jesse Donaldson.
*
*****************************************************************************)
unit vfsmgr;
interface
uses palmos, coretraps, errorbase, datamgr, systemresources;
const
sysTrapVFSMgr = sysTrapFileSystemDispatch;
vfsFtrIDVersion = 0; // ID of feature containing version of VFSMgr.
// Check existence of this feature to see if VFSMgr is installed.
vfsFtrIDDefaultFS = 1; // ID of feature containing the creator ID of the default filesystem library
// this is the default choice when choosing a library for formatting/mounting
vfsMgrVersionNum = UInt16(200); // version of the VFSMgr, obtained from the feature
// MountClass constants:
vfsMountClass_SlotDriver = sysFileTSlotDriver;
vfsMountClass_Simulator = sysFileTSimulator;
vfsMountClass_POSE = Rsc('pose');
// Base MountParamType; others such as SlotMountParamType are extensions of this base type,
// switched on value of "mountClass" parameter. It will make more sense someday when there
// are other kinds of FileSystems... (Trust us. :-)
type
VFSAnyMountParamTag = record
volRefNum: UInt16; // The volRefNum of the volume.
reserved: UInt16;
mountClass: UInt32; // 'libs' for slotDriver-based filesystems
// Other fields here, depending on value of 'mountClass'
end;
VFSAnyMountParamType = VFSAnyMountParamTag;
VFSAnyMountParamPtr = ^VFSAnyMountParamType;
VFSSlotMountParamTag = record
vfsMountParam: VFSAnyMountParamType; // mountClass = VFSMountClass_SlotDriver = 'libs'
slotLibRefNum: UInt16;
slotRefNum: UInt16;
end;
VFSSlotMountParamType = VFSSlotMountParamTag;
VFSPOSEMountParamTag = record
vfsMountParam: VFSAnyMountParamType; // mountClass = VFSMountClass_POSE = 'pose'
poseSlotNum: UInt8;
end;
VFSPOSEMountParamType = VFSPOSEMountParamTag;
(* For Example...
VFSOtherMountParamTag = record
vfsMountParam: VFSAnyMountParamType; // mountClass = 'othr' (for example)
otherValue: UInt16;
end;
VFSOtherMountParamType = VFSOtherMountParamTag;
*)
FileInfoTag = record
attributes: UInt32;
nameP: PChar; // buffer to receive full name; pass NULL to avoid getting name
nameBufLen: UInt16; // size of nameP buffer, in bytes
end;
FileInfoType = FileInfoTag;
FileInfoPtr = ^FileInfoType;
VolumeInfoTag = record
attributes: UInt32; // read-only etc.
fsType: UInt32; // Filesystem type for this volume (defined below)
fsCreator: UInt32; // Creator code of filesystem driver for this volume. For use with VFSCustomControl().
mountClass: UInt32; // mount class that mounted this volume
// For slot based filesystems: (mountClass = vfsMountClass_SlotDriver)
slotLibRefNum: UInt16; // Library on which the volume is mounted
slotRefNum: UInt16; // ExpMgr slot number of card containing volume
mediaType: UInt32; // Type of card media (mediaMemoryStick, mediaCompactFlash, etc...)
reserved: UInt32; // reserved for future use (other mountclasses may need more space)
end;
VolumeInfoType = VolumeInfoTag;
VolumeInfoPtr = ^VolumeInfoType;
type
FileRef = UInt32;
const
vfsInvalidVolRef = 0; // constant for an invalid volume reference, guaranteed not to represent a valid one. Use it like you would use NULL for a FILE*.
vfsInvalidFileRef = 0; // constant for an invalid file reference, guaranteed not to represent a valid one. Use it like you would use NULL for a FILE*.
(************************************************************
* File Origin constants: (for the origins of relative offsets passed to 'seek' type routines).
*************************************************************)
const
vfsOriginBeginning = 0; // from the beginning (first data byte of file)
vfsOriginCurrent = 1; // from the current position
vfsOriginEnd = 2; // from the end of file (one position beyond last data byte, only negative offsets are legal)
type
FileOrigin = UInt16;
(************************************************************
* openMode flags passed to VFSFileOpen
*************************************************************)
const
vfsModeExclusive = $0001; // don't let anyone else open it
vfsModeRead = $0002; // open for read access
vfsModeWrite = $0004 or vfsModeExclusive; // open for write access, implies exclusive
vfsModeCreate = $0008; // create the file if it doesn't already exist. Implemented in VFS layer, no FS lib call will ever have to handle this.
vfsModeTruncate = $0010; // Truncate file to 0 bytes after opening, removing all existing data. Implemented in VFS layer, no FS lib call will ever have to handle this.
vfsModeReadWrite = vfsModeWrite or vfsModeRead; // open for read/write access
vfsModeLeaveOpen = $0020; // Leave the file open even if when the foreground task closes
// Combination flag constants, for error checking purposes:
vfsModeAll = vfsModeExclusive or vfsModeRead or vfsModeWrite or vfsModeCreate or vfsModeTruncate or vfsModeReadWrite or vfsModeLeaveOpen;
vfsModeVFSLayerOnly = vfsModeCreate or vfsModeTruncate; // flags only used apps & the VFS layer, FS libraries will never see these.
(************************************************************
* File Attributes
*************************************************************)
vfsFileAttrReadOnly = $00000001;
vfsFileAttrHidden = $00000002;
vfsFileAttrSystem = $00000004;
vfsFileAttrVolumeLabel = $00000008;
vfsFileAttrDirectory = $00000010;
vfsFileAttrArchive = $00000020;
vfsFileAttrLink = $00000040;
vfsFileAttrAll = $0000007f;
(************************************************************
* Volume Attributes
*************************************************************)
vfsVolumeAttrSlotBased = $00000001; // reserved
vfsVolumeAttrReadOnly = $00000002; // volume is read only
vfsVolumeAttrHidden = $00000004; // volume should not be user-visible.
(************************************************************
* Date constants (for use with VFSFileGet/SetDate)
*************************************************************)
vfsFileDateCreated = 1;
vfsFileDateModified = 2;
vfsFileDateAccessed = 3;
(************************************************************
* Iterator start and stop constants.
* Used by VFSVolumeEnumerate, VFSDirEntryEnumerate, VFSDirEntryEnumerate
*************************************************************)
vfsIteratorStart = 0;
vfsIteratorStop = $ffffffff;
(************************************************************
* 'handled' field bit constants
* (for use with Volume Mounted/Unmounted notifications)
*************************************************************)
vfsHandledUIAppSwitch = $01; // Any UI app switching has already been handled.
// The VFSMgr will not UIAppSwitch to the start.prc app
// (but it will loaded & sent the AutoStart launchcode),
// and the Launcher will not switch to itself.
vfsHandledStartPrc = $02; // And automatic running of start.prc has already been handled.
// VFSMgr will not load it, send it the AutoStart launchcode,
// or UIAppSwitch to it.
(************************************************************
* Format/Mount flags (for use with VFSVolumeFormat/Mount)
*************************************************************)
vfsMountFlagsUseThisFileSystem = $01; // Mount/Format the volume with the filesystem specified
// vfsMountFlagsPrivate1 = $02 // for system use only
// vfsMountFlagsPrivate2 = $04 // for system use only
vfsMountFlagsReserved1 = $08; // reserved
vfsMountFlagsReserved2 = $10; // reserved
vfsMountFlagsReserved3 = $20; // reserved
vfsMountFlagsReserved4 = $40; // reserved
vfsMountFlagsReserved5 = $80; // reserved
(************************************************************
* Common filesystem types. Used by FSFilesystemType and SlotCardIsFilesystemSupported.
*************************************************************)
vfsFilesystemType_VFAT = Rsc('vfat'); // FAT12 and FAT16 extended to handle long file names
vfsFilesystemType_FAT = Rsc('fats'); // FAT12 and FAT16 which only handles 8.3 file names
vfsFilesystemType_NTFS = Rsc('ntfs'); // Windows NT filesystem
vfsFilesystemType_HFSPlus = Rsc('hfse'); // The Macintosh extended hierarchical filesystem
vfsFilesystemType_HFS = Rsc('hfss'); // The Macintosh standard hierarchical filesystem
vfsFilesystemType_MFS = Rsc('mfso'); // The Macintosh original filesystem
vfsFilesystemType_EXT2 = Rsc('ext2'); // Linux filesystem
vfsFilesystemType_FFS = Rsc('ffsb'); // Unix Berkeley block based filesystem
vfsFilesystemType_NFS = Rsc('nfsu'); // Unix Networked filesystem
vfsFilesystemType_AFS = Rsc('afsu'); // Unix Andrew filesystem
vfsFilesystemType_Novell = Rsc('novl'); // Novell filesystem
vfsFilesystemType_HPFS = Rsc('hpfs'); // OS2 High Performance filesystem
(************************************************************
* Error codes
*************************************************************)
vfsErrBufferOverflow = vfsErrorClass or 1; // passed in buffer is too small
vfsErrFileGeneric = vfsErrorClass or 2; // Generic file error.
vfsErrFileBadRef = vfsErrorClass or 3; // the fileref is invalid (has been closed, or was not obtained from VFSFileOpen())
vfsErrFileStillOpen = vfsErrorClass or 4; // returned from FSFileDelete if the file is still open
vfsErrFilePermissionDenied = vfsErrorClass or 5; // The file is read only
vfsErrFileAlreadyExists = vfsErrorClass or 6; // a file of this name exists already in this location
vfsErrFileEOF = vfsErrorClass or 7; // file pointer is at end of file
vfsErrFileNotFound = vfsErrorClass or 8; // file was not found at the path specified
vfsErrVolumeBadRef = vfsErrorClass or 9; // the volume refnum is invalid.
vfsErrVolumeStillMounted = vfsErrorClass or 10; // returned from FSVolumeFormat if the volume is still mounted
vfsErrNoFileSystem = vfsErrorClass or 11; // no installed filesystem supports this operation
vfsErrBadData = vfsErrorClass or 12; // operation could not be completed because of invalid data (i.e., import DB from .PRC file)
vfsErrDirNotEmpty = vfsErrorClass or 13; // can't delete a non-empty directory
vfsErrBadName = vfsErrorClass or 14; // invalid filename, or path, or volume label or something...
vfsErrVolumeFull = vfsErrorClass or 15; // not enough space left on volume
vfsErrUnimplemented = vfsErrorClass or 16; // this call is not implemented
vfsErrNotADirectory = vfsErrorClass or 17; // This operation requires a directory
vfsErrIsADirectory = vfsErrorClass or 18; // This operation requires a regular file, not a directory
vfsErrDirectoryNotFound = vfsErrorClass or 19; // Returned from VFSFileCreate when the path leading up to the new file does not exist
vfsErrNameShortened = vfsErrorClass or 20; // A volume name or filename was automatically shortened to conform to filesystem spec
(************************************************************
* Selectors for routines found in the VFS manager. The order
* of these selectors MUST match the jump table in VFSMgr.c.
*************************************************************)
vfsTrapInit = 0;
vfsTrapCustomControl = 1;
vfsTrapFileCreate = 2;
vfsTrapFileOpen = 3;
vfsTrapFileClose = 4;
vfsTrapFileReadData = 5;
vfsTrapFileRead = 6;
vfsTrapFileWrite = 7;
vfsTrapFileDelete = 8;
vfsTrapFileRename = 9;
vfsTrapFileSeek = 10;
vfsTrapFileEOF = 11;
vfsTrapFileTell = 12;
vfsTrapFileResize = 13;
vfsTrapFileGetAttributes = 14;
vfsTrapFileSetAttributes = 15;
vfsTrapFileGetDate = 16;
vfsTrapFileSetDate = 17;
vfsTrapFileSize = 18;
vfsTrapDirCreate = 19;
vfsTrapDirEntryEnumerate = 20;
vfsTrapGetDefaultDirectory = 21;
vfsTrapRegisterDefaultDirectory = 22;
vfsTrapUnregisterDefaultDirectory = 23;
vfsTrapVolumeFormat = 24;
vfsTrapVolumeMount = 25;
vfsTrapVolumeUnmount = 26;
vfsTrapVolumeEnumerate = 27;
vfsTrapVolumeInfo = 28;
vfsTrapVolumeGetLabel = 29;
vfsTrapVolumeSetLabel = 30;
vfsTrapVolumeSize = 31;
vfsTrapInstallFSLib = 32;
vfsTrapRemoveFSLib = 33;
vfsTrapImportDatabaseFromFile = 34;
vfsTrapExportDatabaseToFile = 35;
vfsTrapFileDBGetResource = 36;
vfsTrapFileDBInfo = 37;
vfsTrapFileDBGetRecord = 38;
vfsTrapImportDatabaseFromFileCustom = 39;
vfsTrapExportDatabaseToFileCustom = 40;
// System use only
vfsTrapPrivate1 = 41;
vfsMaxSelector = vfsTrapPrivate1;
type
VFSImportProcPtr = function(totalBytes, offset: UInt32; userDataP: Pointer): Err;
VFSExportProcPtr = function(totalBytes, offset: UInt32; userDataP: Pointer): Err;
function VFSInit: Err;
// if you pass NULL for fsCreator, VFS will iterate through
// all installed filesystems until it finds one that does not return an error.
function VFSCustomControl(fsCreator, apiCreator: UInt32; apiSelector: UInt16;
valueP: Pointer; var valueLenP: UInt16): Err;
function VFSFileCreate(volRefNum: UInt16; const pathNameP: PChar): Err;
function VFSFileOpen(volRefNum: UInt16; const pathNameP: PChar; openMode: UInt16; var fileRefP: FileRef): Err;
function VFSFileClose(fileRef: FileRef): Err;
function VFSFileReadData(fileRef: FileRef; numBytes: UInt32; bufBaseP: Pointer;
offset: UInt32; var numBytesReadP: UInt32): Err;
function VFSFileRead(fileRef: FileRef; numBytes: UInt32; bufP: Pointer; var numBytesReadP: UInt32): Err;
function VFSFileWrite(fileRef: FileRef; numBytes: UInt32; const dataP: Pointer; var numBytesWrittenP: UInt32): Err;
// some file routines work on directories
function VFSFileDelete(volRefNum: UInt16; const pathNameP: PChar): Err;
function VFSFileRename(volRefNum: UInt16; const pathNameP, newNameP: PChar): Err;
function VFSFileSeek(fileRef: FileRef; origin: FileOrigin; offset: Int32): Err;
function VFSFileEOF(fileRef: FileRef): Err;
function VFSFileTell(fileRef: FileRef; var filePosP: UInt32): Err;
function VFSFileSize(fileRef: FileRef; var fileSizeP: UInt32): Err;
function VFSFileResize(fileRef: FileRef; newSize: UInt32): Err;
function VFSFileGetAttributes(fileRef: FileRef; var attributesP: UInt32): Err;
function VFSFileSetAttributes(fileRef: FileRef; attributes: UInt32): Err;
function VFSFileGetDate(fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err;
function VFSFileSetDate(fileRef: FileRef; whichDate: UInt16; date: UInt32): Err;
function VFSDirCreate(volRefNum: UInt16; const dirNameP: PChar): Err;
function VFSDirEntryEnumerate(dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err;
function VFSGetDefaultDirectory(volRefNum: UInt16; const fileTypeStr: PChar;
pathStr: PChar; var bufLenP: UInt16): Err;
function VFSRegisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32;
const pathStr: PChar): Err;
function VFSUnregisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32): Err;
function VFSVolumeFormat(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
function VFSVolumeMount(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
function VFSVolumeUnmount(volRefNum: UInt16): Err;
function VFSVolumeEnumerate(var volRefNumP: UInt16; var volIteratorP: UInt32): Err;
function VFSVolumeInfo(volRefNum: UInt16; var volInfoP: VolumeInfoType): Err;
function VFSVolumeGetLabel(volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err;
function VFSVolumeSetLabel(volRefNum: UInt16; const labelP: PChar): Err;
function VFSVolumeSize(volRefNum: UInt16; var volumeUsedP, volumeTotalP: UInt32): Err;
function VFSInstallFSLib(creator: UInt32; var fsLibRefNumP: UInt16): Err;
function VFSRemoveFSLib(fsLibRefNum: UInt16): Err;
function VFSImportDatabaseFromFile(volRefNum: UInt16; const pathNameP: PChar;
var cardNoP: UInt16; var dbIDP: LocalID): Err;
function VFSImportDatabaseFromFileCustom(volRefNum: UInt16; const pathNameP: PChar;
var cardNoP: UInt16; var dbIDP: LocalID;
importProcP: VFSImportProcPtr; userDataP: Pointer): Err;
function VFSExportDatabaseToFile(volRefNum: UInt16; const pathNameP: PChar;
cardNo: UInt16; dbID: LocalID): Err;
function VFSExportDatabaseToFileCustom(volRefNum: UInt16; const pathNameP: PChar;
cardNo: UInt16; dbID: LocalID;
exportProcP: VFSExportProcPtr; userDataP: Pointer): Err;
function VFSFileDBGetResource(ref: FileRef; type_: DmResType; resID: DmResID; var resHP: MemHandle): Err;
function VFSFileDBInfo(ref: FileRef; nameP: PChar; var attributesP, versionP: UInt16;
var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
var appInfoHP, sortInfoHP: MemHandle; var typeP, creatorP: UInt32;
var numRecordsP: UInt16): Err;
function VFSFileDBGetRecord(ref: FileRef; recIndex: UInt16; var recHP: MemHandle;
var recAttrP: UInt8; var uniqueIDP: UInt32): Err;
implementation
(**)
function __VFSInit: Err; syscall sysTrapVFSMgr;
function __VFSCustomControl(fsCreator, apiCreator: UInt32; apiSelector: UInt16;
valueP: Pointer; var valueLenP: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSFileCreate(volRefNum: UInt16; const pathNameP: PChar): Err; syscall sysTrapVFSMgr;
function __VFSFileOpen(volRefNum: UInt16; const pathNameP: PChar; openMode: UInt16; var fileRefP: FileRef): Err; syscall sysTrapVFSMgr;
function __VFSFileClose(fileRef: FileRef): Err; syscall sysTrapVFSMgr;
function __VFSFileReadData(fileRef: FileRef; numBytes: UInt32; bufBaseP: Pointer;
offset: UInt32; var numBytesReadP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileRead(fileRef: FileRef; numBytes: UInt32; bufP: Pointer; var numBytesReadP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileWrite(fileRef: FileRef; numBytes: UInt32; const dataP: Pointer; var numBytesWrittenP: UInt32): Err; syscall sysTrapVFSMgr;
// some file routines work on directories
function __VFSFileDelete(volRefNum: UInt16; const pathNameP: PChar): Err; syscall sysTrapVFSMgr;
function __VFSFileRename(volRefNum: UInt16; const pathNameP, newNameP: PChar): Err; syscall sysTrapVFSMgr;
function __VFSFileSeek(fileRef: FileRef; origin: FileOrigin; offset: Int32): Err; syscall sysTrapVFSMgr;
function __VFSFileEOF(fileRef: FileRef): Err; syscall sysTrapVFSMgr;
function __VFSFileTell(fileRef: FileRef; var filePosP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileSize(fileRef: FileRef; var fileSizeP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileResize(fileRef: FileRef; newSize: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileGetAttributes(fileRef: FileRef; var attributesP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileSetAttributes(fileRef: FileRef; attributes: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileGetDate(fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSFileSetDate(fileRef: FileRef; whichDate: UInt16; date: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSDirCreate(volRefNum: UInt16; const dirNameP: PChar): Err; syscall sysTrapVFSMgr;
function __VFSDirEntryEnumerate(dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err; syscall sysTrapVFSMgr;
function __VFSGetDefaultDirectory(volRefNum: UInt16; const fileTypeStr: PChar;
pathStr: PChar; var bufLenP: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSRegisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32;
const pathStr: PChar): Err; syscall sysTrapVFSMgr;
function __VFSUnregisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSVolumeFormat(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err; syscall sysTrapVFSMgr;
function __VFSVolumeMount(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err; syscall sysTrapVFSMgr;
function __VFSVolumeUnmount(volRefNum: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSVolumeEnumerate(var volRefNumP: UInt16; var volIteratorP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSVolumeInfo(volRefNum: UInt16; var volInfoP: VolumeInfoType): Err; syscall sysTrapVFSMgr;
function __VFSVolumeGetLabel(volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSVolumeSetLabel(volRefNum: UInt16; const labelP: PChar): Err; syscall sysTrapVFSMgr;
function __VFSVolumeSize(volRefNum: UInt16; var volumeUsedP, volumeTotalP: UInt32): Err; syscall sysTrapVFSMgr;
function __VFSInstallFSLib(creator: UInt32; var fsLibRefNumP: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSRemoveFSLib(fsLibRefNum: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSImportDatabaseFromFile(volRefNum: UInt16; const pathNameP: PChar;
var cardNoP: UInt16; var dbIDP: LocalID): Err; syscall sysTrapVFSMgr;
function __VFSImportDatabaseFromFileCustom(volRefNum: UInt16; const pathNameP: PChar;
var cardNoP: UInt16; var dbIDP: LocalID;
importProcP: VFSImportProcPtr; userDataP: Pointer): Err; syscall sysTrapVFSMgr;
function __VFSExportDatabaseToFile(volRefNum: UInt16; const pathNameP: PChar;
cardNo: UInt16; dbID: LocalID): Err; syscall sysTrapVFSMgr;
function __VFSExportDatabaseToFileCustom(volRefNum: UInt16; const pathNameP: PChar;
cardNo: UInt16; dbID: LocalID;
exportProcP: VFSExportProcPtr; userDataP: Pointer): Err; syscall sysTrapVFSMgr;
function __VFSFileDBGetResource(ref: FileRef; type_: DmResType; resID: DmResID; var resHP: MemHandle): Err; syscall sysTrapVFSMgr;
function __VFSFileDBInfo(ref: FileRef; nameP: PChar; var attributesP, versionP: UInt16;
var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
var appInfoHP, sortInfoHP: MemHandle; var typeP, creatorP: UInt32;
var numRecordsP: UInt16): Err; syscall sysTrapVFSMgr;
function __VFSFileDBGetRecord(ref: FileRef; recIndex: UInt16; var recHP: MemHandle;
var recAttrP: UInt8; var uniqueIDP: UInt32): Err; syscall sysTrapVFSMgr;
(**)
function VFSInit: Err;
begin
asm
move.l #$vfsTrapInit, D2;
end;
VFSInit := __VFSInit;
end;
function VFSCustomControl(fsCreator, apiCreator: UInt32; apiSelector: UInt16;
valueP: Pointer; var valueLenP: UInt16): Err;
begin
asm
move.l #$vfsTrapCustomControl, D2;
end;
VFSCustomControl := __VFSCustomControl(fsCreator, apiCreator, apiSelector, valueP, valueLenP);
end;
function VFSFileCreate(volRefNum: UInt16; const pathNameP: PChar): Err;
begin
asm
move.l #$vfsTrapFileCreate, D2;
end;
VFSFileCreate := __VFSFileCreate(volRefNum, pathNameP);
end;
function VFSFileOpen(volRefNum: UInt16; const pathNameP: PChar; openMode: UInt16; var fileRefP: FileRef): Err;
begin
asm
move.l #$vfsTrapFileOpen, D2;
end;
VFSFileOpen := __VFSFileOpen(volRefNum, pathNameP, openMode, fileRefP);
end;
function VFSFileClose(fileRef: FileRef): Err;
begin
asm
move.l #$vfsTrapFileClose, D2;
end;
VFSFileClose := __VFSFileClose(fileRef);
end;
function VFSFileReadData(fileRef: FileRef; numBytes: UInt32; bufBaseP: Pointer;
offset: UInt32; var numBytesReadP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileReadData, D2;
end;
VFSFileReadData := __VFSFileReadData(fileRef, numBytes, bufBaseP, offset, numBytesReadP);
end;
function VFSFileRead(fileRef: FileRef; numBytes: UInt32; bufP: Pointer; var numBytesReadP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileRead, D2;
end;
VFSFileRead := __VFSFileRead(fileRef, numBytes, bufP, numBytesReadP);
end;
function VFSFileWrite(fileRef: FileRef; numBytes: UInt32; const dataP: Pointer; var numBytesWrittenP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileWrite, D2;
end;
VFSFileWrite := __VFSFileWrite(fileRef, numBytes, dataP, numBytesWrittenP);
end;
function VFSFileDelete(volRefNum: UInt16; const pathNameP: PChar): Err;
begin
asm
move.l #$vfsTrapFileDelete, D2;
end;
VFSFileDelete := __VFSFileDelete(volRefNum, pathNameP);
end;
function VFSFileRename(volRefNum: UInt16; const pathNameP, newNameP: PChar): Err;
begin
asm
move.l #$vfsTrapFileRename, D2;
end;
VFSFileRename := __VFSFileRename(volRefNum, pathNameP, newNameP);
end;
function VFSFileSeek(fileRef: FileRef; origin: FileOrigin; offset: Int32): Err;
begin
asm
move.l #$vfsTrapFileSeek, D2;
end;
VFSFileSeek := __VFSFileSeek(fileRef, origin, offset);
end;
function VFSFileEOF(fileRef: FileRef): Err;
begin
asm
move.l #$vfsTrapFileEOF, D2;
end;
VFSFileEOF := __VFSFileEOF(fileRef);
end;
function VFSFileTell(fileRef: FileRef; var filePosP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileTell, D2;
end;
VFSFileTell := __VFSFileTell(fileRef, filePosP);
end;
function VFSFileSize(fileRef: FileRef; var fileSizeP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileSize, D2;
end;
VFSFileSize := __VFSFileSize(fileRef, fileSizeP);
end;
function VFSFileResize(fileRef: FileRef; newSize: UInt32): Err;
begin
asm
move.l #$vfsTrapFileResize, D2;
end;
VFSFileResize := __VFSFileResize(fileRef, newSize);
end;
function VFSFileGetAttributes(fileRef: FileRef; var attributesP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileGetAttributes, D2;
end;
VFSFileGetAttributes := __VFSFileGetAttributes(fileRef, attributesP);
end;
function VFSFileSetAttributes(fileRef: FileRef; attributes: UInt32): Err;
begin
asm
move.l #$vfsTrapFileSetAttributes, D2;
end;
VFSFileSetAttributes := __VFSFileSetAttributes(fileRef, attributes);
end;
function VFSFileGetDate(fileRef: FileRef; whichDate: UInt16; var dateP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileGetDate, D2;
end;
VFSFileGetDate := __VFSFileGetDate(fileRef, whichDate, dateP);
end;
function VFSFileSetDate(fileRef: FileRef; whichDate: UInt16; date: UInt32): Err;
begin
asm
move.l #$vfsTrapFileSetDate, D2;
end;
VFSFileSetDate := __VFSFileSetDate(fileRef, whichDate, date);
end;
function VFSDirCreate(volRefNum: UInt16; const dirNameP: PChar): Err;
begin
asm
move.l #$vfsTrapDirCreate, D2;
end;
VFSDirCreate := __VFSDirCreate(volRefNum, dirNameP);
end;
function VFSDirEntryEnumerate(dirRef: FileRef; var dirEntryIteratorP: UInt32; var infoP: FileInfoType): Err;
begin
asm
move.l #$vfsTrapDirEntryEnumerate, D2;
end;
VFSDirEntryEnumerate := __VFSDirEntryEnumerate(dirRef, dirEntryIteratorP, infoP);
end;
function VFSGetDefaultDirectory(volRefNum: UInt16; const fileTypeStr: PChar;
pathStr: PChar; var bufLenP: UInt16): Err;
begin
asm
move.l #$vfsTrapGetDefaultDirectory, D2;
end;
VFSGetDefaultDirectory := __VFSGetDefaultDirectory(volRefNum, fileTypeStr, pathStr, bufLenP);
end;
function VFSRegisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32;
const pathStr: PChar): Err;
begin
asm
move.l #$vfsTrapRegisterDefaultDirectory, D2;
end;
VFSRegisterDefaultDirectory := __VFSRegisterDefaultDirectory(fileTypeStr, mediaType, pathStr);
end;
function VFSUnregisterDefaultDirectory(const fileTypeStr: PChar; mediaType: UInt32): Err;
begin
asm
move.l #$vfsTrapUnregisterDefaultDirectory, D2;
end;
VFSUnregisterDefaultDirectory := __VFSUnregisterDefaultDirectory(fileTypeStr, mediaType);
end;
function VFSVolumeFormat(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
begin
asm
move.l #$vfsTrapVolumeFormat, D2;
end;
VFSVolumeFormat := __VFSVolumeFormat(flags, fsLibRefNum, vfsMountParamP);
end;
function VFSVolumeMount(flags: UInt8; fsLibRefNum: UInt16; vfsMountParamP: VFSAnyMountParamPtr): Err;
begin
asm
move.l #$vfsTrapVolumeMount, D2;
end;
VFSVolumeMount := __VFSVolumeMount(flags, fsLibRefNum, vfsMountParamP);
end;
function VFSVolumeUnmount(volRefNum: UInt16): Err;
begin
asm
move.l #$vfsTrapVolumeUnmount, D2;
end;
VFSVolumeUnmount := __VFSVolumeUnmount(volRefNum);
end;
function VFSVolumeEnumerate(var volRefNumP: UInt16; var volIteratorP: UInt32): Err;
begin
asm
move.l #$vfsTrapVolumeEnumerate, D2;
end;
VFSVolumeEnumerate := __VFSVolumeEnumerate(volRefNumP, volIteratorP);
end;
function VFSVolumeInfo(volRefNum: UInt16; var volInfoP: VolumeInfoType): Err;
begin
asm
move.l #$vfsTrapVolumeInfo, D2;
end;
VFSVolumeInfo := __VFSVolumeInfo(volRefNum, volInfoP);
end;
function VFSVolumeGetLabel(volRefNum: UInt16; labelP: PChar; bufLen: UInt16): Err;
begin
asm
move.l #$vfsTrapVolumeGetLabel, D2;
end;
VFSVolumeGetLabel := __VFSVolumeGetLabel(volRefNum, labelP, bufLen);
end;
function VFSVolumeSetLabel(volRefNum: UInt16; const labelP: PChar): Err;
begin
asm
move.l #$vfsTrapVolumeSetLabel, D2;
end;
VFSVolumeSetLabel := __VFSVolumeSetLabel(volRefNum, labelP);
end;
function VFSVolumeSize(volRefNum: UInt16; var volumeUsedP, volumeTotalP: UInt32): Err;
begin
asm
move.l #$vfsTrapVolumeSize, D2;
end;
VFSVolumeSize := __VFSVolumeSize(volRefNum, volumeUsedP, volumeTotalP);
end;
function VFSInstallFSLib(creator: UInt32; var fsLibRefNumP: UInt16): Err;
begin
asm
move.l #$vfsTrapInstallFSLib, D2;
end;
VFSInstallFSLib := __VFSInstallFSLib(creator, fsLibRefNumP);
end;
function VFSRemoveFSLib(fsLibRefNum: UInt16): Err;
begin
asm
move.l #$vfsTrapRemoveFSLib, D2;
end;
VFSRemoveFSLib := __VFSRemoveFSLib(fsLibRefNum);
end;
function VFSImportDatabaseFromFile(volRefNum: UInt16; const pathNameP: PChar;
var cardNoP: UInt16; var dbIDP: LocalID): Err;
begin
asm
move.l #$vfsTrapImportDatabaseFromFile, D2;
end;
VFSImportDatabaseFromFile := __VFSImportDatabaseFromFile(volRefNum, pathNameP, cardNoP, dbIDP);
end;
function VFSImportDatabaseFromFileCustom(volRefNum: UInt16; const pathNameP: PChar;
var cardNoP: UInt16; var dbIDP: LocalID;
importProcP: VFSImportProcPtr; userDataP: Pointer): Err;
begin
asm
move.l #$vfsTrapImportDatabaseFromFileCustom, D2;
end;
VFSImportDatabaseFromFileCustom := __VFSImportDatabaseFromFileCustom(volRefNum, pathNameP,
cardNoP, dbIDP, importProcP, userDataP);
end;
function VFSExportDatabaseToFile(volRefNum: UInt16; const pathNameP: PChar;
cardNo: UInt16; dbID: LocalID): Err;
begin
asm
move.l #$vfsTrapExportDatabaseToFile, D2;
end;
VFSExportDatabaseToFile := __VFSExportDatabaseToFile(volRefNum, pathNameP, cardNo, dbID);
end;
function VFSExportDatabaseToFileCustom(volRefNum: UInt16; const pathNameP: PChar;
cardNo: UInt16; dbID: LocalID;
exportProcP: VFSExportProcPtr; userDataP: Pointer): Err;
begin
asm
move.l #$vfsTrapExportDatabaseToFileCustom, D2;
end;
VFSExportDatabaseToFileCustom := __VFSExportDatabaseToFileCustom(volRefNum, pathNameP,
cardNo, dbID, exportProcP, userDataP);
end;
function VFSFileDBGetResource(ref: FileRef; type_: DmResType; resID: DmResID; var resHP: MemHandle): Err;
begin
asm
move.l #$vfsTrapFileDBGetResource, D2;
end;
VFSFileDBGetResource := __VFSFileDBGetResource(ref, type_, resID, resHP);
end;
function VFSFileDBInfo(ref: FileRef; nameP: PChar; var attributesP, versionP: UInt16;
var crDateP, modDateP, bckUpDateP, modNumP: UInt32;
var appInfoHP, sortInfoHP: MemHandle; var typeP, creatorP: UInt32;
var numRecordsP: UInt16): Err;
begin
asm
move.l #$vfsTrapFileDBInfo, D2;
end;
VFSFileDBInfo := __VFSFileDBInfo(ref, nameP, attributesP, versionP, crDateP, modDateP,
bckUpDateP, modNumP, appInfoHP, sortInfoHP, typeP, creatorP, numRecordsP);
end;
function VFSFileDBGetRecord(ref: FileRef; recIndex: UInt16; var recHP: MemHandle;
var recAttrP: UInt8; var uniqueIDP: UInt32): Err;
begin
asm
move.l #$vfsTrapFileDBGetRecord, D2;
end;
VFSFileDBGetRecord := __VFSFileDBGetRecord(ref, recIndex, recHP, recAttrP, uniqueIDP);
end;
end.
|