2 * fat-handler - FAT12/16/32 filesystem handler
4 * Copyright © 2006 Marek Szyprowski
5 * Copyright © 2007-2015 The AROS Development Team
7 * This program is free software; you can redistribute it and/or modify it
8 * under the same terms as AROS itself.
13 #ifndef FAT_HANDLER_PROTO_H
14 #define FAT_HANDLER_PROTO_H
17 void ProcessDiskChange (struct Globals
*glob
);
18 void UpdateDisk(struct Globals
*glob
);
19 void Probe64BitSupport(struct Globals
*glob
);
22 void ProcessPackets(struct Globals
*glob
);
23 void ReplyPacket(struct DosPacket
*pkt
, struct ExecBase
*sysbase
);
26 void InitDir(struct FSSuper
*sb
, ULONG cluster
, struct DirEntry
*de
);
27 LONG
InitDirHandle(struct FSSuper
*sb
, ULONG cluster
, struct DirHandle
*dh
,
28 BOOL reuse
, struct Globals
*glob
);
29 LONG
ReleaseDirHandle(struct DirHandle
*dh
, struct Globals
*glob
);
30 LONG
GetDirEntry(struct DirHandle
*dh
, ULONG index
, struct DirEntry
*de
,
31 struct Globals
*glob
);
32 LONG
GetNextDirEntry(struct DirHandle
*dh
, struct DirEntry
*de
,
33 struct Globals
*glob
);
34 LONG
GetDirEntryByCluster(struct DirHandle
*dh
, ULONG cluster
,
35 struct DirEntry
*de
, struct Globals
*glob
);
36 LONG
GetDirEntryByName(struct DirHandle
*dh
, STRPTR name
, ULONG namelen
,
37 struct DirEntry
*de
, struct Globals
*glob
);
38 LONG
GetDirEntryByPath(struct DirHandle
*dh
, STRPTR path
, ULONG pathlen
,
39 struct DirEntry
*de
, struct Globals
*glob
);
40 LONG
GetParentDir(struct DirHandle
*dh
, struct DirEntry
*de
,
41 struct Globals
*glob
);
42 LONG
UpdateDirEntry(struct DirEntry
*de
, struct Globals
*glob
);
43 LONG
AllocDirEntry(struct DirHandle
*dh
, ULONG gap
, struct DirEntry
*de
,
44 struct Globals
*glob
);
45 LONG
CreateDirEntry(struct DirHandle
*dh
, STRPTR name
, ULONG namelen
,
46 UBYTE attr
, ULONG cluster
, struct DirEntry
*de
, struct Globals
*glob
);
47 void FillDirEntry(struct DirEntry
*de
, UBYTE attr
, ULONG cluster
,
48 struct Globals
*glob
);
49 LONG
DeleteDirEntry(struct DirEntry
*de
, struct Globals
*glob
);
50 LONG
FillFIB(struct ExtFileLock
*fl
, struct FileInfoBlock
*fib
,
51 struct Globals
*glob
);
54 LONG
GetDirEntryShortName(struct DirEntry
*de
, STRPTR name
, ULONG
*len
,
55 struct Globals
*glob
);
56 LONG
GetDirEntryLongName(struct DirEntry
*de
, STRPTR name
, ULONG
*len
);
57 LONG
SetDirEntryName(struct DirEntry
*de
, STRPTR name
, ULONG len
);
58 ULONG
NumLongNameEntries(STRPTR name
, ULONG len
);
61 ULONG
GetFat12Entry(struct FSSuper
*sb
, ULONG n
);
62 ULONG
GetFat16Entry(struct FSSuper
*sb
, ULONG n
);
63 ULONG
GetFat32Entry(struct FSSuper
*sb
, ULONG n
);
64 BOOL
SetFat12Entry(struct FSSuper
*sb
, ULONG n
, ULONG val
);
65 BOOL
SetFat16Entry(struct FSSuper
*sb
, ULONG n
, ULONG val
);
66 BOOL
SetFat32Entry(struct FSSuper
*sb
, ULONG n
, ULONG val
);
67 LONG
FindFreeCluster(struct FSSuper
*sb
, ULONG
*rcluster
);
68 void CountFreeClusters(struct FSSuper
*sb
);
69 void AllocCluster(struct FSSuper
*sb
, ULONG cluster
);
70 void FreeCluster(struct FSSuper
*sb
, ULONG cluster
);
73 LONG
ReadFATSuper(struct FSSuper
*s
);
74 LONG
FormatFATVolume(const UBYTE
*name
, UWORD len
, struct Globals
*glob
);
75 LONG
CompareFATSuper(struct FSSuper
*s1
, struct FSSuper
*s2
);
76 LONG
SetVolumeName(struct FSSuper
*sb
, UBYTE
*name
, UWORD len
);
77 void FillDiskInfo(struct InfoData
*id
, struct Globals
*glob
);
78 void DoDiskInsert(struct Globals
*glob
);
79 BOOL
AttemptDestroyVolume(struct FSSuper
*sb
);
80 void DoDiskRemove(struct Globals
*glob
);
83 void ConvertFATDate(UWORD date
, UWORD time
, struct DateStamp
*ds
,
84 struct Globals
*glob
);
85 void ConvertDOSDate(struct DateStamp
*ds
, UWORD
*date
, UWORD
*time
,
86 struct Globals
*glob
);
89 LONG
ReadFileChunk(struct IOHandle
*ioh
, ULONG file_pos
, ULONG nwant
,
90 UBYTE
*data
, ULONG
*nread
);
91 LONG
WriteFileChunk(struct IOHandle
*ioh
, ULONG file_pos
, ULONG nwant
,
92 UBYTE
*data
, ULONG
*nwritten
);
95 LONG
OpLockFile(struct ExtFileLock
*dirlock
, UBYTE
*name
, ULONG namelen
,
96 LONG access
, struct ExtFileLock
**filelock
, struct Globals
*glob
);
97 void OpUnlockFile(struct ExtFileLock
*lock
, struct Globals
*glob
);
98 LONG
OpCopyLock(struct ExtFileLock
*lock
, struct ExtFileLock
**copy
,
99 struct Globals
*glob
);
100 LONG
OpLockParent(struct ExtFileLock
*lock
, struct ExtFileLock
**parent
,
101 struct Globals
*glob
);
102 LONG
OpOpenFile(struct ExtFileLock
*dirlock
, UBYTE
*name
, ULONG namelen
,
103 LONG action
, struct ExtFileLock
**filelock
, struct Globals
*glob
);
104 LONG
OpDeleteFile(struct ExtFileLock
*dirlock
, UBYTE
*name
, ULONG namelen
,
105 struct Globals
*glob
);
106 LONG
OpRenameFile(struct ExtFileLock
*sdirlock
, UBYTE
*sname
, ULONG snamelen
,
107 struct ExtFileLock
*ddirlock
, UBYTE
*dname
, ULONG dnamelen
,
108 struct Globals
*glob
);
109 LONG
OpCreateDir(struct ExtFileLock
*dirlock
, UBYTE
*name
, ULONG namelen
,
110 struct ExtFileLock
**newdirlock
, struct Globals
*glob
);
111 LONG
OpRead(struct ExtFileLock
*lock
, UBYTE
*data
, ULONG want
, ULONG
*read
,
112 struct Globals
*glob
);
113 LONG
OpWrite(struct ExtFileLock
*lock
, UBYTE
*data
, ULONG want
,
114 ULONG
*written
, struct Globals
*glob
);
115 LONG
OpSetFileSize(struct ExtFileLock
*lock
, LONG offset
, LONG mode
,
116 LONG
*newsize
, struct Globals
*glob
);
117 LONG
OpSetProtect(struct ExtFileLock
*lock
, UBYTE
*name
, ULONG namelen
,
118 ULONG prot
, struct Globals
*glob
);
119 LONG
OpSetDate(struct ExtFileLock
*dirlock
, UBYTE
*name
, ULONG namelen
,
120 struct DateStamp
*ds
, struct Globals
*glob
);
121 LONG
OpAddNotify(struct NotifyRequest
*nr
, struct Globals
*glob
);
122 LONG
OpRemoveNotify(struct NotifyRequest
*nr
, struct Globals
*glob
);
125 LONG
TestLock(struct ExtFileLock
*fl
, struct Globals
*glob
);
126 LONG
LockFileByName(struct ExtFileLock
*fl
, UBYTE
*name
, LONG namelen
,
127 LONG access
, struct ExtFileLock
**lock
, struct Globals
*glob
);
128 LONG
LockFile(ULONG cluster
, ULONG entry
, LONG access
,
129 struct ExtFileLock
**lock
, struct Globals
*glob
);
130 LONG
LockRoot(LONG access
, struct ExtFileLock
**lock
, struct Globals
*glob
);
131 LONG
CopyLock(struct ExtFileLock
*fl
, struct ExtFileLock
**lock
,
132 struct Globals
*glob
);
133 void FreeLock(struct ExtFileLock
*fl
, struct Globals
*glob
);
136 void SendNotify(struct NotifyRequest
*nr
, struct Globals
*glob
);
137 void SendNotifyByLock(struct FSSuper
*sb
, struct GlobalLock
*gl
);
138 void SendNotifyByDirEntry(struct FSSuper
*sb
, struct DirEntry
*de
);
139 void ProcessNotify(struct Globals
*glob
);
142 LONG
InitTimer(struct Globals
*glob
);
143 void CleanupTimer(struct Globals
*glob
);
144 void RestartTimer(struct Globals
*glob
);
145 void HandleTimer(struct Globals
*glob
);