Re: [Mesa-dev] [RFC libdrm 3/5] android: Mark alloc_handle_t magic variable as const

2017-12-13 Thread Rob Herring
On Wed, Dec 13, 2017 at 11:30 AM, Robert Foss  wrote:
> Mark magic member of alloc_handle_t as const.
> Also bump the version of alloc_handle_t.
>
> Sign-off-by: Robert Foss 
> ---
>  android/alloc_handle.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/android/alloc_handle.h b/android/alloc_handle.h
> index b722615638e7..fe93ad7e6567 100644
> --- a/android/alloc_handle.h
> +++ b/android/alloc_handle.h
> @@ -32,7 +32,7 @@ struct alloc_handle_t {
> native_handle_t base;
>
> /* api variables */
> -   int magic; /* differentiate between allocator impls */
> +   const int magic; /* differentiate between allocator impls */
> const int version; /* api version */
>
> int prime_fd; /* dma-buf file descriptor */
> @@ -52,7 +52,7 @@ struct alloc_handle_t {
> } __attribute__((aligned(8)));
>  };
>
> -#define ALLOC_HANDLE_VERSION 1
> +#define ALLOC_HANDLE_VERSION 2

I don't think bumping the version here is necessary. Users can only be
directly accessing the member and no run-time version checking would
fix the compile time breakage. IOW, this isn't a backwards compatible
change, so a version check is not going to help. Plus, it's highly
unlikely any user modifies magic.

Rob
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [RFC libdrm 3/5] android: Mark alloc_handle_t magic variable as const

2017-12-13 Thread Robert Foss
Mark magic member of alloc_handle_t as const.
Also bump the version of alloc_handle_t.

Sign-off-by: Robert Foss 
---
 android/alloc_handle.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/alloc_handle.h b/android/alloc_handle.h
index b722615638e7..fe93ad7e6567 100644
--- a/android/alloc_handle.h
+++ b/android/alloc_handle.h
@@ -32,7 +32,7 @@ struct alloc_handle_t {
native_handle_t base;
 
/* api variables */
-   int magic; /* differentiate between allocator impls */
+   const int magic; /* differentiate between allocator impls */
const int version; /* api version */
 
int prime_fd; /* dma-buf file descriptor */
@@ -52,7 +52,7 @@ struct alloc_handle_t {
} __attribute__((aligned(8)));
 };
 
-#define ALLOC_HANDLE_VERSION 1
+#define ALLOC_HANDLE_VERSION 2
 #define ALLOC_HANDLE_MAGIC 0x60585350
 #define ALLOC_HANDLE_NUM_FDS 1
 #define ALLOC_HANDLE_NUM_INTS (\
-- 
2.14.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev