From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CC3CC433EF for ; Fri, 15 Jul 2022 21:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbiGOVo3 (ORCPT ); Fri, 15 Jul 2022 17:44:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiGOVo1 (ORCPT ); Fri, 15 Jul 2022 17:44:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A4842A273 for ; Fri, 15 Jul 2022 14:44:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5991619D2 for ; Fri, 15 Jul 2022 21:44:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 988D8C34115; Fri, 15 Jul 2022 21:44:23 +0000 (UTC) Date: Fri, 15 Jul 2022 17:44:22 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Arend van Spriel , Franky Lin , Hante Meuleman , Gregory Greenman , Peter Chen , Greg Kroah-Hartman , Mathias Nyman , Chunfeng Yun , Bin Liu , Marek Lindner , Simon Wunderlich , Antonio Quartulli , Sven Eckelmann , Johannes Berg , Jim Cromie Subject: Re: [PATCH 01/13 v2] tracing/events: Add __vstring() and __assign_vstr() helper macros Message-ID: <20220715174422.6bf21fc2@gandalf.local.home> In-Reply-To: <20220715174214.22314a87@gandalf.local.home> References: <20220705224453.120955146@goodmis.org> <20220705224749.053570613@goodmis.org> <20220715174214.22314a87@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Jul 2022 17:42:14 -0400 Steven Rostedt wrote: > It uses the helper: > > #define __trace_event_vstr_len(fmt, va) \ > ({ \ > va_list __ap; \ > int __ret; \ > \ > va_copy(__ap, *(va)); \ > __ret = vsnprintf(NULL, 0, fmt, __ap); \ > va_end(__ap); \ > \ > min(__ret, TRACE_EVENT_STR_MAX); \ > }) I forgot to mention what is different in v2. I fixed what happened to be in the change log, as there was an off by one error. I just updated the change log in my git repo to have the above be: It uses the helper: #define __trace_event_vstr_len(fmt, va) \ ({ \ va_list __ap; \ int __ret; \ \ va_copy(__ap, *(va)); \ __ret = vsnprintf(NULL, 0, fmt, __ap) + 1; \ va_end(__ap); \ \ min(__ret, TRACE_EVENT_STR_MAX); \ }) -- Steve