2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /*****************************************************************************
13 #include "nvdisk_intern.h"
15 #include <proto/dos.h>
16 #include <libraries/nonvolatile.h>
19 AROS_LH4(LONG
, WriteNVDData
,
23 AROS_LHA(STRPTR
, appName
, A0
),
24 AROS_LHA(STRPTR
, itemName
, A1
),
25 AROS_LHA(APTR
, data
, A2
),
26 AROS_LHA(LONG
, length
, A3
),
30 struct Library
*, nvdBase
, 6, NVDisk
)
34 Write data to the nonvolatile memory.
38 appName -- the name of the application owning the data
39 itemName -- the name of the data to write
40 data -- the data to write
41 length -- the size of the data in bytes
53 nonvolatile.library/StoreNV()
59 November 2000, SDuvan -- implemeneted
61 ******************************************************************************/
67 BPTR oldCDir
= CurrentDir(GPB(nvdBase
)->nvd_location
);
68 BPTR lock
= Lock(appName
, SHARED_LOCK
);
73 lock
= CreateDir(appName
);
78 if(err
== ERROR_WRITE_PROTECTED
||
79 err
== ERROR_DISK_WRITE_PROTECTED
)
80 return NVERR_WRITEPROT
;
86 /* 'lock' is now containing a valid lock on the 'appName' directory. */
90 file
= Open(itemName
, MODE_NEWFILE
);
99 if(Write(file
, data
, length
) == -1)
101 retval
= NVERR_FATAL
;