alsa.audio: move handling of XRUN when writting to the slave task
[AROS.git] / rom / filesys / SFS / FS / globals.h
bloba06b06c70e45f6f52087f8bfd213643c76b879fd
1 #ifndef GLOBALS_H_
2 #define GLOBALS_H_
4 #include <exec/execbase.h>
5 #include "deviceio.h"
6 #include "bitmap.h"
7 #include "transactions.h"
8 #include "nodes.h"
9 #include "fs.h"
11 struct SFSBase
13 #ifndef __AROS__
14 struct ExecBase *sysBase;
15 #endif
16 struct DosLibrary *dosBase;
17 struct IntuitionBase *intuitionBase;
18 struct UtilityBase *utilityBase;
19 struct Device *timerBase;
21 struct DosPacket *packet;
22 struct DeviceNode *devnode;
23 struct DeviceList *volumenode;
24 struct MsgPort *sdlhport; // The SFS DosList handler port.
26 struct DosEnvec *dosenvec;
27 struct timerequest *inactivitytimer_ioreq;
28 struct timerequest *activitytimer_ioreq; /* How long activity can delay flushing data. */
29 struct FileSysStartupMsg *startupmsg;
30 struct MsgPort *msgporttimer;
31 struct MsgPort *msgportflushtimer;
32 struct MsgPort *msgportnotify;
33 struct Process *mytask;
35 ULONG diskstate; /* ID_WRITE_PROTECTED, ID_VALIDATING, ID_VALIDATED */
36 ULONG blockpercycle;
37 ULONG numsofterrors;
38 ULONG inhibitnestcounter;
40 ULONG block_defragptr;
41 ULONG *defragmentsteps;
42 ULONG defragmentlongs;
44 ULONG blocks_reserved_start; /* number of blocks reserved at start (=reserved) */
45 ULONG blocks_reserved_end; /* number of blocks reserved at end (=prealloc) */
47 ULONG blocks_bitmap; /* number of BTMP blocks for this partition */
48 ULONG blocks_inbitmap; /* number of blocks a single bitmap block can contain info on */
49 ULONG blocks_admin; /* the size of all AdminSpaces */
51 ULONG block_root; /* the block offset of the root block */
52 ULONG block_bitmapbase; /* the block offset of the first bitmap block */
53 ULONG block_extentbnoderoot; /* the block offset of the root of the extent bnode tree */
54 ULONG block_adminspace; /* the block offset of the first adminspacecontainer block */
55 ULONG block_objectnoderoot; /* the block offset of the root of the objectnode tree */
57 ULONG block_rovingblockptr; /* the roving block pointer! */
59 ULONG node_containers; /* number of containers per ExtentIndexContainer */
61 ULONG mask_block32; /* masks the least significant bits of a BLCKf pointer */
62 ULONG mask_debug;
64 ULONG disktype; /* the type of media inserted (same as id_DiskType in InfoData
65 structure) */
67 ULONG max_name_length;
68 ULONG activity_timeout;
69 ULONG inactivity_timeout;
71 UWORD shifts_block32; /* shift count needed to convert a blockoffset<->32byteoffset (only used by nodes.c!) */
73 UBYTE is_casesensitive; /* See ROOTBITS_CASESENSITIVE in blockstructure.h */
74 UBYTE has_recycled; /* See ROOTBITS_RECYCLED in blockstructure.h */
76 struct ExtFileLock *locklist; /* pointer to the first lock in the list, or zero if none */
78 LONG totalbuffers; /* Number of buffers currently in use by filesystem! */
79 struct MinList globalhandles;
80 struct NotifyRequest *notifyrequests;
82 BYTE activitytimeractive;
83 BYTE pendingchanges; /* indicates that the commit timer is active and that there are pending changes. */
84 BYTE timerreset;
86 BOOL is_LittleEndian; /* Little endian filesystem? */
88 struct Space spacelist[SPACELIST_MAX+1];
89 UBYTE string[260]; /* For storing BCPL string (usually path) */
90 UBYTE string2[260]; /* For storing BCPL string (usually comment) */
91 UBYTE pathstring[520]; /* Used by fullpath to build a full path */
93 struct fsStatistics statistics;
95 #ifdef CHECKCODE_SLOW
96 extern struct MinList cblrulist;
97 #endif
99 struct fsIORequest *iolist;
100 struct IOStdReq *ioreq; /* Used for Read/Write */
101 struct IOStdReq *ioreq2; /* Used for WriteProtection & DisksChange */
102 struct IOStdReq *ioreqchangeint; /* Used for DiskChange interrupt */
103 struct MsgPort *msgport;
104 BYTE deviceopened;
105 BYTE newstyledevice;
106 BYTE does64bit;
107 BYTE scsidirect;
109 LONG retries;
111 struct fsIORequest fsioreq;
113 ULONG sectors_total; /* size of the partition in sectors */
114 UWORD sectors_block; /* number of sectors in a block */
116 UWORD shifts_block; /* shift count needed to convert a blockoffset<->byteoffset */
118 UWORD cmdread;
119 UWORD cmdwrite;
121 ULONG sector_low; /* sector offset of our partition, needed for SCSI direct */
122 ULONG sector_high; /* last sector plus one of our partition */
124 ULONG blocks_total; /* size of the partition in blocks */
125 ULONG blocks_maxtransfer; /* max. blocks which may be transfered to the device at once (limits io_Length) */
127 UQUAD byte_low; /* the byte offset of our partition on the disk */
128 UQUAD byte_high; /* the byte offset of the end of our partition (excluding) on the disk */
130 ULONG bytes_block; /* size of a block in bytes */
131 ULONG bytes_sector; /* size of a sector in bytes */
133 ULONG mask_block;
134 IPTR mask_mask; /* mask as specified by mountlist */
136 ULONG bufmemtype; /* default value */
138 /* Internal globals */
140 struct SCSICmd scsicmd; /* for SCSIdirect */
141 struct SCSI10Cmd scsi10cmd;
143 struct Interrupt changeint;
144 struct IntData
146 ULONG *diskchanged;
147 struct Task *task;
148 ULONG signal;
149 } intdata;
150 ULONG diskchanged;
152 #define MINSAFETYBLOCKS (16)
153 #define MINCACHESIZE (MINSAFETYBLOCKS*2)
154 #define HASHSHIFT (7)
155 #define HASHSIZE (1<<HASHSHIFT)
157 struct MinList cbhashlist[HASHSIZE];
158 struct MinList cblrulist;
160 void *transactionpool;
161 ULONG transactionpoolsize;
162 UBYTE *compressbuffer;
163 LONG transactionnestcount;
165 struct Operation *operationroot;
166 struct Operation operationsentinel;
168 #define IOC_HASHSHIFT (6)
169 #define IOC_HASHSIZE (1<<IOC_HASHSHIFT)
171 struct IOCache *ioc_hashtable[IOC_HASHSIZE];
172 struct MinList *iocache_lruhead;
173 struct IOCache *ioc_buffer; /* Used for reading data when another iocache has dirty data in it. */
174 ULONG iocache_mask;
175 ULONG iocache_sizeinblocks;
176 ULONG iocache_lines;
177 WORD iocache_shift;
178 BYTE iocache_copyback;
179 // BYTE iocache_readonwrite=TRUE; /* Determines whether a new line is read before writing to it. */
180 BYTE iocache_readonwrite; /* Determines whether a new line is read before writing to it. */
182 struct EClockVal ecv;
184 NODE templockedobjectnode;
186 UBYTE internalrename; /* If TRUE, then the file is being renamed to recycled... */
188 #define FRAGMENTS (300)
190 ULONG fragment[FRAGMENTS];
191 //UBYTE fragmenttype[FRAGMENTS];
193 ULONG bestkey;
194 ULONG bestblocks;
195 ULONG searchedblocks;
197 #define OPTBUFSIZE (131072)
199 ULONG defrag_maxfilestoscan;
200 LONG debugreqs;
203 #ifdef __AROS__
204 #define globals (*(struct SFSBase **)&((struct Process *)FindTask(NULL))->pr_GlobVec)
205 #else
206 extern struct Globals *globals;
207 #endif
209 void initGlobals();
211 #ifndef __AROS__
212 #ifdef SysBase
213 #undef SysBase
214 #endif
215 #endif
217 #ifdef DOSBase
218 #undef DOSBase
219 #endif
221 #ifdef IntuitionBase
222 #undef IntuitionBase
223 #endif
225 #ifdef UtilityBase
226 #undef UtilityBase
227 #endif
229 #ifdef TimerBase
230 #undef TimerBase
231 #endif
233 /* FIXME: Remove these #define xxxBase hacks
234 Do not use this in new code !
236 #ifndef __AROS__
237 #define SysBase (globals->sysBase)
238 #endif
239 #define DOSBase (globals->dosBase)
240 #define IntuitionBase (globals->intuitionBase)
241 #define UtilityBase (globals->utilityBase)
242 #define TimerBase (globals->timerBase)
244 #endif /*GLOBALS_H_*/