diff mbox

[PATCHv7] api: odp_shared_memory.h: updated return descriptions

Message ID 1423143662-13969-1-git-send-email-ola.liljedahl@linaro.org
State Accepted
Commit a481d0627e3e830ca5a85f8b1ffbfb663ca42afe
Headers show

Commit Message

Ola Liljedahl Feb. 5, 2015, 1:41 p.m. UTC
Also corrected return description of odp_shm_reserve(), it returns
ODP_SHM_INVALID (not NULL) on failure.

Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 include/odp/api/shared_memory.h | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

Maxim Uvarov Feb. 8, 2015, 2:28 p.m. UTC | #1
Merged,

Maxim.

On 02/05/2015 04:45 PM, Savolainen, Petri (NSN - FI/Espoo) wrote:
> Reviewed-by: Petri Savolainen <petri.savolainen@linaro.org>
>
> -Petri
>
>> -----Original Message-----
>> From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-
>> bounces@lists.linaro.org] On Behalf Of ext Ola Liljedahl
>> Sent: Thursday, February 05, 2015 3:41 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [PATCHv7] api: odp_shared_memory.h: updated return
>> descriptions
>>
>> Also corrected return description of odp_shm_reserve(), it returns
>> ODP_SHM_INVALID (not NULL) on failure.
>>
>> Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
>> ---
>> (This document/code contribution attached is provided under the terms of
>> agreement LES-LTM-21309)
>>
>>   include/odp/api/shared_memory.h | 18 +++++++++++-------
>>   1 file changed, 11 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/odp/api/shared_memory.h
>> b/include/odp/api/shared_memory.h
>> index d4445f7..8d8df3f 100644
>> --- a/include/odp/api/shared_memory.h
>> +++ b/include/odp/api/shared_memory.h
>> @@ -71,7 +71,8 @@ typedef struct odp_shm_info_t {
>>    * @param[in] flags  Shared memory parameter flags (ODP_SHM_*).
>>    *                   Default value is 0.
>>    *
>> - * @return Pointer to the reserved block, or NULL
>> + * @return Handle of the reserved block
>> + * @retval ODP_SHM_INVALID on failure
>>    */
>>   odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t
>> align,
>>   			  uint32_t flags);
>> @@ -84,9 +85,8 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t
>> size, uint64_t align,
>>    *
>>    * @param[in] shm Block handle
>>    *
>> - * @retval 0 if the handle is already free
>> - * @retval 0 if the handle free succeeds
>> - * @retval -1 on failure to free the handle
>> + * @retval 0 on success
>> + * @retval <0 on failure
>>    */
>>   int odp_shm_free(odp_shm_t shm);
>>
>> @@ -96,7 +96,7 @@ int odp_shm_free(odp_shm_t shm);
>>    * @param[in] name   Name of the block
>>    *
>>    * @return A handle to the block if it is found by name
>> - * @retval #ODP_SHM_INVALID if the block is not found
>> + * @retval ODP_SHM_INVALID on failure
>>    */
>>   odp_shm_t odp_shm_lookup(const char *name);
>>
>> @@ -106,18 +106,22 @@ odp_shm_t odp_shm_lookup(const char *name);
>>    *
>>    * @param[in] shm   Block handle
>>    *
>> - * @return Memory block address, or NULL on error
>> + * @return Memory block address
>> + * @retval NULL on failure
>>    */
>>   void *odp_shm_addr(odp_shm_t shm);
>>
>>
>>   /**
>>    * Shared memory block info
>> + * @note This is the only shared memory API function which accepts
>> invalid
>> + * shm handles (any bit value) without causing undefined behavior.
>>    *
>>    * @param[in]  shm   Block handle
>>    * @param[out] info  Block info pointer for output
>>    *
>> - * @return 0 on success, otherwise non-zero
>> + * @retval 0 on success
>> + * @retval <0 on failure
>>    */
>>   int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info);
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/include/odp/api/shared_memory.h b/include/odp/api/shared_memory.h
index d4445f7..8d8df3f 100644
--- a/include/odp/api/shared_memory.h
+++ b/include/odp/api/shared_memory.h
@@ -71,7 +71,8 @@  typedef struct odp_shm_info_t {
  * @param[in] flags  Shared memory parameter flags (ODP_SHM_*).
  *                   Default value is 0.
  *
- * @return Pointer to the reserved block, or NULL
+ * @return Handle of the reserved block
+ * @retval ODP_SHM_INVALID on failure
  */
 odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
 			  uint32_t flags);
@@ -84,9 +85,8 @@  odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align,
  *
  * @param[in] shm Block handle
  *
- * @retval 0 if the handle is already free
- * @retval 0 if the handle free succeeds
- * @retval -1 on failure to free the handle
+ * @retval 0 on success
+ * @retval <0 on failure
  */
 int odp_shm_free(odp_shm_t shm);
 
@@ -96,7 +96,7 @@  int odp_shm_free(odp_shm_t shm);
  * @param[in] name   Name of the block
  *
  * @return A handle to the block if it is found by name
- * @retval #ODP_SHM_INVALID if the block is not found
+ * @retval ODP_SHM_INVALID on failure
  */
 odp_shm_t odp_shm_lookup(const char *name);
 
@@ -106,18 +106,22 @@  odp_shm_t odp_shm_lookup(const char *name);
  *
  * @param[in] shm   Block handle
  *
- * @return Memory block address, or NULL on error
+ * @return Memory block address
+ * @retval NULL on failure
  */
 void *odp_shm_addr(odp_shm_t shm);
 
 
 /**
  * Shared memory block info
+ * @note This is the only shared memory API function which accepts invalid
+ * shm handles (any bit value) without causing undefined behavior.
  *
  * @param[in]  shm   Block handle
  * @param[out] info  Block info pointer for output
  *
- * @return 0 on success, otherwise non-zero
+ * @retval 0 on success
+ * @retval <0 on failure
  */
 int odp_shm_info(odp_shm_t shm, odp_shm_info_t *info);