diff mbox

[4/4] api: move loging out of odp_debug

Message ID 1421632584-26181-5-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes Jan. 19, 2015, 1:56 a.m. UTC
Only odp_init needs the logging definitions so remove them from
odp_debug.h

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/api/odp_debug.h | 32 -----------------------
 platform/linux-generic/include/api/odp_init.h  | 36 +++++++++++++++++++++++++-
 platform/linux-generic/include/odp_internal.h  |  2 +-
 3 files changed, 36 insertions(+), 34 deletions(-)

Comments

Mike Holmes Jan. 20, 2015, 5 p.m. UTC | #1
On 20 January 2015 at 07:48, Savolainen, Petri (NSN - FI/Espoo) <
petri.savolainen@nsn.com> wrote:

>
>
> > -----Original Message-----
> > From: lng-odp-bounces@lists.linaro.org [mailto:lng-odp-
> > bounces@lists.linaro.org] On Behalf Of ext Mike Holmes
> > Sent: Monday, January 19, 2015 3:56 AM
> > To: lng-odp@lists.linaro.org
> > Subject: [lng-odp] [PATCH 4/4] api: move loging out of odp_debug
> >
> > Only odp_init needs the logging definitions so remove them from
> > odp_debug.h
> >
> > Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> > ---
> >  platform/linux-generic/include/api/odp_debug.h | 32
> ---------------------
> > --
> >  platform/linux-generic/include/api/odp_init.h  | 36
> > +++++++++++++++++++++++++-
> >  platform/linux-generic/include/odp_internal.h  |  2 +-
> >  3 files changed, 36 insertions(+), 34 deletions(-)
> >
> > diff --git a/platform/linux-generic/include/api/odp_debug.h
> > b/platform/linux-generic/include/api/odp_debug.h
> > index 4c32500..ce07e85 100644
> > --- a/platform/linux-generic/include/api/odp_debug.h
> > +++ b/platform/linux-generic/include/api/odp_debug.h
> > @@ -48,38 +48,6 @@ extern "C" {
> >  #define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
> >
> >  /**
> > - * ODP log level.
> > - */
> > -typedef enum odp_log_level {
> > -     ODP_LOG_DBG,
> > -     ODP_LOG_ERR,
> > -     ODP_LOG_UNIMPLEMENTED,
> > -     ODP_LOG_ABORT,
> > -     ODP_LOG_PRINT
> > -} odp_log_level_e;
> > -
> > -/**
> > - * ODP log function
> > - *
> > - * Instead of direct prints to stdout/stderr all logging in ODP
> > implementation
> > - * should be done via this function or its wrappers.
> > - * ODP platform MUST provide a default *weak* implementation of this
> > function.
> > - * Application MAY override the function if needed by providing a strong
> > - * function.
> > - *
> > - * @param[in] level   Log level
> > - * @param[in] fmt     printf-style message format
> > - *
> > - * @return The number of characters logged if succeeded. Otherwise
> > returns
> > - *         a negative number.
> > - */
> > -extern int odp_override_log(odp_log_level_e level, const char *fmt,
> ...);
> > -
> > -
> > -/** Replaceable logging function */
> > -typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt,
> > ...);
> > -
> > -/**
> >   * @}
> >   */
> >
> > diff --git a/platform/linux-generic/include/api/odp_init.h
> > b/platform/linux-generic/include/api/odp_init.h
> > index 73c4a3b..b0ea316 100644
> > --- a/platform/linux-generic/include/api/odp_init.h
> > +++ b/platform/linux-generic/include/api/odp_init.h
> > @@ -29,13 +29,47 @@ extern "C" {
> >
> >
> >  #include <odp_std_types.h>
> > -#include <odp_debug.h>
> >
> >  /** @defgroup odp_initialization ODP INITIALIZATION
> >   *  Initialisation operations.
> >   *  @{
> >   */
> >
> > +/**
> > + * ODP log level.
> > + */
> > +typedef enum odp_log_level {
> > +     ODP_LOG_DBG,
> > +     ODP_LOG_ERR,
> > +     ODP_LOG_UNIMPLEMENTED,
> > +     ODP_LOG_ABORT,
> > +     ODP_LOG_PRINT
> > +} odp_log_level_e;
> > +
> > +/**
> > + * ODP log function
> > + *
> > + * Instead of direct prints to stdout/stderr all logging in ODP
> > implementation
> > + * should be done via this function or its wrappers.
>
> I think the callback and weak methods should be documented better,
> something like this:
>
> "User can provide this function to the ODP implementation in two ways: as
> a callback in odp_init_t or by overriding the ODP implementation default
> log
> function (odp_override_log()). The latter option is less portable and GNU
> linker
> dependent (utilizes function attribute "weak"). If both are defined, the
> odp_init_t function pointer has priority over the override function."
>
>
>
Sure, I will add some more text


> > + * ODP platform MUST provide a default *weak* implementation of this
> > function.
> > + * Application MAY override the function if needed by providing a strong
> > + * function.
>
> ... and maybe these notes can be removed then.
>
> > + *
> > + * @warning The use of the weak replacement is not as portable as using
> > the
> > + * odp_init_global() function parmiters.
>
> Typo: "parameters"
>
>
>
Will fix


> -Petri
>
>
> > + *
> > + * @param[in] level   Log level
> > + * @param[in] fmt     printf-style message format
> > + *
> > + * @return The number of characters logged if succeeded. Otherwise
> > returns
> > + *         a negative number.
> > + */
> > +int odp_override_log(odp_log_level_e level, const char *fmt, ...);
> > +
> > +
> > +/** Replaceable logging function */
> > +typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt,
> > ...);
> > +
> >  /** ODP initialization data.
> >   * Data that is required to initialize the ODP API with the
> >   * application specific data such as specifying a logging callback, the
> > log
> > diff --git a/platform/linux-generic/include/odp_internal.h
> > b/platform/linux-generic/include/odp_internal.h
> > index 7401a30..07c9f60 100644
> > --- a/platform/linux-generic/include/odp_internal.h
> > +++ b/platform/linux-generic/include/odp_internal.h
> > @@ -18,7 +18,7 @@
> >  extern "C" {
> >  #endif
> >
> > -#include <odp_debug.h>
> > +#include <odp_init.h>
> >
> >  struct odp_global_data {
> >       odp_log_func_t log_fn;
> > --
> > 2.1.0
> >
> >
> > _______________________________________________
> > lng-odp mailing list
> > lng-odp@lists.linaro.org
> > http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_debug.h b/platform/linux-generic/include/api/odp_debug.h
index 4c32500..ce07e85 100644
--- a/platform/linux-generic/include/api/odp_debug.h
+++ b/platform/linux-generic/include/api/odp_debug.h
@@ -48,38 +48,6 @@  extern "C" {
 #define _ODP_STATIC_ASSERT(cond, msg)  _Static_assert(cond, msg)
 
 /**
- * ODP log level.
- */
-typedef enum odp_log_level {
-	ODP_LOG_DBG,
-	ODP_LOG_ERR,
-	ODP_LOG_UNIMPLEMENTED,
-	ODP_LOG_ABORT,
-	ODP_LOG_PRINT
-} odp_log_level_e;
-
-/**
- * ODP log function
- *
- * Instead of direct prints to stdout/stderr all logging in ODP implementation
- * should be done via this function or its wrappers.
- * ODP platform MUST provide a default *weak* implementation of this function.
- * Application MAY override the function if needed by providing a strong
- * function.
- *
- * @param[in] level   Log level
- * @param[in] fmt     printf-style message format
- *
- * @return The number of characters logged if succeeded. Otherwise returns
- *         a negative number.
- */
-extern int odp_override_log(odp_log_level_e level, const char *fmt, ...);
-
-
-/** Replaceable logging function */
-typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
-
-/**
  * @}
  */
 
