From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5745BA0547; Mon, 8 Feb 2021 23:40:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D2129160744; Mon, 8 Feb 2021 23:40:36 +0100 (CET) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by mails.dpdk.org (Postfix) with ESMTP id CD1F416073F for ; Mon, 8 Feb 2021 23:40:35 +0100 (CET) Received: by mail-lj1-f170.google.com with SMTP id a22so3907353ljp.10 for ; Mon, 08 Feb 2021 14:40:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tbe/20ZKO7Rtv4mHCKG9HPRdHqHLt+4iabKmcanVXTA=; b=mtNrAzm+9NoM21OqBysfs6/ZGonVo571H5/vYX34KaeV9Dro++9CukHkFffiBcCYsN W62WBQ9vtvR/ELaqKFEudw0Pn3CSNXS1oNObw7ljliZJ9SX6ufsDRKPNw7A6Qd9VbWaS kSaaSXEYKk0a9cfTd+u8YsGf88KwZinxlithhp7S6r42Uo5Rcc/xmYP3i2WSyx0FdJSD uDJnEc7o+63IiqLYrgScOL03ckTOgoDDEH083Mpxp9xCwCNTzScLns0nEP6WSRg+TlQL H+EzxF0JpNQsyZEzssTKue3RwyM/D4c4nmef55xFiUu8OFJ5HkytRYMyKMPp2CCu8GAp we5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tbe/20ZKO7Rtv4mHCKG9HPRdHqHLt+4iabKmcanVXTA=; b=hHJ65Ga9jvQpssh3Pc0bHm+duRL5uNUMABFeJddAms5pmg7eGdVEk3rlJa7Qkb3qL1 E5i9FbZXiaubjuW74u92yj9gxXdwrtirJ+TVFOk1zPJp/hLTq9gHUa+I/xtjSxKcnojC bGeBBUofBMcmz+lKYyc7xRQsYYrMXnb7QWas8+Z9rkUOkd/nYReDFsBO7F2qicu1oaIA yA649FO2bF20BXs4+SfZzqSG0YoDlBFnYqzIzjnEstExs5mCOkw1SbBTVhtTuJjCDULR Q8DQZTR1x8XUPihY0A9kglGZVw0a0mJLlV8EoiozUH837sWgTiWSVvWQqiHAwQziOHMG sdIw== X-Gm-Message-State: AOAM530ZPs8prGgssL4f5p/yDWIsF/1mR5JUdZQuHIxyFW6tutnec3HF 0FxgNPMTv64ZzEgFz5Txqpg= X-Google-Smtp-Source: ABdhPJzO6Q+862BqzknYkJ4bzvQz52uvtMBGAZVmtQslo2aTpUfu0pc82eFkRnVK7bOSf2ItpZhfEg== X-Received: by 2002:a2e:6c0b:: with SMTP id h11mr2211129ljc.151.1612824035300; Mon, 08 Feb 2021 14:40:35 -0800 (PST) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id y1sm2242243lfd.115.2021.02.08.14.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 14:40:34 -0800 (PST) Date: Tue, 9 Feb 2021 01:40:33 +0300 From: Dmitry Kozlyuk To: Feng Li Cc: Li Feng , dev , David Marchand , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Message-ID: <20210209014033.30b55ae2@sovereign> In-Reply-To: References: <20210205112433.1681853-1-fengli@smartx.com> <20210205174204.1878089-1-fengli@smartx.com> <20210205223207.7fbf82ba@sovereign> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] log: support custom log function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" On Mon, 8 Feb 2021 14:58:29 +0800, Feng Li wrote: > > > +/** > > > + * Usage function typedef used by the application usage function. > > > > It's unrelated to the following typedef purpose, is it? > It's borrowed from the front typedef sentence. Doesn't make much sense here anyway. > > > + * > > > + * Use this function typedef to define a logger formatter. > > > + */ > > > +typedef cookie_write_function_t rte_log_func_t; > > > > "cookie_write_function_t" is not standard C, please write this type > > explicitly. POSIX reserves "_t" suffix, "rte_" prefix is enough. > Fix to this? > typedef cookie_write_function_t rte_cookie_write_function; You cannot expose "cookie_write_function_t" in public API, because it is not portable. You have to write out the type in full. I'd replace "cookie" with "log". > void rte_log_sink_set(rte_cookie_write_function* cookie_write); > rte_cookie_write_function* rte_log_sink_get(); > Right? OK. > > > +void > > > +rte_eal_set_log_func(rte_log_func_t *logf) > > > +{ > > > + console_log_func.write = logf; > > > +} Is this correct? AFAIK, updating the member has no effect, unless you call fopencookie() with an updated structure. Your new callbacks don't seem to be integrated with DPDK logging system for all platforms ("eal_common_log.c", "windows/eal_log.c"). If the new API and rte_openlog_stream() cancel effect of each other, this should be documented.