From patchwork Tue Jan 20 23:37:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 43428 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED1BC218DB for ; Tue, 20 Jan 2015 23:38:48 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id pv20sf8090213lab.3 for ; Tue, 20 Jan 2015 15:38:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=xyg2JkeQVpxD1LTYolyc+3Ms7ATehj2+sZe7/H4ZMjw=; b=I/rvQDK8dtBb5AVxthc2V3P+0KAN3ms+yDT2A9UyfOMkprA+CRGQxuAWbxGXN3zBrd pvYOMQm2dmbixQHh+XiNaeT4SF9wTELM6gCKnCOdG3pPdFwV8yYPWhtHJoxNNg0FnEuk cr1l/WFgzeeFmnYhkp3+P6P18sz9XIXW7m1VxxkrTBJX8uTgzl/Q5k3Xz5Dg+2SJuYLy xYj57/GukDqZOe0roJKQEkSk8EnSPEQqN7JOqj74T8X88s1iaGo2MaShMcmUjrx/ARyy EmP57RY3IKJOvI0LpuBdTGoEhfieiV6wBpl0J3p3ZwQji9HtzRCY9AJ1jA+UQR9wYNn6 j0XA== X-Gm-Message-State: ALoCoQmOc0sjUjVhDZcbf0pdFjwSLufvSfeEVfy7FN9OZ/UQJxdyGGA0rRUrQTkyPWr6dkesvzxm X-Received: by 10.112.143.167 with SMTP id sf7mr857465lbb.0.1421797127433; Tue, 20 Jan 2015 15:38:47 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.104 with SMTP id x8ls827170laj.4.gmail; Tue, 20 Jan 2015 15:38:47 -0800 (PST) X-Received: by 10.112.17.197 with SMTP id q5mr41366626lbd.30.1421797127223; Tue, 20 Jan 2015 15:38:47 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id h9si14383268lah.13.2015.01.20.15.38.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 15:38:47 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id z11so36473740lbi.10 for ; Tue, 20 Jan 2015 15:38:47 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr40573751lbb.2.1421797127145; Tue, 20 Jan 2015 15:38:47 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1587264lbb; Tue, 20 Jan 2015 15:38:46 -0800 (PST) X-Received: by 10.140.90.112 with SMTP id w103mr47872819qgd.65.1421797125812; Tue, 20 Jan 2015 15:38:45 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id q1si2385637qcc.24.2015.01.20.15.38.44 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Jan 2015 15:38:45 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDiNe-0003ya-SC; Tue, 20 Jan 2015 23:38:42 +0000 Received: from mail-qc0-f178.google.com ([209.85.216.178]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YDiNP-0003wN-Bi for lng-odp@lists.linaro.org; Tue, 20 Jan 2015 23:38:27 +0000 Received: by mail-qc0-f178.google.com with SMTP id b13so11168515qcw.9 for ; Tue, 20 Jan 2015 15:38:22 -0800 (PST) X-Received: by 10.229.201.6 with SMTP id ey6mr60220685qcb.20.1421797102186; Tue, 20 Jan 2015 15:38:22 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id 66sm8323596qgl.42.2015.01.20.15.38.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jan 2015 15:38:21 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Tue, 20 Jan 2015 18:37:58 -0500 Message-Id: <1421797078-14262-4-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1421797078-14262-1-git-send-email-mike.holmes@linaro.org> References: <1421797078-14262-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 4/4] api: move loging out of odp_debug X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Only odp_init needs the logging definitions so remove them from odp_debug.h Signed-off-by: Mike Holmes --- platform/linux-generic/include/api/odp_debug.h | 32 -------------------- platform/linux-generic/include/api/odp_init.h | 41 +++++++++++++++++++++++++- platform/linux-generic/include/odp_internal.h | 2 +- 3 files changed, 41 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..ac856df 100644 --- a/platform/linux-generic/include/api/odp_init.h +++ b/platform/linux-generic/include/api/odp_init.h @@ -29,13 +29,52 @@ extern "C" { #include -#include /** @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 an ODP + * implementation should be done via this function or its wrappers. + * + * The application can provide this function to the ODP implementation in two + * ways: + * + * - A callback passed in via in odp_init_t and odp_init_global() + * - By overriding the ODP implementation default log function + * odp_override_log(). + * + * @warning 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. + * + * @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 +#include struct odp_global_data { odp_log_func_t log_fn;