Added the functionlist section to the .conf of the libraries present in
[AROS.git] / workbench / libs / nonvolatile / getnvinfo.c
blobac7ca152509ec33f9b3a36878d8ac015677a8dc1
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
5 #include <dos/dosextens.h>
7 /*****************************************************************************
9 NAME */
11 #include <libraries/nonvolatile.h>
12 #include <exec/memory.h>
13 #include <proto/exec.h>
14 #include <proto/nvdisk.h>
15 #include "nonvolatile_intern.h"
18 AROS_LH1(struct NVInfo *, GetNVInfo,
20 /* SYNOPSIS */
22 AROS_LHA(BOOL, killRequesters, D1),
24 /* LOCATION */
26 struct Library *, nvBase, 9, Nonvolatile)
28 /* FUNCTION
30 Report information on the user's preferred nonvolatile storage device.
32 INPUTS
34 killRequesters -- if TRUE no system requesters will be displayed during
35 the operation of this function
37 RESULT
39 Pointer to an NVInfo structure containing the information on the nonvolatile
40 storage device currently in use. Returns NULL in case of a failure.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 FreeNVData(), StoreNV(), <libraries/nonvolatile.h>
52 INTERNALS
54 ******************************************************************************/
57 AROS_LIBFUNC_INIT
59 struct Process *me = (struct Process *)FindTask(NULL);
60 APTR oldReq = me->pr_WindowPtr;
61 struct NVInfo *info = AllocVec(sizeof(struct NVInfo), MEMF_ANY);
63 if(info == NULL)
64 return NULL;
66 if(killRequesters)
67 me->pr_WindowPtr = (APTR)-1;
69 /* Try to get the information from the HIDD */
70 if(MemInfo(info))
72 /* Round down to nearest 10 bytes */
73 info->nvi_MaxStorage = (info->nvi_MaxStorage/10)*10;
74 info->nvi_FreeStorage = (info->nvi_FreeStorage/10)*10;
76 else
78 FreeVec(info);
79 info = NULL;
82 if(killRequesters)
83 me->pr_WindowPtr = oldReq;
85 return info;
87 AROS_LIBFUNC_EXIT
88 } /* GetNVInfo */