1 #include <devices/trackdisk.h>
3 #include <prefs/trackdisk.h>
4 #include <utility/tagitem.h>
6 #include <proto/exec.h>
8 #include "trackdiskprefs.h"
10 struct td_UnitPrefs TDPrefs
[TD_NUMUNITS
];
11 struct IORequest TDIO
;
16 struct TagItem PrefsBuf
;
19 cf
= Open(TRACKDISK_PREFS_NAME
, MODE_OLDFILE
);
22 while (FRead(cf
, &PrefsBuf
, sizeof(PrefsBuf
), 1)) {
23 if (PrefsBuf
.ti_Tag
== TDPR_UnitNum
)
24 Unit
= PrefsBuf
.ti_Data
;
26 if (Unit
< TD_NUMUNITS
) {
27 switch (PrefsBuf
.ti_Tag
)
30 TDPrefs
[Unit
].PubFlags
= PrefsBuf
.ti_Data
;
33 TDPrefs
[Unit
].RetryCnt
= PrefsBuf
.ti_Data
;
38 if (PrefsBuf
.ti_Tag
== TAG_DONE
)
45 void ReadTDPrefs(void)
48 struct TDU_PublicUnit
*tdu
;
50 for (i
= 0; i
< TD_NUMUNITS
; i
++) {
51 TDPrefs
[i
].PubFlags
= 0;
52 TDPrefs
[i
].RetryCnt
= 3;
55 for (i
= 0; i
< TD_NUMUNITS
; i
++) {
56 if (!OpenDevice("trackdisk.device", i
, &TDIO
, 0)) {
57 tdu
= (struct TDU_PublicUnit
*)TDIO
.io_Unit
;
58 tdu
->tdu_PubFlags
= TDPrefs
[i
].PubFlags
;
59 tdu
->tdu_RetryCnt
= TDPrefs
[i
].RetryCnt
;