2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Nonvolatile disk based storage library initialization code.
12 #include "nvdisk_intern.h"
14 #include <aros/debug.h>
16 #include <exec/types.h>
17 #include <exec/resident.h>
18 #include <proto/exec.h>
19 #include <proto/dos.h>
20 #include <devices/timer.h>
21 #include <aros/symbolsets.h>
23 #include <exec/libraries.h>
24 #include <exec/memory.h>
25 #include <exec/alerts.h>
26 #include LC_LIBDEFS_FILE
29 static int Init(LIBBASETYPEPTR LIBBASE
)
32 This function is single-threaded by exec by calling Forbid.
33 If you break the Forbid() another task may enter this function
34 at the same time. Take care.
37 BOOL error
= TRUE
; // Notice the initialization to 'TRUE' here.
41 D(bug("Init nvdisk.library\n"));
43 locFile
= Open("SYS:prefs/env-archive/sys/nv_location", MODE_OLDFILE
);
45 D(bug("Getting location\n"));
49 D(bug("Location file exists!\n"));
51 temp
= AllocVec(512, MEMF_CLEAR
);
55 int i
= 0; // Loop variable
57 Read(locFile
, temp
, 512);
59 // End string if a carriage return is encountered
71 nvdBase
->nvd_location
= Lock(temp
, SHARED_LOCK
);
73 D(bug("NV location = %s\n", temp
));
77 D(bug("Got lock = %p\n", nvdBase
->nvd_location
));
79 if(nvdBase
->nvd_location
!= NULL
)
91 static int Expunge(LIBBASETYPEPTR LIBBASE
)
94 This function is single-threaded by exec by calling Forbid.
95 Never break the Forbid() or strange things might happen.
98 UnLock(nvdBase
->nvd_location
);
103 ADD2INITLIB(Init
, 0);
104 ADD2EXPUNGELIB(Expunge
, 0);