Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp822994pxv; Wed, 14 Jul 2021 16:46:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE4m/s1j4BLHZYZwMaP04GWwnPe3eULJAVwdiC4rDGeDvJOfHBbvyHsXxXIMjEIMyTCNYz X-Received: by 2002:a17:907:20b7:: with SMTP id pw23mr817318ejb.198.1626306367795; Wed, 14 Jul 2021 16:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626306367; cv=none; d=google.com; s=arc-20160816; b=ogvpXYsNyeC6v1ZPBAwC27vqdTVpeGx5FEgYqlHXx/clC5YCUYNnFycoEm9ldkgu0e ntcKzbp7M7+NkZ78u+DxLn6lSOWyT9HGVSSvWxjNKYW/Ui+jkehlEypXY42EWKajSH/2 nkAyf0ZW8ZtFYmyy2wiu4dSC+7B30rA1eWzTISpZbzeTpT+gLTZO7kDG/3psdAUVbfOp JC5GsykLg6wPl9ekH1d5lirYMsEktC7pGp95KUARehNUaufOFrYdARw5+UKGS0/iAPqG 5C0XpUI/mPgUhobmWK3lYh43Nr6iX53taIJFLX6ibuecKWaENWSUZLYetVpOQLxDTvcg 0awg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=yiLHkdtCp5ZIHN+0y81kglG8LjPig5yv9jgGS+Eyn8w=; b=L61A+DRvY9vA/TEMGogY6hsHy9GLvpmZwpT5lkC8CNtuBCE53EDg49a2zvx1trhsvB 0A9jLOpf5kpQhkMQMBtv0RGtdLVfQeHZL3CIcPJfXtwSIt4gArt3cfSj9zH/6ENQjryt staCRrYqGw0P7PnEG+s+lqjEW+KoeitWt0P2RK4Y/P9PC/IKFUgij8lngmxhueIvD5xt EeVr4kfxhYIGRPzhbKc6A1kGktmdDvpreoZDH66o+bUdKRhDCilRCinnNXVpDxD2tvKf SjvsEbT+vw3c9XV9v90qL9CBLMMKhGX6H6Jr5crjVBsJbIJqCcoPjp5xVzprcPfvPo9X zRXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si5160828eje.551.2021.07.14.16.45.45; Wed, 14 Jul 2021 16:46:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236328AbhGNWGh (ORCPT + 99 others); Wed, 14 Jul 2021 18:06:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:43894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbhGNWGh (ORCPT ); Wed, 14 Jul 2021 18:06:37 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 782F8613A9; Wed, 14 Jul 2021 22:03:44 +0000 (UTC) Date: Wed, 14 Jul 2021 18:03:37 -0400 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Ingo Molnar , Andrew Morton , Chuck Lever Subject: Re: [GIT PULL] tracing: Add __string_len() and __assign_str_len() helpers Message-ID: <20210714180337.3e78394c@oasis.local.home> In-Reply-To: <20210714175633.3b53346a@oasis.local.home> References: <20210713171143.7784697e@oasis.local.home> <20210714175633.3b53346a@oasis.local.home> X-Mailer: Claws Mail 3.17.3 (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 Wed, 14 Jul 2021 17:56:33 -0400 Steven Rostedt wrote: > static inline notrace int trace_event_get_offsets_foo( > struct trace_event_data_offsets_foo *__data_offsets, const char *foobar, int len) > { > int __data_size = 0; > int __maybe_unused __item_length; > struct trace_event_raw_foo __maybe_unused *entry; > > // The "(len)+1" will be used to calculate the __item_length below > > __item_length = (len + 1) * sizeof(char); > > // the dynamic fields (strings and such) are located after the static > // fields in the trace event, and the offset is recorded in the bottom > // 16 bits of a 32 bit word, and the size in the top 16 bits. > > __data_offsets->item = __data_size + > offsetof(typeof(*entry), __data); > __data_offsets->item |= __item_length << 16; I missed a manual substitution of the macro. This should have been: __data_offsets->str = __data_size + offsetof(typeof(*entry), __data); __data_offsets->str |= __item_length << 16; As the macro creates the trace_event_data_offsets_foo structure (which __data_offsets is declared as), which contains a field for every __string/__string_len/__dynamic_array() in TP_STRUCT__entry. The -">str" comes from the "str" in "__string_len(str, foobar, len)". -- Steve > __data_size += __item_length; > > > // Each "__string_len()" or "__string()" in the TP_STRUCT__entry is inserted > // into this macro created function. Thus, the above code is duplicated for > // each field that uses __string(), __string_len() or __dynamic_array(). > > > return __data_size; > }