This page is "http://www.cs.tut.fi/~albert/BOAR/dosstructures.html".

Structures Used by dos.library Functions


<dos/dos.h>

struct DOSLibrary
{
    struct Library dl_lib;
    ULONG dl_Flags;
    struct List dl_Handlers;
    struct List dl_Residents; /* Resident programs */
};


struct DosList
{
    struct Node dol_Node;     /* ln_Name points to uppercase name */
    struct MsgPort *dol_Task; /* handler task msgport */
    APTR dol_Lock; /* Lock to root directory (may be NULL) */
    union
    {
	struct
	{
	    char *dol_Handler;   /* File to load if seglist is NULL */
	    LONG  dol_Stacksize; /* Stacksize for the process */
	    LONG  dol_Priority;  /* Priority for the process */
	    ULONG dol_Startup;
	    struct SegList *dol_SegList; /* Already loaded code for new task */
	} dol_handler;
	struct
	{
	    struct List dol_LockList; /* List of outstanding locks */
	    LONG dol_Status;
	    LONG dol_DiskType; /* Disk/filesystem type */
	} dol_volume;
	struct
	{
	    struct List dol_AssignList; /* List for locks */
	    LONG dol_Flags;
	    char *dol_AssignName; /* For late binding */
	} dol_assign;
    } dol_misc;
};
#define DLT_HANDLER   0
#define DLT_VOLUME    1
#define DLT_ASSIGN    2

struct AssignList
{
    struct MinNode al_Node;
    APTR al_Lock;
};

/* structure return by GetDeviceProc() */
struct DevProc
{
    struct MsgPort *dvp_Port;       /* Port to send msg to */
    APTR            dvp_Lock;       /* Baselock to use */
    ULONG           dvp_Flags;      /* Flags for dos */
    struct DosList *dvp_DevNode;    /* DON'T TOUCH OR USE! */
};

/*
   SegList is created by LoadSeg() and deleted by UnLoadSeg().
   Normally three linked parts will exist: Code, Data and BSS.
   Code segment will always exist, data and BSS are optional.
 */
struct SegList
{
    struct SegList *sl_Next;    /* Next segment in list or NULL */
    ULONG sl_Length;            /* The whole segment size, including header */
    /* Code starts from here */
};

struct Process
{
    struct Task pr_Task;
    UWORD *pr_StackTop;
    UWORD *pr_StackBottom;
    LONG  pr_Result2;    /* Secondary result from the last DOS call */
    APTR  pr_SegList;    /* seglist of command in execution */
    ULONG pr_Protections;/* Default file/directory protections */
    APTR  pr_CurrentDir; /* FileLock associated with the current dir */
    struct MsgPort *pr_FileSystemTask; /* 'creator' of the curr.dir lock */
    APTR  pr_CIS;        /* Current Input stream (Input()) */
    APTR  pr_COS;        /* Current Output stream (Output()) */
    APTR  pr_CES;        /* Current Error stream (Error()) */
    char *pr_Arguments; /* Argument string for program */
    struct List pr_LocalVars; /* Local environmental variables */
    struct CommandLineInterface *pr_CLI; /* or NULL for plain process */
    ULONG pr_Flags;
    char *pr_ProgramName; /* Name of the currently running program or NULL */
    struct List pr_Path;  /* List of (struct AssignList) */
};

/*
 * Flags for pr_Flags
 */
#define PRB_FREESEGLIST         0
#define PRF_FREESEGLIST         1
#define PRB_FREECURRDIR         1
#define PRF_FREECURRDIR         2
#define PRB_FREECLI             2
#define PRF_FREECLI             4
#define PRB_CLOSEINPUT          3
#define PRF_CLOSEINPUT          8
#define PRB_CLOSEOUTPUT         4
#define PRF_CLOSEOUTPUT         16
#define PRB_CLOSEERROR          5
#define PRF_CLOSEERROR          32
#define PRB_FREEARGS            6
#define PRF_FREEARGS            64



/*
   FileHandle is given as argument for handler in Open() and in each
   other call. The handler should initialize the fields to proper
   values. In Open() DosPacket is sent to the port found from the
   device node. In proceding calls it is sent to the port found
   from fh_Port. If fh_Port is NULL, the functions are directly
   called.
 */
struct FileHandle
{
    struct MsgPort *fh_Port; /* Port to do PutMsg() to, NULL for FS */
    ULONG fh_Buf;
    ULONG fh_Pos;
    ULONG fh_End;
    ULONG fh_Func1;  /* Functions for direct filesystem calls */
    ULONG fh_Func2;  /* In interactive handlers they may be used freely */
    ULONG fh_Func3;
    ULONG fh_Arg1;
    ULONG fh_Arg2;
};

struct DosPacket
{
    struct Message dp_Message;
    LONG dp_Type;                 /* Name of the action */

    ULONG dp_Arg1;
    ULONG dp_Arg2;
    ULONG dp_Arg3;
    ULONG dp_Arg4;
    ULONG dp_Arg5;
    ULONG dp_Arg6;

    LONG dp_Result;   /* Return value for the action */
    LONG dp_Result2;  /* Secondary result - the reason for failure */
};

/* a lock structure, as returned by Lock() or DupLock() */
struct FileLock
{
    struct MinNode fl_Node;
    LONG           fl_Key;         /* Handler-private (disk block number) */
    LONG           fl_Access;      /* exclusive or shared */
    struct MsgPort *fl_Task;       /* handler task's port */
    APTR           fl_Volume;      /* ptr to DLT_VOLUME DosList entry */
};

struct FileInfoBlock
{
   LONG   fib_DiskKey;
   LONG   fib_DirEntryType;  /* Type of Directory. If < 0, then a plain file.
                              * If > 0 a directory */
   char   fib_FileName[108]; /* Null terminated. Max N chars used for now */
   LONG   fib_Protection;    /* bit mask of protection, rwxd are 3-0.      */
   LONG   fib_EntryType;
   LONG   fib_Size;          /* Number of bytes in file */
   LONG   fib_NumBlocks;     /* Number of blocks in file */
   struct DateStamp fib_Date;/* Date file last changed */
   char   fib_Comment[80];  /* Null terminated comment associated with file */

   UWORD  fib_OwnerID;         /* owner's UID */
   UWORD  fib_GroupID;         /* owner's GID */

   LONG   fib_Reserved[8];
}; /* FileInfoBlock */

/* returned by DiskInfo() */
struct InfoData
{
   LONG   id_NumSoftErrors;     /* number of soft errors on disk */
   LONG   id_UnitNumber;        /* Which unit disk is (was) mounted on */
   LONG   id_DiskState;         /* See defines below */
   LONG   id_NumBlocks;         /* Number of blocks on disk */
   LONG   id_NumBlocksUsed;     /* Number of block in use */
   LONG   id_BytesPerBlock;     /* Block size */
   LONG   id_DiskType;          /* Disk Type code */
   APTR   id_VolumeNode;        /* Pointer to volume node */
   LONG   id_InUse;             /* Flag, zero if not in use */
}; /* InfoData */


struct LocalVar
{
    struct Node lv_Node;
    UWORD   lv_Flags;
    UBYTE   *lv_Value;
    ULONG   lv_Len;
};

#define LV_VAR       0
#define LV_ALIAS     1

struct ArgList
{
    int argc;
    char **argv;
    struct List ArgMemList;
};