diff mbox

move typedefs to odp_types.h and plat/odp_types.h

Message ID 1400767872-11823-1-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell May 22, 2014, 2:11 p.m. UTC
A start to move all typedefs to one file odp_types.h and
move the platform specific stuff into plat/odp_types.h
This will remove the cross referencing fom platform back to include.
Only from top include to platform.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---

This patch should be applied ontop of Taras patchset ([LNG] [RFC PATCH 00/17]
Split out platform-specific values from header files)
http://lists.linaro.org/pipermail/lng-odp/2014-April/000539.html
The drawback for this are that we are putting all the typdefs into one file.


 include/odp_atomic.h                             | 17 +--------
 include/odp_types.h                              | 44 ++++++++++++++++++++++++
 platform/linux-generic/include/plat/odp_atomic.h | 21 +----------
 platform/linux-generic/include/plat/odp_types.h  | 40 +++++++++++++++++++++
 4 files changed, 86 insertions(+), 36 deletions(-)
 create mode 100644 include/odp_types.h
 create mode 100644 platform/linux-generic/include/plat/odp_types.h

Comments

Bill Fischofer May 22, 2014, 4:23 p.m. UTC | #1
I like this structure change.  +1

Bill


On Thu, May 22, 2014 at 9:11 AM, Anders Roxell <anders.roxell@linaro.org>wrote:

