changeset 376:754e72d134a0

os_mem_fl.c: os_GetPartitionPoolStatus() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 09 Jun 2014 04:53:32 +0000
parents 1319bd1d5ac3
children d148403013c0
files gsm-fw/gpf/osl/os_mem_fl.c
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_mem_fl.c	Mon Jun 09 04:10:07 2014 +0000
+++ b/gsm-fw/gpf/osl/os_mem_fl.c	Mon Jun 09 04:53:32 2014 +0000
@@ -194,3 +194,32 @@
 	}
 	return (const ULONG *) &pool->pcb;
 }
+
+GLOBAL LONG
+os_GetPartitionPoolStatus(ULONG size, OS_HANDLE gr_hndl,
+			  USHORT *m_free, USHORT *m_alloc)
+{
+	T_OS_PART_POOL *pool;
+	UNSIGNED dummy, allocated, available;
+	CHAR Name[8];
+
+	for (pool = PartGrpTable[gr_hndl].grp_head; pool; pool = pool->next) {
+		if (!size)
+			break;
+		if (size > pool->size)
+			continue;
+		if (NU_Partition_Pool_Information(&pool->pcb, Name,
+						  (VOID **)&dummy, &dummy,
+						  &dummy, &available,
+						  &allocated, (OPTION *)&dummy,
+						  &dummy, (NU_TASK **)&dummy)
+				!= NU_SUCCESS)
+			break;
+		*m_alloc = allocated;
+		*m_free = available;
+		return(OS_OK);
+	}
+	*m_alloc = 0;
+	*m_free = 0;
+	return(OS_ERROR);
+}