From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6DBAAA0350; Wed, 1 Jul 2020 12:45:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 557351C434; Wed, 1 Jul 2020 12:45:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B57441C2DD for ; Wed, 1 Jul 2020 12:45:00 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 061AUR5h030978; Wed, 1 Jul 2020 03:44:59 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=5SqLsrU6KEikFkBiSQXSG17WRxmvq/9yqvZ2hSZjSPk=; b=fFo7XN14rBCvutfBsLsR/Ymlr2LcJglvH9XxFjzCHag5hF8DpEuvHb2xqE6cwwEh6I86 rLlWIBny/t/uBk+Nu8QBMDWoLyz+YoEld2wwLr/g5mBIssHsD+qVb1vNuPH0/XCwp8Sz 641YE7CA8v4Gfjbm00RnAffmn3xRa0iLkP3vg7FYYHYZrEmD5Sf2tt4WcjydGszMUFoI r2XY55GxKZ8zQlBKlE4pWqzvWuQYcnlx5zbaBKbT5UE7L7OlpxyhGZUaWRnqRjnW0WZC 8EjKmDiA/TPQO4F9PkleDPMPLzpwuYfJYE+i6g8V7dIg62usiqv07Jc9SdKP370w+g7U bg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 31x5mnr1gu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 01 Jul 2020 03:44:59 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Jul 2020 03:44:58 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 1 Jul 2020 03:44:58 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 1 Jul 2020 03:44:58 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id D8A183F703F; Wed, 1 Jul 2020 03:44:55 -0700 (PDT) From: To: CC: , , , , , Jerin Jacob Date: Wed, 1 Jul 2020 16:14:16 +0530 Message-ID: <20200701104428.4149689-2-jerinj@marvell.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701104428.4149689-1-jerinj@marvell.com> References: <20200701064828.4097247-1-jerinj@marvell.com> <20200701104428.4149689-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-01_07:2020-07-01, 2020-07-01 signatures=0 Subject: [dpdk-dev] [PATCH v4 01/13] eal/log: introduce log register macro X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob Introducing the RTE_LOG_REGISTER macro to avoid the code duplication in the log registration process. It is a wrapper macro for declaring the logtype, register the log and sets it's level in the constructor context. Signed-off-by: Jerin Jacob Acked-by: Adam Dybkowski --- lib/librte_eal/include/rte_log.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h index 1789ede56..eaf66e4f6 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -376,6 +376,30 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \ 0) +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Register a dynamic log type in constructor context with its name and level. + * + * It is a wrapper macro for declaring the logtype, register the log and + * sets it's level in the constructor context. + * + * @param type + * The log type identifier + * @param name + * Name for the log type to be registered + * @param level + * Log level. A value between EMERG (1) and DEBUG (8). + */ +#define RTE_LOG_REGISTER(type, name, level) \ +int type; \ +RTE_INIT(__##type) \ +{ \ + type = rte_log_register_type_and_pick_level(RTE_STR(name), \ + RTE_LOG_##level); \ +} + #ifdef __cplusplus } #endif -- 2.27.0