> A start to move all typedefs to one file odp_types.h and
> move the platform specific stuff into plat/odp_types.h
> This will remove the cross referencing fom platform back to include.
> Only from top include to platform.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>
> This patch should be applied ontop of Taras patchset ([LNG] [RFC PATCH
> 00/17]
> Split out platform-specific values from header files)
> http://lists.linaro.org/pipermail/lng-odp/2014-April/000539.html
> The drawback for this are that we are putting all the typdefs into one
> file.
>
>
>  include/odp_atomic.h                             | 17 +--------
>  include/odp_types.h                              | 44
> ++++++++++++++++++++++++
>  platform/linux-generic/include/plat/odp_atomic.h | 21 +----------
>  platform/linux-generic/include/plat/odp_types.h  | 40
> +++++++++++++++++++++
>  4 files changed, 86 insertions(+), 36 deletions(-)
>  create mode 100644 include/odp_types.h
>  create mode 100644 platform/linux-generic/include/plat/odp_types.h
>
> diff --git a/include/odp_atomic.h b/include/odp_atomic.h
> index 439e804..b381b04 100644
> --- a/include/odp_atomic.h
> +++ b/include/odp_atomic.h
> @@ -19,24 +19,9 @@ extern "C" {
>  #endif
>
>
> -#include <odp_std_types.h>
> +#include <odp_types.h>
>  #include <plat/odp_atomic.h>
>
> -/**
> - * Atomic integer
> - */
> -typedef plat_odp_atomic_int_t odp_atomic_int_t;
> -
> -/**
> - * Atomic unsigned integer 64 bits
> - */
> -typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
> -
> -/**
> - * Atomic unsigned integer 32 bits
> - */
> -typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
> -
>
>  /**
>   * Initialize atomic integer
> diff --git a/include/odp_types.h b/include/odp_types.h
> new file mode 100644
> index 0000000..11ae229
> --- /dev/null
> +++ b/include/odp_types.h
> @@ -0,0 +1,44 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP types
> + */
> +
> +#ifndef ODP_TYPES_H_
> +#define ODP_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include <odp_std_types.h>
> +#include <plat/odp_types.h>
> +
> +/**
> + * Atomic integer
> + */
> +typedef plat_odp_atomic_int_t odp_atomic_int_t;
> +
> +
> +/**
> + * Atomic unsigned integer 64 bits
> + */
> +typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
> +
> +/**
> + * Atomic unsigned integer 32 bits
> + */
> +typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/platform/linux-generic/include/plat/odp_atomic.h
> b/platform/linux-generic/include/plat/odp_atomic.h
> index 52a672a..ce39dae 100644
> --- a/platform/linux-generic/include/plat/odp_atomic.h
> +++ b/platform/linux-generic/include/plat/odp_atomic.h
> @@ -15,26 +15,7 @@
>  #error This file should be included only into corresponding top level
> header
>  #else
>
> -/**
> - * Atomic integer
> - */
> -typedef volatile int32_t plat_odp_atomic_int_t;
> -
> -/**
> - * Atomic unsigned integer 64 bits
> - */
> -typedef volatile uint64_t plat_odp_atomic_u64_t;
> -
> -/**
> - * Atomic unsigned integer 32 bits
> - */
> -typedef volatile uint32_t plat_odp_atomic_u32_t;
> -
> -/* Define OPD types here to use them in inline functions below */
> -typedef plat_odp_atomic_int_t odp_atomic_int_t;
> -typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
> -typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
> -
> +#include <odp_types.h>
>
>  static inline void odp_atomic_init_int(odp_atomic_int_t *ptr)
>  {
> diff --git a/platform/linux-generic/include/plat/odp_types.h
> b/platform/linux-generic/include/plat/odp_types.h
> new file mode 100644
> index 0000000..29924ae
> --- /dev/null
> +++ b/platform/linux-generic/include/plat/odp_types.h
> @@ -0,0 +1,40 @@
> +/* Copyright (c) 2014, Linaro Limited
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier:     BSD-3-Clause
> + */
> +
> +
> +/**
> + * @file
> + *
> + * ODP platform types
> + */
> +
> +#ifndef ODP_PLAT_TYPES_H_
> +#define ODP_PLAT_TYPES_H_
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +/**
> + * Atomic integer
> + */
> +typedef volatile int plat_odp_atomic_int_t;
> +
> +/**
> + * Atomic unsigned integer 64 bits
> + */
> +typedef volatile uint64_t plat_odp_atomic_u64_t;
> +
> +/**
> + * Atomic unsigned integer 32 bits
> + */
> +typedef volatile uint32_t plat_odp_atomic_u32_t;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov May 23, 2014, 9:15 a.m. UTC | #2
Taras can you take this patch to new version of your patches?

Maxim.

On 05/22/2014 08:23 PM, Bill Fischofer wrote:
> I like this structure change.  +1
>
> Bill
>
>
> On Thu, May 22, 2014 at 9:11 AM, Anders Roxell 
> <anders.roxell@linaro.org <mailto:anders.roxell@linaro.org>> wrote:
>
>     A start to move all typedefs to one file odp_types.h and
>     move the platform specific stuff into plat/odp_types.h
>     This will remove the cross referencing fom platform back to include.
>     Only from top include to platform.
>
>     Signed-off-by: Anders Roxell <anders.roxell@linaro.org
>     <mailto:anders.roxell@linaro.org>>
>     ---
>
>     This patch should be applied ontop of Taras patchset ([LNG] [RFC
>     PATCH 00/17]
>     Split out platform-specific values from header files)
>     http://lists.linaro.org/pipermail/lng-odp/2014-April/000539.html
>     The drawback for this are that we are putting all the typdefs into
>     one file.
>
>
>      include/odp_atomic.h                             | 17 +--------
>      include/odp_types.h                              | 44
>     ++++++++++++++++++++++++
>      platform/linux-generic/include/plat/odp_atomic.h | 21 +----------
>      platform/linux-generic/include/plat/odp_types.h  | 40
>     +++++++++++++++++++++
>      4 files changed, 86 insertions(+), 36 deletions(-)
>      create mode 100644 include/odp_types.h
>      create mode 100644 platform/linux-generic/include/plat/odp_types.h
>
>     diff --git a/include/odp_atomic.h b/include/odp_atomic.h
>     index 439e804..b381b04 100644
>     --- a/include/odp_atomic.h
>     +++ b/include/odp_atomic.h
>     @@ -19,24 +19,9 @@ extern "C" {
>      #endif
>
>
>     -#include <odp_std_types.h>
>     +#include <odp_types.h>
>      #include <plat/odp_atomic.h>
>
>     -/**
>     - * Atomic integer
>     - */
>     -typedef plat_odp_atomic_int_t odp_atomic_int_t;
>     -
>     -/**
>     - * Atomic unsigned integer 64 bits
>     - */
>     -typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
>     -
>     -/**
>     - * Atomic unsigned integer 32 bits
>     - */
>     -typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
>     -
>
>      /**
>       * Initialize atomic integer
>     diff --git a/include/odp_types.h b/include/odp_types.h
>     new file mode 100644
>     index 0000000..11ae229
>     --- /dev/null
>     +++ b/include/odp_types.h
>     @@ -0,0 +1,44 @@
>     +/* Copyright (c) 2014, Linaro Limited
>     + * All rights reserved.
>     + *
>     + * SPDX-License-Identifier:     BSD-3-Clause
>     + */
>     +
>     +
>     +/**
>     + * @file
>     + *
>     + * ODP types
>     + */
>     +
>     +#ifndef ODP_TYPES_H_
>     +#define ODP_TYPES_H_
>     +
>     +#ifdef __cplusplus
>     +extern "C" {
>     +#endif
>     +
>     +#include <odp_std_types.h>
>     +#include <plat/odp_types.h>
>     +
>     +/**
>     + * Atomic integer
>     + */
>     +typedef plat_odp_atomic_int_t odp_atomic_int_t;
>     +
>     +
>     +/**
>     + * Atomic unsigned integer 64 bits
>     + */
>     +typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
>     +
>     +/**
>     + * Atomic unsigned integer 32 bits
>     + */
>     +typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
>     +
>     +#ifdef __cplusplus
>     +}
>     +#endif
>     +
>     +#endif
>     diff --git a/platform/linux-generic/include/plat/odp_atomic.h
>     b/platform/linux-generic/include/plat/odp_atomic.h
>     index 52a672a..ce39dae 100644
>     --- a/platform/linux-generic/include/plat/odp_atomic.h
>     +++ b/platform/linux-generic/include/plat/odp_atomic.h
>     @@ -15,26 +15,7 @@
>      #error This file should be included only into corresponding top
>     level header
>      #else
>
>     -/**
>     - * Atomic integer
>     - */
>     -typedef volatile int32_t plat_odp_atomic_int_t;
>     -
>     -/**
>     - * Atomic unsigned integer 64 bits
>     - */
>     -typedef volatile uint64_t plat_odp_atomic_u64_t;
>     -
>     -/**
>     - * Atomic unsigned integer 32 bits
>     - */
>     -typedef volatile uint32_t plat_odp_atomic_u32_t;
>     -
>     -/* Define OPD types here to use them in inline functions below */
>     -typedef plat_odp_atomic_int_t odp_atomic_int_t;
>     -typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
>     -typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
>     -
>     +#include <odp_types.h>
>
>      static inline void odp_atomic_init_int(odp_atomic_int_t *ptr)
>      {
>     diff --git a/platform/linux-generic/include/plat/odp_types.h
>     b/platform/linux-generic/include/plat/odp_types.h
>     new file mode 100644
>     index 0000000..29924ae
>     --- /dev/null
>     +++ b/platform/linux-generic/include/plat/odp_types.h
>     @@ -0,0 +1,40 @@
>     +/* Copyright (c) 2014, Linaro Limited
>     + * All rights reserved.
>     + *
>     + * SPDX-License-Identifier:     BSD-3-Clause
>     + */
>     +
>     +
>     +/**
>     + * @file
>     + *
>     + * ODP platform types
>     + */
>     +
>     +#ifndef ODP_PLAT_TYPES_H_
>     +#define ODP_PLAT_TYPES_H_
>     +
>     +#ifdef __cplusplus
>     +extern "C" {
>     +#endif
>     +
>     +/**
>     + * Atomic integer
>     + */
>     +typedef volatile int plat_odp_atomic_int_t;
>     +
>     +/**
>     + * Atomic unsigned integer 64 bits
>     + */
>     +typedef volatile uint64_t plat_odp_atomic_u64_t;
>     +
>     +/**
>     + * Atomic unsigned integer 32 bits
>     + */
>     +typedef volatile uint32_t plat_odp_atomic_u32_t;
>     +
>     +#ifdef __cplusplus
>     +}
>     +#endif
>     +
>     +#endif
>     --
>     1.9.1
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto: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
Taras Kondratiuk May 26, 2014, 8:54 a.m. UTC | #3
On 05/23/2014 12:15 PM, Maxim Uvarov wrote:
> Taras can you take this patch to new version of your patches?

I'll be able to proceed with these patches only after June's sprint.
During the sprint we can spend some time to discuss it.
Taras Kondratiuk May 26, 2014, 9:03 a.m. UTC | #4
On 05/23/2014 12:57 PM, Savolainen, Petri (NSN - FI/Espoo) wrote:
> I don’t like it. It obscures relation between APIs. Includes carry
> information. E.g. odp_packet.h includes odp_buffer.h (depends on it),
> not the other way around.

I agree this approach has some drawbacks, but IMO it is better than 
current state. Let's discuss it during sprint.

> Also nearly half of the APIs are type/structure/union/constant
> definitions. The common type header file would need to include those
> also,  and would be half away from a single - big odp.h file after that.

Currently most of type/structure/union/constant definitions are not
part of API. They are platform dependent, but current headers' structure
doesn't highlight this.
Maxim Uvarov May 26, 2014, 12:24 p.m. UTC | #5
On 05/26/2014 12:54 PM, Taras Kondratiuk wrote:
> On 05/23/2014 12:15 PM, Maxim Uvarov wrote:
>> Taras can you take this patch to new version of your patches?
>
> I'll be able to proceed with these patches only after June's sprint.
> During the sprint we can spend some time to discuss it.
>
Good. Sounds like a plan.

Maxim.
diff mbox

Patch

diff --git a/include/odp_atomic.h b/include/odp_atomic.h
index 439e804..b381b04 100644
--- a/include/odp_atomic.h
+++ b/include/odp_atomic.h
@@ -19,24 +19,9 @@  extern "C" {
 #endif
 
 
-#include <odp_std_types.h>
+#include <odp_types.h>
 #include <plat/odp_atomic.h>
 
-/**
- * Atomic integer
- */
-typedef plat_odp_atomic_int_t odp_atomic_int_t;
-
-/**
- * Atomic unsigned integer 64 bits
- */
-typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
-
-/**
- * Atomic unsigned integer 32 bits
- */
-typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
-
 
 /**
  * Initialize atomic integer
diff --git a/include/odp_types.h b/include/odp_types.h
new file mode 100644
index 0000000..11ae229
--- /dev/null
+++ b/include/odp_types.h
@@ -0,0 +1,44 @@ 
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP types
+ */
+
+#ifndef ODP_TYPES_H_
+#define ODP_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <odp_std_types.h>
+#include <plat/odp_types.h>
+
+/**
+ * Atomic integer
+ */
+typedef plat_odp_atomic_int_t odp_atomic_int_t;
+
+
+/**
+ * Atomic unsigned integer 64 bits
+ */
+typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
+
+/**
+ * Atomic unsigned integer 32 bits
+ */
+typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-generic/include/plat/odp_atomic.h b/platform/linux-generic/include/plat/odp_atomic.h
index 52a672a..ce39dae 100644
--- a/platform/linux-generic/include/plat/odp_atomic.h
+++ b/platform/linux-generic/include/plat/odp_atomic.h
@@ -15,26 +15,7 @@ 
 #error This file should be included only into corresponding top level header
 #else
 
-/**
- * Atomic integer
- */
-typedef volatile int32_t plat_odp_atomic_int_t;
-
-/**
- * Atomic unsigned integer 64 bits
- */
-typedef volatile uint64_t plat_odp_atomic_u64_t;
-
-/**
- * Atomic unsigned integer 32 bits
- */
-typedef volatile uint32_t plat_odp_atomic_u32_t;
-
-/* Define OPD types here to use them in inline functions below */
-typedef plat_odp_atomic_int_t odp_atomic_int_t;
-typedef plat_odp_atomic_u64_t odp_atomic_u64_t;
-typedef plat_odp_atomic_u32_t odp_atomic_u32_t;
-
+#include <odp_types.h>
 
 static inline void odp_atomic_init_int(odp_atomic_int_t *ptr)
 {
diff --git a/platform/linux-generic/include/plat/odp_types.h b/platform/linux-generic/include/plat/odp_types.h
new file mode 100644
index 0000000..29924ae
--- /dev/null
+++ b/platform/linux-generic/include/plat/odp_types.h
@@ -0,0 +1,40 @@ 
+/* Copyright (c) 2014, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP platform types
+ */
+
+#ifndef ODP_PLAT_TYPES_H_
+#define ODP_PLAT_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Atomic integer
+ */
+typedef volatile int plat_odp_atomic_int_t;
+
+/**
+ * Atomic unsigned integer 64 bits
+ */
+typedef volatile uint64_t plat_odp_atomic_u64_t;
+
+/**
+ * Atomic unsigned integer 32 bits
+ */
+typedef volatile uint32_t plat_odp_atomic_u32_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif