From patchwork Thu Oct 20 18:28:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Hostetler X-Patchwork-Id: 13013934 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 262E8C433FE for ; Thu, 20 Oct 2022 18:28:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230286AbiJTS2g (ORCPT ); Thu, 20 Oct 2022 14:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbiJTS2U (ORCPT ); Thu, 20 Oct 2022 14:28:20 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 784351F5263 for ; Thu, 20 Oct 2022 11:28:18 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id j7so478987wrr.3 for ; Thu, 20 Oct 2022 11:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=49A0L1wMbmU0RvsqsmDPtIsptTiM40AWpEgBd9ZjT4Y=; b=lI5jqdCSD0SZ0skzA3+nC/K9c1iq49so+jfUKK//ECEjne4+Yc2xrxZp27hZVjDiET a8eKpgAwUkL1dsTTRtUFWHxdqIfsNMXFW9ReSKJwoNVh8OFBuX2E1Eo8Sm9revjJB4ml T+ludZqp5uk1Ybvplm3Zo6beaCFpDD6Cd3JZ/IBIreB9ASRMCCWJv/6QlVFz+8MgLnZV uDXBAAfN/hzamM+Ts1trVYYPHQCw1dwIEqRAk8tv68wcFrVrQe7e5G51en/HTEJv8eC6 bz/HUgokF+rvfupgPQP0Brz09FGgBsgN7Rnd1OBBuNAlNcGjlaXbLhvXFi0S17RQsrzo YUEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=49A0L1wMbmU0RvsqsmDPtIsptTiM40AWpEgBd9ZjT4Y=; b=t1ICD02ZCjrIJNOMfcqC52HayB4brdePUTEENZTqf0K2BR2dEvTh3uNdlE4wT8BW0i TPQRG47tVg332/RVpFYf9gSItalAiXng3cLDG1z3RmPR6Tr7Kq3h2hN0F/ud98P5kQgE 55xvVwatF4XO4aQnH8bPKcWIcGrAuUPynliS9f7uF3MG3/85ifDQ6kp+2e+IaRP6Mzr3 Mi0iaMm8TXIULMUDhd6xWzRERcprvz90oqgF8qO6BHY4Tu5+w/Ny4rBD8h/IGpVEhMwM OGksdGwvkbd4Fy0U9tqpmi/AmcRiBdG2vYm4s0QouzUjaahQ/uLkH3AbClpV3PZLQFuR 7Bag== X-Gm-Message-State: ACrzQf0oDr90gBBXHEQMp3k/mtIK8UR+8hQUIYVePMxQPF9wlL4zyKKh BcFXSv9KPpsn6yx8SOyIfl7E0UWN4k4= X-Google-Smtp-Source: AMsMyM5oMDLEiqWshullOADthCszy4CUufJA3AxAyIwJSiZVir/ywMWggNOu3BPtdc2vJJY/rlDiBA== X-Received: by 2002:adf:d228:0:b0:22e:488d:758f with SMTP id k8-20020adfd228000000b0022e488d758fmr9236394wrh.445.1666290496592; Thu, 20 Oct 2022 11:28:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id v1-20020adfedc1000000b00228daaa84aesm17220295wro.25.2022.10.20.11.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:28:16 -0700 (PDT) Message-Id: <8a89e1aa238bff874f3fa9a414781e4abc03c526.1666290489.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 20 Oct 2022 18:28:07 +0000 Subject: [PATCH v3 6/8] trace2: convert ctx.thread_name from strbuf to pointer Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Jeff Hostetler , Derrick Stolee , Jeff Hostetler , Jeff Hostetler Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jeff Hostetler From: Jeff Hostetler Convert the `tr2tls_thread_ctx.thread_name` field from a `strbuf` to a "const char*" pointer. The `thread_name` field is a constant string that is constructed when the context is created. Using a (non-const) `strbuf` structure for it caused some confusion in the past because it implied that someone could rename a thread after it was created. That usage was not intended. Change it to a const pointer to make the intent more clear. Signed-off-by: Jeff Hostetler --- trace2/tr2_tgt_event.c | 2 +- trace2/tr2_tgt_perf.c | 2 +- trace2/tr2_tls.c | 16 +++++++++------- trace2/tr2_tls.h | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 37a3163be12..52f9356c695 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -90,7 +90,7 @@ static void event_fmt_prepare(const char *event_name, const char *file, jw_object_string(jw, "event", event_name); jw_object_string(jw, "sid", tr2_sid_get()); - jw_object_string(jw, "thread", ctx->thread_name.buf); + jw_object_string(jw, "thread", ctx->thread_name); /* * In brief mode, only emit