Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / nonvolatile / getnvinfo.c
blob46de5ddf30a7f5648c1a17bed7c80ddc2535d97e
1 /*
2 Copyright © 1995-2006, 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>
17 AROS_LH1(struct NVInfo *, GetNVInfo,
19 /* SYNOPSIS */
21 AROS_LHA(BOOL, killRequesters, D1),
23 /* LOCATION */
25 struct Library *, nvBase, 9, Nonvolatile)
27 /* FUNCTION
29 Report information on the user's preferred nonvolatile storage device.
31 INPUTS
33 killRequesters -- if TRUE no system requesters will be displayed during
34 the operation of this function
36 RESULT
38 Pointer to an NVInfo structure containing the information on the nonvolatile
39 storage device currently in use. Returns NULL in case of a failure.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 FreeNVData(), StoreNV(), <libraries/nonvolatile.h>
51 INTERNALS
53 ******************************************************************************/
56 AROS_LIBFUNC_INIT
58 struct Process *me = (struct Process *)FindTask(NULL);
59 APTR oldReq = me->pr_WindowPtr;
60 struct NVInfo *info = AllocVec(sizeof(struct NVInfo), MEMF_ANY);
62 if(info == NULL)
63 return NULL;
65 if(killRequesters)
66 me->pr_WindowPtr = (APTR)-1;
68 /* Try to get the information from the HIDD */
69 if(MemInfo(info))
71 /* Round down to nearest 10 bytes */
72 info->nvi_MaxStorage = (info->nvi_MaxStorage/10)*10;
73 info->nvi_FreeStorage = (info->nvi_FreeStorage/10)*10;
75 else
77 FreeVec(info);
78 info = NULL;
81 if(killRequesters)
82 me->pr_WindowPtr = oldReq;
84 return info;
86 AROS_LIBFUNC_EXIT
87 } /* GetNVInfo */