Default should stay as zero also in the future.

-Petri

From: ext Mike Holmes [mailto:[email protected]]
Sent: Thursday, October 23, 2014 4:49 PM
To: Savolainen, Petri (NSN - FI/Espoo)
Cc: [email protected]
Subject: Re: [lng-odp] [PATCH] odp_shared_memory.h: Document default value

So shouldn't we define  ODP_SHM_ANY 0, then an application could call to get 
that behaviour and if the default ever changes they will be covered.

On 23 October 2014 09:07, Savolainen, Petri (NSN - FI/Espoo) 
<[email protected]<mailto:[email protected]>> wrote:
0 means that application does not have any special requirements. Each special 
requirement is indicated by a flag. If you use shm with any ODP API and within 
the local ODP instance, it’s default behavior. Later on we may add more 
limitation/access right flags.

-Petri


From: ext Mike Holmes 
[mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, October 23, 2014 3:39 PM
To: Savolainen, Petri (NSN - FI/Espoo)
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [lng-odp] [PATCH] odp_shared_memory.h: Document default value

We need to document what 0 means to the user of the API, a document reader gets 
no information what behaviour to expect.
Describing that as code feels more accurate than writing a comment because an 
application wanting to make it explicit can use that flag and their code is 
then documented clearly which behaviour they expect.
If the default behaviour changes in future, having explicitly passed a flag 
describing the behaviour the app wants allows that app to continue working 
after the change.

Would it be better for the default to be the most restrictive and subsequent 
flags relax that, is wide open access the most prevalent case ?


On 23 October 2014 02:56, Savolainen, Petri (NSN - FI/Espoo) 
<[email protected]<mailto:[email protected]>> wrote:

Default is 0. It includes all current and future flags. There's no point to 
define ODP_SHM_SW_AND_HW, that's defined when the flag value does not include 
ODP_SHM_SW_ONLY. This is how flag parameters work in general.

-Petri

> -----Original Message-----
> From: 
> [email protected]<mailto:[email protected]> 
> [mailto:lng-odp-<mailto:lng-odp->
> [email protected]<mailto:[email protected]>] On Behalf Of ext 
> Mike Holmes
> Sent: Wednesday, October 22, 2014 10:50 PM
> To: [email protected]<mailto:[email protected]>
> Subject: [lng-odp] [PATCH] odp_shared_memory.h: Document default value
>
> Signed-off-by: Mike Holmes 
> <[email protected]<mailto:[email protected]>>
> ---
> Although adding the default description to the list of legal #defined
> values
> helps the reader understand what the default means, it looks like this
> could be more clearly coded as an enum.
>
>  platform/linux-generic/include/api/odp_shared_memory.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/include/api/odp_shared_memory.h
> b/platform/linux-generic/include/api/odp_shared_memory.h
> index d8d40dd..d2965af 100644
> --- a/platform/linux-generic/include/api/odp_shared_memory.h
> +++ b/platform/linux-generic/include/api/odp_shared_memory.h
> @@ -34,6 +34,7 @@ extern "C" {
>   */
>
>  /* Share level */
> +#define ODP_SHM_SW_AND_HW   0x0 /**< Both SW and HW acess */
>  #define ODP_SHM_SW_ONLY 0x1 /**< Application SW only, no HW access */
>  #define ODP_SHM_PROC    0x2 /**< Share with external processes */
>
> @@ -64,7 +65,7 @@ typedef struct odp_shm_info_t {
>   * @param name   Name of the block (maximum ODP_SHM_NAME_LEN - 1 chars)
>   * @param size   Block size in bytes
>   * @param align  Block alignment in bytes
> - * @param flags  Shared mem parameter flags (ODP_SHM_*). Default value is
> 0.
> + * @param flags  Shared mem parameter flags (ODP_SHM_*). Default value is
> ODP_SHM_SW_AND_HW
>   *
>   * @return Pointer to the reserved block, or NULL
>   */
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> [email protected]<mailto:[email protected]>
> http://lists.linaro.org/mailman/listinfo/lng-odp



--
Mike Holmes
Linaro  Sr Technical Manager
LNG - ODP



--
Mike Holmes
Linaro  Sr Technical Manager
LNG - ODP
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to