Forgotten changes that should have been part of the r45368 64-bit fix.
[AROS.git] / rom / filesys / CDVDFS / src / prefs.c
blob4bc5f69b6e1bd874a8f5b91c14bc84c8d05ace7b
1 #include <dos/dosextens.h>
2 #include <dos/dostags.h>
3 #include <proto/dos.h>
4 #include <proto/exec.h>
5 #include <string.h>
7 #include "charset.h"
8 #include "debug.h"
9 #include "globals.h"
10 #include "prefs.h"
11 #include "aros_stuff.h"
13 void SAVEDS Prefs_Process (void)
15 ULONG Sigset;
16 struct CDVDBase *global;
17 struct MsgPort *mp;
18 struct Message *msg;
20 mp = &((struct Process *)FindTask(NULL))->pr_MsgPort;
21 WaitPort(mp);
22 msg = GetMsg(mp);
23 global = (APTR)msg->mn_Node.ln_Name;
25 BUG(dbprintf(global, "Prefs handler process started for CDVDBase %p\n", global);)
26 ReplyMsg(msg);
31 * Init character set translation only from within here
32 * because this can trigger loading some files from disk,
33 * which in turn can trigger new requests to our handler.
35 InitCharset(global);
38 * TODO:
39 * 1. In future this process will be responsible for reading
40 * preferences file from disk.
41 * 2. For AROS we need some way to trigger late codesets.library
42 * initialization. CDVDFS is mounder before SYS: is available.
45 Sigset = Wait(SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D);
46 } while (!(Sigset & SIGBREAKF_CTRL_C));
48 Forbid();
49 PutMsg(global->Dback,&global->DummyMsg); /* Kill handshake */
52 static struct TagItem const PrefsProcTags[] = {
53 {NP_Entry, (IPTR)Prefs_Process},
54 {NP_Name, (IPTR)"CDVDFS prefs monitor"},
55 #ifdef __mc68000
56 {NP_StackSize, 4096},
57 #endif
58 #ifdef __MORPHOS__
59 {NP_CodeType, CODETYPE_PPC},
60 #endif
61 { TAG_DONE }
64 void Prefs_Init (struct CDVDBase *global)
67 global->PrefsProc = (struct Task *)CreateNewProc(PrefsProcTags);
68 if (global->PrefsProc) {
69 global->DummyMsg.mn_ReplyPort = global->Dback;
70 global->DummyMsg.mn_Node.ln_Name = (APTR)global;
71 PutMsg(&((struct Process *)global->PrefsProc)->pr_MsgPort, &global->DummyMsg);
72 WaitPort(global->Dback); /* handshake startup */
73 GetMsg(global->Dback); /* remove dummy msg */
77 void Prefs_Uninit (struct CDVDBase *global)
79 if (global->PrefsProc)
81 Signal(global->PrefsProc, SIGBREAKF_CTRL_C);
82 WaitPort(global->Dback); /* He's dead jim! */
83 GetMsg(global->Dback);
84 Delay(100); /* ensure he's dead */