1 #ifndef DOS_DOSEXTENS_H
2 #define DOS_DOSEXTENS_H
5 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
8 Desc: LibBase and some important structures
13 # include <aros/config.h>
16 # include <exec/types.h>
19 # include <exec/tasks.h>
22 # include <exec/ports.h>
24 #ifndef EXEC_LIBRARIES_H
25 # include <exec/libraries.h>
27 #ifndef EXEC_DEVICES_H
28 # include <exec/devices.h>
30 #ifndef EXEC_SEMAPHORES
31 # include <exec/semaphores.h>
33 #ifndef DEVICES_TIMER_H
34 # include <devices/timer.h>
36 #ifndef EXEC_INTERRUPTS_H
37 # include <exec/interrupts.h>
42 #include <dos/dosextaros.h>
44 /**********************************************************************
45 ***************************** DosLibrary *****************************
46 **********************************************************************/
48 /* This is how the base of dos.library looks like. */
51 /* A normal library-base as defined in <exec/libraries.h>. */
52 struct Library dl_lib
;
54 struct RootNode
* dl_Root
;
56 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
57 /* The following fields are not used by AROS and are just there to
58 guarantee binary compatibility. DO NOT USE THESE FIELDS IN ANY WAY.
59 Original names were: dl_GV, dl_A2, dl_A5 and dl_A6 */
64 /* The following fields are PRIVATE! */
65 struct ErrorString
* dl_Errors
;
66 struct Device
* dl_TimerBase
;
67 struct Library
* dl_UtilityBase
;
68 struct Library
* dl_IntuitionBase
;
70 /* These are AROS specific extensions. They are all PRIVATE! */
71 struct timerequest dl_TimerIO
;
73 struct DosList
* dl_DevInfo
;
74 struct ExecBase
* dl_SysBase
;
76 struct Device
* dl_NulHandler
;
77 struct Unit
* dl_NulLock
;
79 struct SignalSemaphore dl_LDObjectsListSigSem
;
80 struct List dl_LDObjectsList
;
81 struct Interrupt dl_LDHandler
;
82 struct MsgPort
* dl_LDDemonPort
;
83 struct Process
* dl_LDDemonTask
;
90 /* The flags are the same, as they were in RootNode->rn_Flags. See below
94 /* Resident segment list **PRIVATE** */
98 /* dl_Flags/rn_Flags */
99 #define RNB_WILDSTAR 24 /* Activate '*' as wildcard character. */
100 #define RNF_WILDSTAR (1L << RNB_WILDSTAR)
105 /* (IPTR *) Pointer to an array containing pointers to CLI processes.
106 The CLI process number is equal to the index of that array. The
107 first field (index 0) contains the maximal number of CLI processes.
108 See also rn_CliList. */
110 /* (void *) Pointer to the SegList for CLIs. */
111 BPTR rn_ConsoleSegment
;
112 /* The current time. */
113 struct DateStamp rn_Time
;
114 /* (APTR) The SegList of the process that handles validation of devices.
117 /* (struct DosInfo *) see below for DosInfo */
119 BPTR rn_FileHandlerSegment
;
120 /* List of all CLI processes (struct CliProcList - see below). See also
122 struct MinList rn_CliList
;
123 /* Message port of boot filesystem. (PRIVATE) */
124 struct MsgPort
* rn_BootProc
;
125 /* (void *) Pointer to the SegList for shells. */
126 BPTR rn_ShellSegment
;
127 /* Additional flags (see above). */
130 /* RootNode arbitrator */
131 struct SignalSemaphore rn_RootLock
;
135 /* Structure that is linked into the rootnode's rn_CliList. Completely
136 private, of course! ... and it's not compatible to AmigaOS. */
140 struct Process
*ci_Process
;
145 BPTR di_McName
; /* PRIVATE */
151 /* The following semaphores are PRIVATE. */
152 struct SignalSemaphore di_DevLock
;
153 struct SignalSemaphore di_EntryLock
;
154 struct SignalSemaphore di_DeleteLock
;
156 #define di_ResList di_McName
158 /**********************************************************************
159 ***************************** Processes ******************************
160 **********************************************************************/
162 /* Standard process structure. Processes are just extended tasks. */
165 /* Embedded task structure as defined in <exec/tasks.h>. */
168 /* Processes standard message-port. Used for various puposes. */
169 struct MsgPort pr_MsgPort
;
170 WORD pr_Pad
; /* PRIVATE */
171 /* SegList array, used by this process. (void **) */
173 /* StackSize of the current process. */
176 /* CLI process number. This may be 0, in which case the process is not
177 connected to a CLI. */
179 /* Pointer to upper end of stack. (void *) */
181 /* Secondary return-value, as defined in <dos/dos.h>. As of now this
182 field is declared PRIVATE. Use IoErr()/SetIoErr() to access it. */
184 /* Lock of the current directory. As of now this is declared READ-ONLY.
185 Use CurrentDir() to set it. (struct FileLock *) */
187 /* Standard input file. As of now this is declared WRITE-ONLY. Use
188 Input() to query it. */
190 /* Standard output file. As of now this is declared WRITE-ONLY. Use
191 Output() to query it. */
193 /* Task to handle the console associated with process. */
195 /* The task that is responsible for handling the filesystem. */
196 APTR pr_FileSystemTask
;
197 /* CLI the process is connected to. (struct CommandLineInterface *) */
200 /* Function to be called, when process waits for a packet-message. */
202 /* Standard-Window of process. */
204 /* Lock to home-directory of process. (struct FileLock *) */
206 LONG pr_Flags
; /* see below */
208 /* Code that is called, when the process exits. pr_ExitData takes an
209 argument to be passed to this code. */
210 void (* pr_ExitCode
)();
212 /* Arguments passed to the process from caller. */
215 /* List of local environment variables. This list should be in
216 alphabetical order. Multiple entries may have the same name, if they
217 are of different types. See <dos/var.h> for more information. */
218 struct MinList pr_LocalVars
;
219 ULONG pr_ShellPrivate
;
220 /* Standard error file. May be NULL, in which case pr_COS is to be used.
221 Use this instead of Output() to report errors. */
225 /* pr_Flags (all PRIVATE) They mainly descibe what happens if the process
226 exits, i.e. which resources the process should clean itself. The flags
227 are self-explaining. */
228 #define PRB_FREESEGLIST 0
229 #define PRB_FREECURRDIR 1
230 #define PRB_FREECLI 2
231 #define PRB_CLOSEINPUT 3
232 #define PRB_CLOSEOUTPUT 4
233 #define PRB_FREEARGS 5
234 #define PRB_CLOSEERROR 6
235 #define PRB_SYNCHRONOUS 7
236 #define PRB_WAITINGFORCHILD 8 /* This one is subject to change! */
238 #define PRF_FREESEGLIST (1L << PRB_FREESEGLIST)
239 #define PRF_FREECURRDIR (1L << PRB_FREECURRDIR)
240 #define PRF_FREECLI (1L << PRB_FREECLI)
241 #define PRF_CLOSEINPUT (1L << PRB_CLOSEINPUT)
242 #define PRF_CLOSEOUTPUT (1L << PRB_CLOSEOUTPUT)
243 #define PRF_FREEARGS (1L << PRB_FREEARGS)
244 #define PRF_CLOSEERROR (1L << PRB_CLOSEERROR)
245 #define PRF_SYNCHRONOUS (1L << PRB_SYNCHRONOUS)
246 #define PRF_WAITINGFORCHILD (1L << PRB_WAITINGFORCHILD)
248 /* Structure used for CLIs and Shells. Allocate this structure with
249 AllocDosObject() only! */
250 struct CommandLineInterface
252 /* Secondary error code, set by last command. */
254 /* Name of the current directory. */
256 /* Lock of the first directory in path. (struct FileLock *) */
258 /* Error code, the last command returned. See <dos/dos.h> for
261 /* Name of the command that is currently executed. */
262 BSTR cli_CommandName
;
263 /* Fail-Level as set by the command "FailAt". */
265 /* Current prompt in the CLI window. */
267 /* Standard/Default input file. (struct FileLock *) */
268 BPTR cli_StandardInput
;
269 /* Current input file. (struct FileLock *) */
270 BPTR cli_CurrentInput
;
271 /* Name of the file that is currently executed. */
272 BSTR cli_CommandFile
;
273 /* TRUE if the currently CLI is connected to a controlling terminal,
275 LONG cli_Interactive
;
276 /* FALSE if there is no controlling terminal, otherwise TRUE. */
278 /* Current output file. (struct FileLock *) */
279 BPTR cli_CurrentOutput
;
280 /* Default stack size as set by the command "Stack". */
281 LONG cli_DefaultStack
;
282 /* Standard/Default output file. (struct FileLock *) */
283 BPTR cli_StandardOutput
;
284 /* SegList of currently loaded command. */
287 /* Here begins the aros specific part */
288 /* Standard/Default Error file. (struct FileLock *) */
289 BPTR cli_StandardError
;
292 /* CLI_DEFAULTSTACK_UNIT * cli_DefaultStack = stack in bytes */
294 #define CLI_DEFAULTSTACK_UNIT sizeof(IPTR)
296 /* Devices process structure as returned by GetDeviceProc(). */
299 struct MsgPort
* dvp_Port
;
300 BPTR dvp_Lock
; /* struct FileLock * */
301 ULONG dvp_Flags
; /* see below */
302 struct DosList
* dvp_DevNode
; /* PRIVATE */
306 #define DVPB_UNLOCK 0
307 #define DVPB_ASSIGN 1
308 #define DVPF_UNLOCK (1L<<DVPB_UNLOCK)
309 #define DVPF_ASSIGN (1L<<DVPB_ASSIGN)
311 /**********************************************************************
312 ******************************* Files ********************************
313 **********************************************************************/
315 /* Standard file-handle as returned by Open() (as BPTR). Generally said, you
316 should not use this structure in any way and only use library-calls to
317 access files. Note that this structure is very different to the structure
318 used in AmigaOS! Treat this structure as PRIVATE. If you want to create
319 this structure nevertheless, use AllocDosObject(). */
322 /* The next three are used with packet-based filesystems */
323 struct Message
* fh_Link
; /* exec message containing packet */
324 struct MsgPort
* fh_Port
; /* packet reply port */
325 struct MsgPort
* fh_Type
; /* port to send packets to */
331 /* The following four fields have different names and a different
332 function than their AmigaOS equivalents. The original names were:
333 fh_Funcs/fh_Func1, fh_Func2, fh_Func3, fh_Args/fh_Arg1 and fh_Arg2 */
335 ULONG fh_Flags
; /* see below */
336 /* This is a pointer to a filesystem handler. See <dos/filesystems.h> for
338 struct Device
* fh_Device
;
340 /* SDuvan: Added this and removed the #if below. This field allows us
341 to emulate packets -- specifically it makes it possible
342 to implement the ***Pkt() functions */
343 SIPTR fh_CompatibilityHack
;
345 /* A private pointer to a device specific filehandle structure. See
346 <dos/filesystems.h> for more information. */
347 struct Unit
* fh_Unit
;
350 #define fh_Arg1 fh_CompatibilityHack
352 /* fh_Flags. The flags are AROS specific and therefore PRIVATE.. */
353 #define FHF_WRITE 0x80000000
356 #define FHF_LINEBUF 4
359 /* Structure of a lock. This is provided as it may be required internally by
360 * packet-based filesystems, but it is not used by dos.library and the rest of
361 * AROS. Lock() returns a struct FileHandle! */
364 BPTR fl_Link
; /* (struct FileLock *) Pointer to next lock. */
367 struct MsgPort
* fl_Task
;
368 BPTR fl_Volume
; /* (struct DeviceList * - see below) */
372 /* Constants, defining of what kind a file is. These constants are used in
373 many structures, including FileInfoBlock (<dos/dos.h>) and ExAllData
375 #define ST_PIPEFILE -5 /* File is a pipe */
376 #define ST_LINKFILE -4 /* Hard link to a file */
377 #define ST_FILE -3 /* Plain file */
378 #define ST_ROOT 1 /* Root directory of filesystem */
379 #define ST_USERDIR 2 /* Normal directory */
380 #define ST_SOFTLINK 3 /* Soft link (may be a file or directory) */
381 #define ST_LINKDIR 4 /* Hard link to a directory */
383 /**********************************************************************
384 ****************************** DosLists ******************************
385 **********************************************************************/
387 /* This structure is returned by LockDosList() and similar calls. This
388 structure is different to the AmigaOS one. But this structure is PRIVATE
389 anyway. Use system-calls for dos list-handling. */
392 /* PRIVATE pointer to next entry. In AmigaOS this used to be a BPTR. */
393 struct DosList
* dol_Next
;
394 /* Type of the current node (see below). */
396 /* Filesystem task handling this entry (for old-style filesystems) */
397 struct MsgPort
* dol_Task
;
398 /* The lock passed to AssignLock(). Only set if the type is
402 /* This union combines all the different types. */
404 /* See struct DevInfo below. */
412 /* See struct DeviceList below. */
414 struct DateStamp dol_VolumeDate
;
419 /* Structure used for assigns. */
421 /* The name for the late or nonbinding assign. */
422 UBYTE
*dol_AssignName
;
423 /* A list of locks, used by AssignAdd(). */
424 struct AssignList
*dol_List
;
428 /* Name as a BCPL string */
431 /* Private extensions for the DosList struct.
432 * Should not be used in user land code.
436 IPTR dol_Reserved
[5];
437 struct DosListAROSExt dol_AROS
;
441 /* dol_Type/dl_Type/dvi_Type. Given to MakeDosEntry(). */
442 #define DLT_DEVICE 0 /* A real filesystem (or similar) */
443 #define DLT_DIRECTORY 1 /* Just a simple assign */
444 #define DLT_VOLUME 2 /* Volume node (for removable media) */
445 #define DLT_LATE 3 /* Late binding assign (not yet) */
446 #define DLT_NONBINDING 4 /* Nonbinding assign (not yet) */
449 /* The following structures are essentially the same as DosList above. The
450 difference is that they support just one type of entry. You can use them
451 instead of DosList if you have a list containing just one type of
452 entry. For more information see above. */
456 struct DeviceList
* dl_Next
;
457 LONG dl_Type
; /* see above, always = DLT_VOLUME */
459 struct MsgPort
* dl_Task
;
462 /* Embedded DateStamp structured as defined in <dos/dos.h>. At this
463 date the volume was created. */
464 struct DateStamp dl_VolumeDate
;
465 /* (void *) List of all locks on the volume. */
467 /* Type of the disk. (see <dos/dos.h> for definitions) */
469 BPTR dl_unused
; /* PRIVATE */
471 /* In DevInfo we have three pointers and three longwords,
472 * in this structure two pointers and four longwords,
473 * add some bytes if pointers are longer then longwords
474 * FIXME: ptr alignment not taken into account
476 #if AROS_SIZEOFPTR > AROS_SIZEOFULONG
477 // UBYTE dl_unused2[(AROS_SIZEOFPTR-AROS_SIZEOFULONG)];
482 /* Private extensions
483 * Should not be used in user land code.
488 struct DosListAROSExt dl_AROS
;
493 /* Structure that describes a device. This is essentially the same structure
494 as DeviceNode, defined in <dos/filehandler.h>. */
497 struct DevInfo
* dvi_Next
;
498 LONG dvi_Type
; /* see above, always = DLT_DEVICE */
500 struct MsgPort
* dvi_Task
;
503 BSTR dvi_Handler
; /* Device name for handler. */
504 LONG dvi_StackSize
; /* Packet-handler initial stack size */
505 LONG dvi_Priority
; /* Packet-handler initial priority */
506 BPTR dvi_Startup
; /* (struct FileSysStartupMsg * - defined in
507 <dos/filehandler.h>) */
508 BPTR dvi_NoAROS4
[2]; /* PRIVATE */
512 /* Private extensions
513 * Should not be used in user land code.
517 IPTR dvi_Reserved
[5];
518 struct DosListAROSExt dvi_AROS
;
522 /* Dos list scanning and locking modes as used in LockDosList() */
523 /* Specify either LDF_READ, if you want a non-exclusive lock, or LDF_WRITE,
524 if you want an exclusive lock (i.e. if you want to modify the list).
526 #define LDB_READ 0 /* Non-exclusive/read lock */
527 #define LDB_WRITE 1 /* Exclusive/write lock */
528 /* Specify which list(s) to lock. */
529 #define LDB_DEVICES 2 /* Device list */
530 #define LDB_VOLUMES 3 /* Volume list */
531 #define LDB_ASSIGNS 4 /* Assign list */
535 #define LDF_READ (1L<<LDB_READ)
536 #define LDF_WRITE (1L<<LDB_WRITE)
537 #define LDF_DEVICES (1L<<LDB_DEVICES)
538 #define LDF_VOLUMES (1L<<LDB_VOLUMES)
539 #define LDF_ASSIGNS (1L<<LDB_ASSIGNS)
540 #define LDF_ENTRY (1L<<LDB_ENTRY)
541 #define LDF_DELETE (1L<<LDB_DELETE)
542 #define LDF_ALL (LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS)
545 /* Used for assigns that point to multiple directories. */
548 struct AssignList
* al_Next
; /* Pointer to next assign node. */
549 BPTR al_Lock
; /* (struct FileLock *) Lock of on of the
553 /**********************************************************************
554 ********************** Low Level File Handling ***********************
555 **********************************************************************/
557 /* This section is OBSOLETE and is not implemented in AROS! AROS uses a
558 different concept for filesystem-handling. See <dos/filesystem.h> for
559 more information. Use the structures and defines in this section only, if
560 you are programming just for AmigaOS. */
563 /* Allocate this structure with AllocDosObject(). */
566 struct Message
* dp_Link
; /* Pointer to a standard exec message. */
567 struct MsgPort
* dp_Port
; /* Reply-Port of that packet. */
569 LONG dp_Type
; /* see below */
570 LONG dp_Res1
; /* Normal return value. */
571 LONG dp_Res2
; /* Secondary return value (as returned by IoErr()). See
572 <dos/dos.h> for possible values. */
574 /* The actual data. */
583 #define dp_Action dp_Type
584 #define dp_Status dp_Res1
585 #define dp_Status2 dp_Res2
586 #define dp_BufAddr dp_Arg1
589 /* These are defined for packet emulation purposes only! AROS doesn't use
590 packets at all, but emulates (some of) them via DoPkt(), SendPkt() and
591 others to function like they did in AmigaOS */
595 #define ACTION_STARTUP 0
596 #define ACTION_GET_BLOCK 2 /* Obsolete */
597 #define ACTION_SET_MAP 4
599 #define ACTION_EVENT 6
600 #define ACTION_CURRENT_VOLUME 7
601 #define ACTION_LOCATE_OBJECT 8
602 #define ACTION_RENAME_DISK 9
603 #define ACTION_FREE_LOCK 15
604 #define ACTION_DELETE_OBJECT 16
605 #define ACTION_RENAME_OBJECT 17
606 #define ACTION_MORE_CACHE 18
607 #define ACTION_COPY_DIR 19
608 #define ACTION_WAIT_CHAR 20
609 #define ACTION_SET_PROTECT 21
610 #define ACTION_CREATE_DIR 22
611 #define ACTION_EXAMINE_OBJECT 23
612 #define ACTION_EXAMINE_NEXT 24
613 #define ACTION_DISK_INFO 25
614 #define ACTION_INFO 26
615 #define ACTION_FLUSH 27
616 #define ACTION_SET_COMMENT 28
617 #define ACTION_PARENT 29
618 #define ACTION_TIMER 30
619 #define ACTION_INHIBIT 31
620 #define ACTION_DISK_TYPE 32
621 #define ACTION_DISK_CHANGE 33
622 #define ACTION_SET_DATE 34
623 #define ACTION_SAME_LOCK 40
625 #define ACTION_WRITE 'W'
626 #define ACTION_READ 'R'
628 #define ACTION_SCREEN_MODE 994
629 #define ACTION_CHANGE_SIGNAL 995
630 #define ACTION_READ_RETURN 1001
631 #define ACTION_WRITE_RETURN 1002
632 #define ACTION_FINDUPDATE 1004
633 #define ACTION_FINDINPUT 1005
634 #define ACTION_FINDOUTPUT 1006
635 #define ACTION_END 1007
636 #define ACTION_SEEK 1008
637 #define ACTION_FORMAT 1020
638 #define ACTION_MAKE_LINK 1021
639 #define ACTION_SET_FILE_SIZE 1022
640 #define ACTION_WRITE_PROTECT 1023
641 #define ACTION_READ_LINK 1024
642 #define ACTION_FH_FROM_LOCK 1026
643 #define ACTION_IS_FILESYSTEM 1027
644 #define ACTION_CHANGE_MODE 1028
645 #define ACTION_COPY_DIR_FH 1030
646 #define ACTION_PARENT_FH 1031
647 #define ACTION_EXAMINE_ALL 1033
648 #define ACTION_EXAMINE_FH 1034
649 #define ACTION_EXAMINE_ALL_END 1035
650 #define ACTION_SET_OWNER 1036
652 #define ACTION_LOCK_RECORD 2008
653 #define ACTION_FREE_RECORD 2009
655 #define ACTION_ADD_NOTIFY 4097
656 #define ACTION_REMOVE_NOTIFY 4098
658 #define ACTION_SERIALIZE_DISK 4200
660 /* Structure for easy handling of DosPackets. DosPackets don't have to be in
661 this structure, but this struture may ease the use of it. */
662 struct StandardPacket
664 struct Message sp_Msg
;
665 struct DosPacket sp_Pkt
;
669 /* NOTE: AROS doesn't use startup packets. This will ONLY make a difference
670 for shell writers... */
672 /* Types of command execution */
673 #define RUN_EXECUTE -1
674 #define RUN_SYSTEM -2
675 #define RUN_SYSTEM_ASYNCH -3
678 /**********************************************************************
679 ****************************** Segments ******************************
680 **********************************************************************/
682 /* Resident list structure as returned by AddSegment(). */
685 BPTR seg_Next
; /* Pointer to next segment. */
686 LONG seg_UC
; /* Usage count/type */
687 BPTR seg_Seg
; /* Actual Segment */
688 UBYTE seg_Name
[4]; /* The first characters of the name (BSTR). */
691 #define CMD_SYSTEM -1
692 #define CMD_INTERNAL -2
693 #define CMD_DISABLED -999
695 /**********************************************************************
696 *************************** Error Handling ***************************
697 **********************************************************************/
705 /* Return values for ErrorReport(). */
706 #define REPORT_STREAM 0
707 #define REPORT_TASK 1
708 #define REPORT_LOCK 2
709 #define REPORT_VOLUME 3
710 #define REPORT_INSERT 4
712 #define ABORT_BUSY 288
713 #define ABORT_DISK_ERROR 296
715 #endif /* DOS_DOSEXTENS_H */