diff --git a/platform/linux-generic/include/api/odp_init.h b/platform/linux-generic/include/api/odp_init.h
index 73c4a3b..b0ea316 100644
--- a/platform/linux-generic/include/api/odp_init.h
+++ b/platform/linux-generic/include/api/odp_init.h
@@ -29,13 +29,47 @@  extern "C" {
 
 
 #include <odp_std_types.h>
-#include <odp_debug.h>
 
 /** @defgroup odp_initialization ODP INITIALIZATION
  *  Initialisation operations.
  *  @{
  */
 
+/**
+ * ODP log level.
+ */
+typedef enum odp_log_level {
+	ODP_LOG_DBG,
+	ODP_LOG_ERR,
+	ODP_LOG_UNIMPLEMENTED,
+	ODP_LOG_ABORT,
+	ODP_LOG_PRINT
+} odp_log_level_e;
+
+/**
+ * ODP log function
+ *
+ * Instead of direct prints to stdout/stderr all logging in ODP implementation
+ * should be done via this function or its wrappers.
+ * ODP platform MUST provide a default *weak* implementation of this function.
+ * Application MAY override the function if needed by providing a strong
+ * function.
+ *
+ * @warning The use of the weak replacement is not as portable as using the
+ * odp_init_global() function parmiters.
+ *
+ * @param[in] level   Log level
+ * @param[in] fmt     printf-style message format
+ *
+ * @return The number of characters logged if succeeded. Otherwise returns
+ *         a negative number.
+ */
+int odp_override_log(odp_log_level_e level, const char *fmt, ...);
+
+
+/** Replaceable logging function */
+typedef int (*odp_log_func_t)(odp_log_level_e level, const char *fmt, ...);
+
 /** ODP initialization data.
  * Data that is required to initialize the ODP API with the
  * application specific data such as specifying a logging callback, the log
diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h
index 7401a30..07c9f60 100644
--- a/platform/linux-generic/include/odp_internal.h
+++ b/platform/linux-generic/include/odp_internal.h
@@ -18,7 +18,7 @@ 
 extern "C" {
 #endif
 
-#include <odp_debug.h>
+#include <odp_init.h>
 
 struct odp_global_data {
 	odp_log_func_t log_fn;