1 #ifndef DOS_DOS_H
    2 #define DOS_DOS_H
    3 
    4 /*
    5 	dos.library include
    6 
    7 	Copyright © 2002-2003 The MorphOS Development Team, All Rights Reserved.
    8 */
    9 
   10 #ifndef EXEC_TYPES_H
   11 # include <exec/types.h>
   12 #endif
   13 
   14 #pragma pack(2)
   15 
   16 
   17 #define DOSNAME  "dos.library"
   18 
   19 
   20 #define DOSTRUE   (-1L)
   21 #define DOSFALSE   (0L)
   22 
   23 
   24 #define MODE_OLDFILE    1005
   25 #define MODE_NEWFILE    1006
   26 #define MODE_READWRITE  1004
   27 
   28 
   29 #define OFFSET_BEGINNING  -1
   30 #define OFFSET_CURRENT     0
   31 #define OFFSET_END         1
   32 
   33 /* Typo fix */
   34 
   35 #define OFFSET_BEGINING  OFFSET_BEGINNING
   36 
   37 
   38 #define BITSPERBYTE   8
   39 #define BYTESPERLONG  4
   40 #define BITSPERLONG   32
   41 #define MAXINT        0x7FFFFFFF
   42 #define MININT        0x80000000
   43 
   44 
   45 #define SHARED_LOCK     -2
   46 #define ACCESS_READ     -2
   47 #define EXCLUSIVE_LOCK  -1
   48 #define ACCESS_WRITE    -1
   49 
   50 
   51 struct DateStamp
   52 {
   53 	LONG ds_Days;
   54 	LONG ds_Minute;
   55 	LONG ds_Tick;
   56 };
   57 
   58 #define TICKS_PER_SECOND  50
   59 
   60 struct PosixDateStamp
   61 {
   62 	QUAD pds_Sec;  /* Seconds relative to 01-01-1970 UTC */
   63 	LONG pds_NSec;
   64 };
   65 
   66 struct FileInfoBlock
   67 {
   68 	LONG             fib_DiskKey;
   69 	LONG             fib_DirEntryType;
   70 	char             fib_FileName[108];
   71 	LONG             fib_Protection;
   72 	LONG             fib_EntryType;
   73 	LONG             fib_Size;
   74 	LONG             fib_NumBlocks;
   75 	union
   76 	{
   77 		struct DateStamp fib_un_date_Date;
   78 		struct PosixDateStamp fib_un_date_PosixDate;
   79 	} fib_un_date;
   80 	char             fib_Comment[80];
   81 
   82 	UWORD            fib_OwnerUID;
   83 	UWORD            fib_OwnerGID;
   84 
   85 	union
   86 	{
   87 		char             fib_un_Reserved[32];
   88 		struct
   89 		{
   90 			UQUAD    fib_un_ext_Size64;
   91 			UQUAD    fib_un_ext_NumBlocks64;
   92 			ULONG    fib_in_ext_Pad0[3];
   93 			UWORD    fib_un_ext_Pad1;
   94 			UBYTE    fib_un_ext_ActExtFlags;
   95 			UBYTE    fib_un_ext_ReqExtFlags;
   96 		} fib_un_ext;
   97 	} fib_un;
   98 };
   99 
  100 #define fib_Reserved fib_un.fib_un_Reserved
  101 
  102 
  103 /* 64bit DOS extensions - V51 */
  104 
  105 /* Structure fields filled by Examine64() (ACTION_EXAMINE_OBJECT64),
  106  * ExNext64() (ACTION_EXAMINE_NEXT64) and ExamineFH64()
  107  * (ACTION_EXAMINE_FH64).
  108  *
  109  * For dos.library Examine64() / ExNext64() / ExamineFH64() the filling
  110  * of the fields can be requested by using the EX64TAG_* tags.
  111  *
  112  * If you send ACTION_EXAMINE_OBJECT64, ACTION_EXAMINE_NEXT64 or
  113  * ACTION_EXAMINE_FH64 dospackets directly, you *MUST* initialize
  114  * fib_ActExtFlags to 0. fib_ReqExtFlags should be set to requested
  115  * extensions (or 0).
  116  *
  117  * The fib_ActExtFlags will indicate the actual extensions that were
  118  * available.
  119  *
  120  * fib_Size64 / fib_un_ext_NumBlocks64 is always available.
  121  *
  122  */
  123 #define fib_Date        fib_un_date.fib_un_date_Date
  124 #define fib_PosixDate   fib_un_date.fib_un_date_PosixDate
  125 #define fib_Size64      fib_un.fib_un_ext.fib_un_ext_Size64
  126 #define fib_NumBlocks64 fib_un.fib_un_ext.fib_un_ext_NumBlocks64
  127 #define fib_ActExtFlags fib_un.fib_un_ext.fib_un_ext_ActExtFlags
  128 #define fib_ReqExtFlags fib_un.fib_un_ext.fib_un_ext_ReqExtFlags
  129 /*
  130  * When FIBEXTF_POSIXDATE flag is requested and is supported,
  131  * fib_PosixDate will be filled with the objext POSIX timestamp.
  132  * In this case fib_Date is not valid. (V51.66)
  133  */
  134 #define FIBEXTB_POSIXDATE 0
  135 #define FIBEXTF_POSIXDATE (1 << FIBEXTB_POSIXDATE)
  136 
  137 
  138 #define FIBB_OTR_READ     15
  139 #define FIBB_OTR_WRITE    14
  140 #define FIBB_OTR_EXECUTE  13
  141 #define FIBB_OTR_DELETE   12
  142 #define FIBB_GRP_READ     11
  143 #define FIBB_GRP_WRITE    10
  144 #define FIBB_GRP_EXECUTE  9
  145 #define FIBB_GRP_DELETE   8
  146 
  147 #ifndef FIBB_HOLD
  148 #define FIBB_HOLD         7
  149 #endif
  150 #define FIBB_SCRIPT       6
  151 #define FIBB_PURE         5
  152 #define FIBB_ARCHIVE      4
  153 #define FIBB_READ         3
  154 #define FIBB_WRITE        2
  155 #define FIBB_EXECUTE      1
  156 #define FIBB_DELETE       0
  157 
  158 #define FIBF_OTR_READ     (1<<FIBB_OTR_READ)
  159 #define FIBF_OTR_WRITE    (1<<FIBB_OTR_WRITE)
  160 #define FIBF_OTR_EXECUTE  (1<<FIBB_OTR_EXECUTE)
  161 #define FIBF_OTR_DELETE   (1<<FIBB_OTR_DELETE)
  162 #define FIBF_GRP_READ     (1<<FIBB_GRP_READ)
  163 #define FIBF_GRP_WRITE    (1<<FIBB_GRP_WRITE)
  164 #define FIBF_GRP_EXECUTE  (1<<FIBB_GRP_EXECUTE)
  165 #define FIBF_GRP_DELETE   (1<<FIBB_GRP_DELETE)
  166 
  167 #ifndef FIBF_HOLD
  168 #define FIBF_HOLD         (1<<FIBB_HOLD)
  169 #endif
  170 #define FIBF_SCRIPT       (1<<FIBB_SCRIPT)
  171 #define FIBF_PURE         (1<<FIBB_PURE)
  172 #define FIBF_ARCHIVE      (1<<FIBB_ARCHIVE)
  173 #define FIBF_READ         (1<<FIBB_READ)
  174 #define FIBF_WRITE        (1<<FIBB_WRITE)
  175 #define FIBF_EXECUTE      (1<<FIBB_EXECUTE)
  176 #define FIBF_DELETE       (1<<FIBB_DELETE)
  177 
  178 
  179 #define FAULT_MAX  82
  180 
  181 
  182 typedef long BPTR;
  183 typedef long BSTR;
  184 
  185 
  186 #ifdef OBSOLETE_LIBRARIES_DOS_H
  187 # define BADDR(bptr)  (((ULONG)bptr) << 2)
  188 #else
  189 # define BADDR(x)     ((APTR)((ULONG)(x) << 2))
  190 #endif
  191 
  192 #define MKBADDR(x)    (((LONG)(x)) >> 2)
  193 
  194 
  195 struct InfoData
  196 {
  197 	LONG id_NumSoftErrors;
  198 	LONG id_UnitNumber;
  199 	LONG id_DiskState;
  200 	LONG id_NumBlocks;
  201 	LONG id_NumBlocksUsed;
  202 	LONG id_BytesPerBlock;
  203 	LONG id_DiskType;
  204 	BPTR id_VolumeNode;
  205 	LONG id_InUse;
  206 };
  207 
  208 #define ID_WRITE_PROTECTED  80
  209 #define ID_VALIDATING       81
  210 #define ID_VALIDATED        82
  211 
  212 #define ID_NO_DISK_PRESENT   (-1)
  213 #define ID_UNREADABLE_DISK   (0x42414400L)
  214 #define ID_DOS_DISK          (0x444F5300L)
  215 #define ID_FFS_DISK          (0x444F5301L)
  216 #define ID_INTER_DOS_DISK    (0x444F5302L)
  217 #define ID_INTER_FFS_DISK    (0x444F5303L)
  218 #define ID_FASTDIR_DOS_DISK  (0x444F5304L)
  219 #define ID_FASTDIR_FFS_DISK  (0x444F5305L)
  220 #define ID_LNFS_DOS_DISK     (0x444F5306L)
  221 #define ID_LNFS_FFS_DISK     (0x444F5307L)
  222 #define ID_NOT_REALLY_DOS    (0x4E444F53L)
  223 #define ID_KICKSTART_DISK    (0x4B49434BL)
  224 #define ID_MSDOS_DISK        (0x4D534400L)
  225 #define ID_CDFS_DISK         (0x43444653L) /* CDFS  - Built-in CDROM */
  226 #define ID_CDROM_ISO_DISK    (('C'<<24) | ('D'<<16) | ('0'<<8) | ('1'))
  227 #define ID_CDROM_HSF_DISK    (('C'<<24) | ('D'<<16) | ('0'<<8) | ('0'))
  228 #define ID_CDROM_CDDA_DISK   (('C'<<24) | ('D'<<16) | ('D'<<8) | ('A'))
  229 #define ID_SFS_DISK          (('S'<<24) | ('F'<<16) | ('S'<<8) | (0))
  230 #define ID_SFS2_DISK         (('S'<<24) | ('F'<<16) | ('S'<<8) | (2))
  231 
  232 
  233 #define ERROR_NO_FREE_STORE             103
  234 #define ERROR_TASK_TABLE_FULL           105
  235 #define ERROR_BAD_TEMPLATE              114
  236 #define ERROR_BAD_NUMBER                115
  237 #define ERROR_REQUIRED_ARG_MISSING      116
  238 #define ERROR_KEY_NEEDS_ARG             117
  239 #define ERROR_TOO_MANY_ARGS             118
  240 #define ERROR_UNMATCHED_QUOTES          119
  241 #define ERROR_LINE_TOO_LONG             120
  242 #define ERROR_FILE_NOT_OBJECT           121
  243 #define ERROR_INVALID_RESIDENT_LIBRARY  122
  244 #define ERROR_NO_DEFAULT_DIR            201
  245 #define ERROR_OBJECT_IN_USE             202
  246 #define ERROR_OBJECT_EXISTS             203
  247 #define ERROR_DIR_NOT_FOUND             204
  248 #define ERROR_OBJECT_NOT_FOUND          205
  249 #define ERROR_BAD_STREAM_NAME           206
  250 #define ERROR_OBJECT_TOO_LARGE          207
  251 #define ERROR_ACTION_NOT_KNOWN          209
  252 #define ERROR_INVALID_COMPONENT_NAME    210
  253 #define ERROR_INVALID_LOCK              211
  254 #define ERROR_OBJECT_WRONG_TYPE         212
  255 #define ERROR_DISK_NOT_VALIDATED        213
  256 #define ERROR_DISK_WRITE_PROTECTED      214
  257 #define ERROR_RENAME_ACROSS_DEVICES     215
  258 #define ERROR_DIRECTORY_NOT_EMPTY       216
  259 #define ERROR_TOO_MANY_LEVELS           217
  260 #define ERROR_DEVICE_NOT_MOUNTED        218
  261 #define ERROR_SEEK_ERROR                219
  262 #define ERROR_COMMENT_TOO_BIG           220
  263 #define ERROR_DISK_FULL                 221
  264 #define ERROR_DELETE_PROTECTED          222
  265 #define ERROR_WRITE_PROTECTED           223
  266 #define ERROR_READ_PROTECTED            224
  267 #define ERROR_NOT_A_DOS_DISK            225
  268 #define ERROR_NO_DISK                   226
  269 #define ERROR_NO_MORE_ENTRIES           232
  270 
  271 #define ERROR_IS_SOFT_LINK              233
  272 #define ERROR_OBJECT_LINKED             234
  273 #define ERROR_BAD_HUNK                  235
  274 #define ERROR_NOT_IMPLEMENTED           236
  275 #define ERROR_RECORD_NOT_LOCKED         240
  276 #define ERROR_LOCK_COLLISION            241
  277 #define ERROR_LOCK_TIMEOUT              242
  278 #define ERROR_UNLOCK_ERROR              243
  279 
  280 #define RETURN_OK     0
  281 #define RETURN_WARN   5
  282 #define RETURN_ERROR  10
  283 #define RETURN_FAIL   20
  284 
  285 
  286 #define SIGBREAKB_CTRL_C  12
  287 #define SIGBREAKB_CTRL_D  13
  288 #define SIGBREAKB_CTRL_E  14
  289 #define SIGBREAKB_CTRL_F  15
  290 
  291 #define SIGBREAKF_CTRL_C  (1<<SIGBREAKB_CTRL_C)
  292 #define SIGBREAKF_CTRL_D  (1<<SIGBREAKB_CTRL_D)
  293 #define SIGBREAKF_CTRL_E  (1<<SIGBREAKB_CTRL_E)
  294 #define SIGBREAKF_CTRL_F  (1<<SIGBREAKB_CTRL_F)
  295 
  296 
  297 #define LOCK_DIFFERENT     -1
  298 #define LOCK_SAME           0
  299 #define LOCK_SAME_VOLUME    1
  300 #define LOCK_SAME_HANDLER   LOCK_SAME_VOLUME
  301 
  302 
  303 #define CHANGE_LOCK  0
  304 #define CHANGE_FH    1
  305 
  306 
  307 #define LINK_HARD  0
  308 #define LINK_SOFT  1
  309 
  310 
  311 #define ITEM_EQUAL     -2
  312 #define ITEM_ERROR     -1
  313 #define ITEM_NOTHING    0
  314 #define ITEM_UNQUOTED   1
  315 #define ITEM_QUOTED     2
  316 
  317 
  318 /*
  319  * AllocDosObject(),FreeDosObject()
  320  * Types
  321  */
  322 #define DOS_FILEHANDLE    0
  323 #define DOS_EXALLCONTROL  1
  324 #define DOS_FIB           2
  325 #define DOS_STDPKT        3
  326 #define DOS_CLI           4
  327 #define DOS_RDARGS        5
  328 /*** V51 (MorphOS) ***/
  329 #define DOS_DEVICENODE    6
  330 #define DOS_FSCONTEXT     7
  331 #define DOS_VOLUMENODE    8
  332 #define DOS_ASSIGNNODE    9
  333 
  334 
  335 #pragma pack()
  336 
  337 #endif /* DOS_DOS_H */