]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_memory_management.h
Adapting FRSH to the new time types and synchronising headers with phase 2
[frescor/frsh-include.git] / frsh_memory_management.h
index e34d2936850e3e621e6befa35446c6a57ffb5a57..f173e1ce9610cd07b1c1e03a9b9bb96fe81b6538 100644 (file)
 #ifndef _FRSH_MEMORY_MANAGEMENT_H_
 #define _FRSH_MEMORY_MANAGEMENT_H_
 
-#include "frsh_fosa.h"
 #include "frsh_core_types.h"
 
 
 #define FRSH_MEMORY_MANAGEMENT_SUPPORTED 1
 
+FRSH_CPP_BEGIN_DECLS
+
 /**
- * @file frsh_memory_management
+ * @file frsh_memory_management.h
  **/
 
 /**
@@ -94,9 +95,9 @@
  **/
 
 /**
- * frsh_contract_set_memory_reqs()
+ * frsh_contract_set_min_memory()
  *
- * This function specifies in the contract the minimum and maximum
+ * This function specifies in the contract the minimum
  * memory needed by the application.
  *
  * @param[in] min_memory  Minimum needed memory in bytes.
  * @param  contract   Contract, in-out argument.
  *
  * @return 0 if no error \n
- *     FRSH_ERR_BAD_ARGUMENT if min_memory > max_memory
+ *     FRSH_ERR_BAD_ARGUMENT if min_memory <0
  * 
  **/
-int frsh_contract_set_memory_reqs(size_t min_memory,
-                                  size_t max_memory,
+int frsh_contract_set_min_memory(size_t min_memory,
                                   frsh_contract_t *contract);
 
 /**
- * frsh_contract_get_memory_reqs()
+ * frsh_contract_get_min_memory()
  *
- * This function gets the memory parameters from the contract.
+ * This function gets the minimum memory parameter from the contract.
  *
  * @param[in] contract Contract object
  * @param[out] min_memory  Placeholder for the minimum required
  *                         memory.
+ *
+ * @return 0 if no error \n
+ *      FRSH_ERR_BAD_ARGUMENT if one of the pointers is NULL
+ **/
+int frsh_contract_get_min_memory(const frsh_contract_t *contract,
+                                  size_t *min_memory);
+
+// frsh_contract_set_max_memory() is new 
+// frsh_contract_get_max_memory() is new
+
+/**
+ * frsh_contract_set_max_memory()
+ *
+ * This function specifies in the contract the minimum
+ * memory needed by the application.
+ *
+ * @param[in] max_memory  Maximum needed memory in bytes.
+ * @param  contract   Contract, in-out argument.
+ *
+ *     FRSH_ERR_BAD_ARGUMENT if min_memory > max_memory
+ * 
+ **/
+int frsh_contract_set_max_memory(size_t max_memory,
+                                  frsh_contract_t *contract);
+
+
+/**
+ * frsh_contract_get_max_memory()
+ *
+ * This function gets the maximum memory parameter from the contract.
+ *
+ * @param[in] contract Contract object
  * @param[out] max_memory  Placeholder for the maximum required
  *                         memory.
  *
  * @return 0 if no error \n
  *      FRSH_ERR_BAD_ARGUMENT if one of the pointers is NULL
  **/
-int frsh_contract_get_memory_reqs(const frsh_contract_t *contract,
-                                  size_t *min_memory,
+int frsh_contract_get_max_memory(const frsh_contract_t *contract,
                                   size_t *max_memory);
 
 
@@ -150,10 +181,10 @@ int frsh_vres_get_memory_info(frsh_vres_id_t vres_id,
 
 
 /**
- * frsh_vres_malloc()
+ * frsh_vres_memalloc()
  *
- * This function reserves some memory from the memory resource
- * represented by vres_id.
+ * This function reserves some memory from the memory to this virtual
+ * resource. 
  *
  * @param[in] vres_id Identifier of vres.
  * @param[in] Number of bytes
@@ -170,8 +201,8 @@ int frsh_vres_malloc(frsh_vres_id_t vres_id,
 /**
  * frsh_vres_memfree()
  *
- * This function returns the previously allocated memory area to the
- * memory resource represented by vres_id.
+ * This function returns the previously allocated memory area for this
+ * virtual_resource to the main memory.
  *
  * @param[in] vres_id Identifier of vres.
  * @param[in] area    Memory area to return
@@ -187,4 +218,6 @@ int frsh_vres_memfree(frsh_vres_id_t vres_id,
 
 /*@}*/
 
+FRSH_CPP_END_DECLS
+
 #endif             /* !FRSH_MEMORY_MANAGEMENT_H_ */