diff mbox

api/odp_shared_memory.h: add odp_shm_free

Message ID 1415304721-48632-1-git-send-email-mike.holmes@linaro.org
State Rejected
Headers show

Commit Message

Mike Holmes Nov. 6, 2014, 8:12 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/api/odp_shared_memory.h | 13 +++++++++++++
 platform/linux-generic/odp_shared_memory.c             |  6 ++++++
 2 files changed, 19 insertions(+)

Comments

Maxim Uvarov Nov. 6, 2014, 9:08 p.m. UTC | #1
On 11/06/2014 11:12 PM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   platform/linux-generic/include/api/odp_shared_memory.h | 13 +++++++++++++
>   platform/linux-generic/odp_shared_memory.c             |  6 ++++++
>   2 files changed, 19 insertions(+)
>
> diff --git a/platform/linux-generic/include/api/odp_shared_memory.h b/platform/linux-generic/include/api/odp_shared_memory.h
> index d8d40dd..1a59824 100644
> --- a/platform/linux-generic/include/api/odp_shared_memory.h
> +++ b/platform/linux-generic/include/api/odp_shared_memory.h
> @@ -72,6 +72,19 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
>   			  uint32_t flags);
>   
>   /**
> + * Free a contiguous block of shared memory
> + *
> + * Frees a previously reserved block of shared memory.
> + * @note Freeing memory that is in use will result in UNDEFINED behaviour.
> + *
> + * @param[in] shm Block handle
> + *
> + * @retval 0 for success
> + * @retval 1 on failure
> + */
> +int odp_shm_free(odp_shm_t shm);
> +
> +/**
>    * Lookup for a block of shared memory
>    *
>    * @param name   Name of the block
> diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
> index c770a80..479ea4d 100644
> --- a/platform/linux-generic/odp_shared_memory.c
> +++ b/platform/linux-generic/odp_shared_memory.c
> @@ -10,6 +10,7 @@
>   #include <odp_align.h>
>   #include <odp_system_info.h>
>   #include <odp_debug.h>
> +#include <odp_debug_internal.h>
>   
>   #include <unistd.h>
>   #include <sys/mman.h>
> @@ -219,6 +220,11 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
>   	return block->hdl;
>   }
>   
> +int odp_shm_free(odp_shm_t shmi ODP_UNUSED)
shmi? why not to implement this function? I think it's simple unmap of 
requested address.
> +{
> +	ODP_UNIMPLEMENTED();
> +	return 0;
> +}
>   
>   odp_shm_t odp_shm_lookup(const char *name)
>   {
Mike Holmes Nov. 6, 2014, 9:21 p.m. UTC | #2
On 6 November 2014 16:08, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 11/06/2014 11:12 PM, Mike Holmes wrote:
>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>   platform/linux-generic/include/api/odp_shared_memory.h | 13
>> +++++++++++++
>>   platform/linux-generic/odp_shared_memory.c             |  6 ++++++
>>   2 files changed, 19 insertions(+)
>>
>> diff --git a/platform/linux-generic/include/api/odp_shared_memory.h
>> b/platform/linux-generic/include/api/odp_shared_memory.h
>> index d8d40dd..1a59824 100644
>> --- a/platform/linux-generic/include/api/odp_shared_memory.h
>> +++ b/platform/linux-generic/include/api/odp_shared_memory.h
>> @@ -72,6 +72,19 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t
>> size, uint64_t align,
>>                           uint32_t flags);
>>     /**
>> + * Free a contiguous block of shared memory
>> + *
>> + * Frees a previously reserved block of shared memory.
>> + * @note Freeing memory that is in use will result in UNDEFINED
>> behaviour.
>> + *
>> + * @param[in] shm Block handle
>> + *
>> + * @retval 0 for success
>> + * @retval 1 on failure
>> + */
>> +int odp_shm_free(odp_shm_t shm);
>> +
>> +/**
>>    * Lookup for a block of shared memory
>>    *
>>    * @param name   Name of the block
>> diff --git a/platform/linux-generic/odp_shared_memory.c
>> b/platform/linux-generic/odp_shared_memory.c
>> index c770a80..479ea4d 100644
>> --- a/platform/linux-generic/odp_shared_memory.c
>> +++ b/platform/linux-generic/odp_shared_memory.c
>> @@ -10,6 +10,7 @@
>>   #include <odp_align.h>
>>   #include <odp_system_info.h>
>>   #include <odp_debug.h>
>> +#include <odp_debug_internal.h>
>>     #include <unistd.h>
>>   #include <sys/mman.h>
>> @@ -219,6 +220,11 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t
>> size, uint64_t align,
>>         return block->hdl;
>>   }
>>   +int odp_shm_free(odp_shm_t shmi ODP_UNUSED)
>>
> shmi?


Oh - I was in Vi, will fix it now.


> why not to implement this function? I think it's simple unmap of requested
> address.


Because establishing the API was my goal to get the ODP API complete, this
is in the vein of a sequence of small patches that lead to the result you
want.


>
>  +{
>> +       ODP_UNIMPLEMENTED();
>> +       return 0;
>> +}
>>     odp_shm_t odp_shm_lookup(const char *name)
>>   {
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_shared_memory.h b/platform/linux-generic/include/api/odp_shared_memory.h
index d8d40dd..1a59824 100644
--- a/platform/linux-generic/include/api/odp_shared_memory.h
+++ b/platform/linux-generic/include/api/odp_shared_memory.h
@@ -72,6 +72,19 @@  odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
 			  uint32_t flags);
 
 /**
+ * Free a contiguous block of shared memory
+ *
+ * Frees a previously reserved block of shared memory.
+ * @note Freeing memory that is in use will result in UNDEFINED behaviour.
+ *
+ * @param[in] shm Block handle
+ *
+ * @retval 0 for success
+ * @retval 1 on failure
+ */
+int odp_shm_free(odp_shm_t shm);
+
+/**
  * Lookup for a block of shared memory
  *
  * @param name   Name of the block
diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c
index c770a80..479ea4d 100644
--- a/platform/linux-generic/odp_shared_memory.c
+++ b/platform/linux-generic/odp_shared_memory.c
@@ -10,6 +10,7 @@ 
 #include <odp_align.h>
 #include <odp_system_info.h>
 #include <odp_debug.h>
+#include <odp_debug_internal.h>
 
 #include <unistd.h>
 #include <sys/mman.h>
@@ -219,6 +220,11 @@  odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
 	return block->hdl;
 }
 
+int odp_shm_free(odp_shm_t shmi ODP_UNUSED)
+{
+	ODP_UNIMPLEMENTED();
+	return 0;
+}
 
 odp_shm_t odp_shm_lookup(const char *name)
 {