2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <dos/dosextens.h>
8 #include <proto/exec.h>
9 #include <proto/nvdisk.h>
13 #include LC_LIBDEFS_FILE
15 /*****************************************************************************
18 #include <libraries/nonvolatile.h>
20 AROS_LH5(LONG
, StoreNV
,
24 AROS_LHA(STRPTR
, appName
, A0
),
25 AROS_LHA(STRPTR
, itemName
, A1
),
26 AROS_LHA(APTR
, data
, A2
),
27 AROS_LHA(ULONG
, length
, D0
),
28 AROS_LHA(BOOL
, killRequesters
, D1
),
32 struct Library
*, nvBase
, 7, Nonvolatile
)
36 Save data in the nonvolatile storage.
40 appName -- the application to save an item in the nonvolatile
42 itemName -- the name of the item to save
43 data -- the data to save
44 length -- number of tens of bytes of the data to save rounded
45 upwards (for instance to save 24 bytes specify 3).
46 killRequesters -- if TRUE no system requesters will be displayed during
47 the operation of this function
51 Indication of the success of the operation
54 NVERR_BADNAME -- 'appName' or 'itemName' were not correctly
56 NVERR_WRITEPROT -- the nonvolatile storage is read only
57 NVERR_FAIL -- failure in data saving (storage is full or write
59 NVERR_FATAL -- fatal error (possible loss of previously saved
64 The strings 'appName' and 'itemName' should be descripive but short as the
65 size of the nonvolatile storage may be very limited. The strings may not
66 contatin the characters ':' or '/'. The maximum length for each of these
75 GetCopyNV(), GetNVInfo()
79 ******************************************************************************/
84 struct Process
*me
= (struct Process
*)FindTask(NULL
);
85 APTR oldReq
= me
->pr_WindowPtr
;
89 return NVERR_FAIL
; /* There is no good (defined) error to
92 if(appName
== NULL
|| itemName
== NULL
)
95 if(strpbrk(appName
, ":/") != NULL
||
96 strpbrk(itemName
, ":/") != NULL
)
100 me
->pr_WindowPtr
= (APTR
)-1;
102 // kprintf("Calling writedata");
104 retval
= WriteNVDData(appName
, itemName
, data
, length
*10);
107 me
->pr_WindowPtr
= oldReq
;