From patchwork Mon Jun 20 00:42:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 12886923 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65419C433EF for ; Mon, 20 Jun 2022 00:43:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 057F48D0005; Sun, 19 Jun 2022 20:43:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F23368D0001; Sun, 19 Jun 2022 20:43:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9D178D0005; Sun, 19 Jun 2022 20:43:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C80208D0001 for ; Sun, 19 Jun 2022 20:43:44 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9EB6E206AB for ; Mon, 20 Jun 2022 00:43:44 +0000 (UTC) X-FDA: 79596766368.19.A82E7AD Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf20.hostedemail.com (Postfix) with ESMTP id 50B921C00A3 for ; Mon, 20 Jun 2022 00:43:44 +0000 (UTC) Received: by mail-qv1-f54.google.com with SMTP id c1so13650398qvi.11 for ; Sun, 19 Jun 2022 17:43:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fhCWzyYhHQUfgLaJoA4/luR9p1DQeXQQcw2AdhNu860=; b=LNOtI32q4WsSf62+lp4sxFsq0bvgPEpDH7tubWopigkHyJasJcMXtxp6uhe/k056YK mHTCf4zl7jPsNE7ZDlNYCWbiEDRe7d2d6hBWTTvbyfN8QNhTuGyfoiOgpVBh5jbwxYNb wN4IEHaZ5JKnXGFqcxJcgQ356aOF+2/EiAu4mYPbQ0G9LRzp2dF14oqFlIfb+GgMCboF /svbE10GemkPJ/8PCTtYi25sf4XvEi7xd2lfrcq3Sikn1ZC55Ns7T+T4SJUvkWF/Xl6a pBoPIuzg4YVajlJR0+oHaAKlw9vN0nVxPk56KJucHUH+c7dt8C7G5JCpd/2Psqi2xQZ3 7pBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fhCWzyYhHQUfgLaJoA4/luR9p1DQeXQQcw2AdhNu860=; b=vix5C4QPnWvQpPNRATWnsrALcJy68VXm9H67bdyimqyNmiSazD1ci8kY6s3ZmKeh29 0H81IZDTCMowaeT+xWGfW6Z8GGu0Uf/Q77xr3bfqpW2u7FSFTrII34R0WsK4VWidVooh +k13UiUrO3l8e1+i5bjx8+zKq9Cp4/+UQ2+95vLnsfoFM4fNy5tbp6jr3WizUcHjybfb wZyJWUOxgigeZQfMK96nOoY9aRUg2wP351W37HZVvbkrWxsCTxcyTCVH1wUO1tHw5DWC GeO/rHNMxoDiuIuZCT+LL4D4i7/IMV662d6xu/r+kJYkaZs/CuXwAD10bWvPh843L18x GwRg== X-Gm-Message-State: AJIora+a3VtWk3mnfZffv+3wEG8ubL5ExwvOgeKJ32cBaLepuKVS57v2 i0m5x70o+kdjv/WGxIchpw== X-Google-Smtp-Source: AGRyM1uK4SE0R2rC8ICXr/1qyDRW063L27/c5mYvQJDhXdbWpPTz/vsIaae7XwlBInXy3JqUohNKFQ== X-Received: by 2002:a05:6214:23c8:b0:45f:b582:346e with SMTP id hr8-20020a05621423c800b0045fb582346emr17516453qvb.109.1655685823664; Sun, 19 Jun 2022 17:43:43 -0700 (PDT) Received: from localhost (c-73-219-103-14.hsd1.vt.comcast.net. [73.219.103.14]) by smtp.gmail.com with ESMTPSA id b198-20020a3767cf000000b0069fc13ce1f3sm10580202qkc.36.2022.06.19.17.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jun 2022 17:43:42 -0700 (PDT) From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, pmladek@suse.com Cc: Kent Overstreet , rostedt@goodmis.org, enozhatsky@chromium.org, linux@rasmusvillemoes.dk, willy@infradead.org, Ingo Molnar Subject: [PATCH v4 30/34] tracing: trace_events_synth: Convert to printbuf Date: Sun, 19 Jun 2022 20:42:29 -0400 Message-Id: <20220620004233.3805-31-kent.overstreet@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620004233.3805-1-kent.overstreet@gmail.com> References: <20220620004233.3805-1-kent.overstreet@gmail.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655685824; a=rsa-sha256; cv=none; b=Iwc4RAqTw8o3FKmHo4d0QFZWZdUQ4zrLTNNZajREiqp7sj2Gfh8XbTUPG38wlfolYt4ApQ hv1yfY5d79TDIwzyI7+isAWqeB26Yh7OiWUE53OK9dldRaG8/ReOL5XvYgQgP4X8LTM/NF lROvuB9NN0C87JLJtzNhV2E5F5Z1Xks= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LNOtI32q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.54 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655685824; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fhCWzyYhHQUfgLaJoA4/luR9p1DQeXQQcw2AdhNu860=; b=6ShgxyHvCP2IkE25S47VNLkGoDv7eWlz1gz8bzTUEBmYoy18vxIVMy4AcvBEQ7a1rUsUZC S+GAKVrDstjzXsBWJrfD+JZoCT4WhBHciu0KOOspZTZ7nlO7k6AZ8qfB+dffQQQ487I4Te qqIsmw+VXdv4girhu7fF6l3U2Q9t118= Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LNOtI32q; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf20.hostedemail.com: domain of kent.overstreet@gmail.com designates 209.85.219.54 as permitted sender) smtp.mailfrom=kent.overstreet@gmail.com X-Stat-Signature: zq5us1axdtea4w8ghu4wg15w7ko8t6jq X-Rspamd-Queue-Id: 50B921C00A3 X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1655685824-439466 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This converts from seq_buf to printbuf Signed-off-by: Kent Overstreet Cc: Steven Rostedt Cc: Ingo Molnar --- kernel/trace/trace_events_synth.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index 5e8c07aef0..627e0e45f0 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -5,13 +5,14 @@ * Copyright (C) 2015, 2020 Tom Zanussi */ -#include #include -#include +#include #include +#include +#include +#include #include #include -#include #include /* for gfp flag names */ @@ -611,7 +612,7 @@ static struct synth_field *parse_synth_field(int argc, char **argv, const char *prefix = NULL, *field_type = argv[0], *field_name, *array; struct synth_field *field; int len, ret = -ENOMEM; - struct seq_buf s; + struct printbuf s; ssize_t size; if (!strcmp(field_type, "unsigned")) { @@ -666,17 +667,15 @@ static struct synth_field *parse_synth_field(int argc, char **argv, if (!field->type) goto free; - seq_buf_init(&s, field->type, len); + s = PRINTBUF_EXTERN(field->type, len); if (prefix) - seq_buf_puts(&s, prefix); - seq_buf_puts(&s, field_type); + prt_str(&s, prefix); + prt_str(&s, field_type); if (array) - seq_buf_puts(&s, array); - if (WARN_ON_ONCE(!seq_buf_buffer_left(&s))) + prt_str(&s, array); + if (WARN_ON_ONCE(!printbuf_remaining(&s))) goto free; - s.buffer[s.len] = '\0'; - size = synth_field_size(field->type); if (size < 0) { if (array) @@ -694,13 +693,12 @@ static struct synth_field *parse_synth_field(int argc, char **argv, if (!type) goto free; - seq_buf_init(&s, type, len); - seq_buf_puts(&s, "__data_loc "); - seq_buf_puts(&s, field->type); + s = PRINTBUF_EXTERN(type, len); + prt_str(&s, "__data_loc "); + prt_str(&s, field->type); - if (WARN_ON_ONCE(!seq_buf_buffer_left(&s))) + if (WARN_ON_ONCE(!printbuf_remaining(&s))) goto free; - s.buffer[s.len] = '\0'; kfree(field->type); field->type = type;