[lng-odp] [RFC v2 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Jerin Jacob
Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com
---
 include/odp/api/rwlock.h   | 11 +
 .../linux-generic/include/odp/plat/rwlock_types.h  | 48 ++
 platform/linux-generic/include/odp/rwlock.h|  2 +
 3 files changed, 52 insertions(+), 9 deletions(-)
 create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
index 950b83a..d730a70 100644
--- a/include/odp/api/rwlock.h
+++ b/include/odp/api/rwlock.h
@@ -13,8 +13,6 @@
  * ODP RW Locks
  */
 
-#include odp/atomic.h
-
 #ifdef __cplusplus
 extern C {
 #endif
@@ -29,14 +27,9 @@ extern C {
  */
 
 /**
- * The odp_rwlock_t type.
+ * @typedef odp_rwlock_t
+ * ODP rwlock
  */
-typedef struct {
-   odp_atomic_u32_t cnt; /** @private lock count
-   0 lock not taken
-   -1 write lock taken
-   0 read lock(s) taken */
-} odp_rwlock_t;
 
 
 /**
diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h 
b/platform/linux-generic/include/odp/plat/rwlock_types.h
new file mode 100644
index 000..bd46e57
--- /dev/null
+++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP rwlock
+ */
+
+#ifndef ODP_RWLOCK_TYPES_H_
+#define ODP_RWLOCK_TYPES_H_
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+#include odp/atomic.h
+
+/**
+ * @internal
+ * ODP rwlock
+ */
+struct odp_rwlock_s {
+   odp_atomic_u32_t cnt; /** lock count
+   0 lock not taken
+   -1 write lock taken
+   0 read lock(s) taken */
+};
+
+/** @addtogroup odp_synchronizers
+ *  @{
+ */
+
+typedef struct odp_rwlock_s odp_rwlock_t;
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/odp/rwlock.h 
b/platform/linux-generic/include/odp/rwlock.h
index 06320f6..ca88ff7 100644
--- a/platform/linux-generic/include/odp/rwlock.h
+++ b/platform/linux-generic/include/odp/rwlock.h
@@ -17,6 +17,8 @@
 extern C {
 #endif
 
+#include odp/plat/rwlock_types.h
+
 /** @ingroup odp_synchronizers
  *  @{
  */
-- 
2.1.0


___
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp


Re: [lng-odp] [RFC v2 2/4] rwlock: allow platform to override odp_rwlock_t

2015-03-17 Thread Bill Fischofer
This part also fails make distcheck with error:

  CC   odp_classification.lo
In file included from
../../../platform/linux-generic/include/odp_packet_io_internal.h:21:0,
 from
../../../platform/linux-generic/odp_classification.c:15:
../../../platform/linux-generic/include/odp/spinlock.h:20:37: fatal error:
odp/plat/spinlock_types.h: No such file or directory
 #include odp/plat/spinlock_types.h
 ^
compilation terminated.

On Tue, Mar 17, 2015 at 5:11 AM, Jerin Jacob jerin.ja...@caviumnetworks.com
 wrote:

 Signed-off-by: Jerin Jacob jerin.ja...@caviumnetworks.com
 ---
  include/odp/api/rwlock.h   | 11 +
  .../linux-generic/include/odp/plat/rwlock_types.h  | 48
 ++
  platform/linux-generic/include/odp/rwlock.h|  2 +
  3 files changed, 52 insertions(+), 9 deletions(-)
  create mode 100644 platform/linux-generic/include/odp/plat/rwlock_types.h

 diff --git a/include/odp/api/rwlock.h b/include/odp/api/rwlock.h
 index 950b83a..d730a70 100644
 --- a/include/odp/api/rwlock.h
 +++ b/include/odp/api/rwlock.h
 @@ -13,8 +13,6 @@
   * ODP RW Locks
   */

 -#include odp/atomic.h
 -
  #ifdef __cplusplus
  extern C {
  #endif
 @@ -29,14 +27,9 @@ extern C {
   */

  /**
 - * The odp_rwlock_t type.
 + * @typedef odp_rwlock_t
 + * ODP rwlock
   */
 -typedef struct {
 -   odp_atomic_u32_t cnt; /** @private lock count
 -   0 lock not taken
 -   -1 write lock taken
 -   0 read lock(s) taken */
 -} odp_rwlock_t;


  /**
 diff --git a/platform/linux-generic/include/odp/plat/rwlock_types.h
 b/platform/linux-generic/include/odp/plat/rwlock_types.h
 new file mode 100644
 index 000..bd46e57
 --- /dev/null
 +++ b/platform/linux-generic/include/odp/plat/rwlock_types.h
 @@ -0,0 +1,48 @@
 +/* Copyright (c) 2015, Linaro Limited
 + * All rights reserved.
 + *
 + * SPDX-License-Identifier: BSD-3-Clause
 + */
 +
 +
 +/**
 + * @file
 + *
 + * ODP rwlock
 + */
 +
 +#ifndef ODP_RWLOCK_TYPES_H_
 +#define ODP_RWLOCK_TYPES_H_
 +
 +#ifdef __cplusplus
 +extern C {
 +#endif
 +
 +#include odp/atomic.h
 +
 +/**
 + * @internal
 + * ODP rwlock
 + */
 +struct odp_rwlock_s {
 +   odp_atomic_u32_t cnt; /** lock count
 +   0 lock not taken
 +   -1 write lock taken
 +   0 read lock(s) taken */
 +};
 +
 +/** @addtogroup odp_synchronizers
 + *  @{
 + */
 +
 +typedef struct odp_rwlock_s odp_rwlock_t;
 +
 +/**
 + * @}
 + */
 +
 +#ifdef __cplusplus
 +}
 +#endif
 +
 +#endif
 diff --git a/platform/linux-generic/include/odp/rwlock.h
 b/platform/linux-generic/include/odp/rwlock.h
 index 06320f6..ca88ff7 100644
 --- a/platform/linux-generic/include/odp/rwlock.h
 +++ b/platform/linux-generic/include/odp/rwlock.h
 @@ -17,6 +17,8 @@
  extern C {
  #endif

 +#include odp/plat/rwlock_types.h
 +
  /** @ingroup odp_synchronizers
   *  @{
   */
 --
 2.1.0


 ___
 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