From patchwork Thu Jan 29 22:52:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 43995 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 620E424128 for ; Thu, 29 Jan 2015 22:53:14 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf25013489lbj.0 for ; Thu, 29 Jan 2015 14:53:13 -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=ShdHHybJxdJ8ERhJehVEhKHm8pqXnk/6J9XgIy0E1gw=; b=WGWXxrHVCqCJjr86stHiwFp3hJLlNTS6d4A4b+/lhCKfRRLynbjdaEW3F37t0I2A/J ztQdym3MMFAdEMhdDgXMBijxSegeIit5nSpbWICYvFYoumXp/Xm7X1Bexd+wv+uDp5ea lEBSnEu0vIuGZLFz1h2h5gDFSkHhdSUZeKbIwyfdmfkrBYK3exL6kiJd5Xm0eu0jEsqH bZEfCSVB/J3OGibLeOm+b3ae+rPLa6bZ/W8Rs8i+ilUeAu2XpovVEGCbbljZDEA3QObr Fe3ah/tEJBiKg/Js0Qp6+x+MKV7ryvzoazDahn6i6EUcrNhtU5myjwWOhesu57IxOOkF Wd5Q== X-Gm-Message-State: ALoCoQkJNkc73kCz/gHvjEOSg0Zdg2R3UZaUZ4lqhEQKGmEvhiOHJeK1Y6jbGWZKrrbN8hloHCwE X-Received: by 10.112.30.131 with SMTP id s3mr427801lbh.13.1422571993346; Thu, 29 Jan 2015 14:53:13 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.193 with SMTP id le1ls370172lab.11.gmail; Thu, 29 Jan 2015 14:53:13 -0800 (PST) X-Received: by 10.152.5.101 with SMTP id r5mr3590274lar.33.1422571993202; Thu, 29 Jan 2015 14:53:13 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id q3si8223547lbh.43.2015.01.29.14.53.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 Jan 2015 14:53:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id p9so33478206lbv.8 for ; Thu, 29 Jan 2015 14:53:12 -0800 (PST) X-Received: by 10.152.203.230 with SMTP id kt6mr3657352lac.38.1422571992903; Thu, 29 Jan 2015 14:53:12 -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.35.133 with SMTP id h5csp95457lbj; Thu, 29 Jan 2015 14:53:12 -0800 (PST) X-Received: by 10.140.102.72 with SMTP id v66mr2677424qge.31.1422571991665; Thu, 29 Jan 2015 14:53:11 -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 s4si7115690qat.58.2015.01.29.14.53.10 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 29 Jan 2015 14:53:11 -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 1YGxxU-0008M1-IN; Thu, 29 Jan 2015 22:53:08 +0000 Received: from mail-qg0-f48.google.com ([209.85.192.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YGxxA-0008Kg-TZ for lng-odp@lists.linaro.org; Thu, 29 Jan 2015 22:52:48 +0000 Received: by mail-qg0-f48.google.com with SMTP id z60so35504163qgd.7 for ; Thu, 29 Jan 2015 14:52:43 -0800 (PST) X-Received: by 10.229.182.9 with SMTP id ca9mr6322126qcb.31.1422571963749; Thu, 29 Jan 2015 14:52:43 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws ([98.221.136.245]) by mx.google.com with ESMTPSA id q5sm8304624qat.47.2015.01.29.14.52.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jan 2015 14:52:43 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Thu, 29 Jan 2015 17:52:31 -0500 Message-Id: <1422571952-5132-4-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1422571952-5132-1-git-send-email-mike.holmes@linaro.org> References: <1422571952-5132-1-git-send-email-mike.holmes@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 4/5] api: init_global: allow abort fn to be overidden 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.177 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 Signed-off-by: Mike Holmes --- include/odp/api/init.h | 14 ++++++++++---- platform/linux-generic/odp_init.c | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/odp/api/init.h b/include/odp/api/init.h index c5b4e9b..6af032d 100644 --- a/include/odp/api/init.h +++ b/include/odp/api/init.h @@ -78,11 +78,16 @@ int odp_override_log(odp_log_level_e level, const char *fmt, ...); * Instead of directly calling abort, all abort calls in the implementation * should be done via this function or its wrappers. * - * An Application can override the ODP implementation default abort function - * odp_override_abort() by providing an alternative to this weak symbol. + * The application can provide this function to the ODP implementation in two + * ways: + * + * - A callback passed in via odp_init_t and odp_init_global() + * - By overriding the ODP implementation default abort function + * odp_override_abort(). * - * @warning The override option is not portable and GNU linker dependent - * (utilizes function attribute "weak"). + * @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. * * @warning this function shall not return */ @@ -101,6 +106,7 @@ typedef void (*odp_abort_func_t)(void) ODP_NORETURN; */ typedef struct odp_init_t { odp_log_func_t log_fn; + odp_abort_func_t abort_fn; } odp_init_t; /** ODP platform initialization data. diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index e91e910..74c893f 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -19,6 +19,8 @@ int odp_init_global(odp_init_t *params ODP_UNUSED, if (params != NULL) { if (params->log_fn != NULL) odp_global_data.log_fn = params->log_fn; + if (params->abort_fn != NULL) + odp_global_data.abort_fn = params->abort_fn; }