Received: by 2002:a05:7208:70d5:b0:7f:5597:fa5c with SMTP id q21csp112049rba; Wed, 20 Mar 2024 12:32:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkUpJcGH+bb6vSfBToNGcxH1R1Hs+SpgnJsMaNt5zqmvNH8SEeTfGbR6Awmb5q+UNpws7cl2d3E1EjPMYOusYx3EgfzvcpRqAzVBq57Q== X-Google-Smtp-Source: AGHT+IFZv2TjeAtApuAZ+SHXt0LGyoE3MbvpGTlDqAnX1uHILwuXKAQ04EgO4trRl40Yazo4Xu4G X-Received: by 2002:a05:6402:912:b0:567:2a22:6e86 with SMTP id g18-20020a056402091200b005672a226e86mr14290513edz.22.1710963127615; Wed, 20 Mar 2024 12:32:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710963127; cv=pass; d=google.com; s=arc-20160816; b=v06MQOi59v3ygru33/Ax/wCk5f34nEGHi3wMdLP9cI0VdZEVY0K40yHbPXn4zBYI+F Xcnvavt2cbZz61loduo7/UcT2V5Yr8rgFW/V7Y2HGqjUqm5YRPq701uSBNIOB7HhWrXu 2SbRQpgyQmCPwXiKuMXOXCXvdakttlwubr7MSn7f7B74C5k3EP/kir3iaG9UDs9SZdkR 2dx6sndQkPnK7D53AkcVv77aITXjX2+sa+P6O3NL1eFxfKRzmPNNBL0OXTsySuxIrrG3 DQ0yOq2q1RxuFaipP3xlcTkvOcVMcrrYcJE1jW7BmF73TaiBZxWzVJuGztBjv04w/NiB kawg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cScGCmc8rB9mRqYh8X+Qarywn+44bAtaw+gyZLyU7J8=; fh=xqBA6XU1fuyTFblptcc0c2Nkny7AEuI4qyn8l5YDn6E=; b=sZPa69kdCZ9FL0yuR7DUSV2C2EZOYvWpQPeCjHmDUjyt5CUxVM+e/jo/xogwRX1Nyn LFfSsSsmMPJze5MrVGmaXVZd//ibuc5bLZHoCUC9w+nsoREyeLEOctelljjCJNo/CAuu SQqhdFm8x9iig7sszr4NmdA3rfrhClgHOBG3AQ3R/IN2xr5pbd9uOebQ9QenXe1oeL5J vEMqZtALNy8dfMWG+NPFMg9AuVWvnUcDqcQZVoWv6rSS9bcfzqqgIbR220ZUajCBN9/s ETBZR/67stFZpFyFxbxw9wHsKHIRtlbzg0y5c0ROAU2DEdfTlzzer5+ijoU/05Bs+vPb bKLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kxiqrRiq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id es15-20020a056402380f00b00568d2c15143si4015653edb.619.2024.03.20.12.32.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 12:32:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kxiqrRiq; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109347-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109347-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 495841F2424D for ; Wed, 20 Mar 2024 19:31:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90E9085C46; Wed, 20 Mar 2024 19:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kxiqrRiq" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACA0085950; Wed, 20 Mar 2024 19:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710963087; cv=none; b=Mm72RmVBez+egw2pF9dr+2oGOEWrNyN3sJywrX6hK3SuNWB+tH5VhQtFM97YJh5zxdHkkrV6Sd2TYtSDdASWbCFRweYmwg/Y2OMJfir2Cwq18aJGOStNlpCbbsXA8ZySmpLlIW9HxFkddYuI7nGX4lrzjPMs/XMY3+d8QNCKeZ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710963087; c=relaxed/simple; bh=ouhy4ZrWPGlt1lM2uzJYNGZ9IVtWJ9LBxEOjh5mHjXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TbiY0VLjzbfXN1zSIRRb54Bn5Qg8GX6frLQS6SX3CEx47lgigFwugz2HMPzB85CPlwQbzxh/SVsujDeMjl1QdE22akvhVFPraZucIITttF7r9OYKl1gOvpJ1EW2s5Ybn9huLotd4Zzl8WSwzesF51FVcv1xMLIlGXtemkDxcQnM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kxiqrRiq; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCAD9C433C7; Wed, 20 Mar 2024 19:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710963087; bh=ouhy4ZrWPGlt1lM2uzJYNGZ9IVtWJ9LBxEOjh5mHjXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxiqrRiq/UpO+6/dEdp7kXh71yj6jGNvMxGES8Fye1w3n4c1nkZnbd+5XMfUi0bAD tQ3RMeyJLCUP5ScSvKeDnRyNMm/Hfsb7gKWoj3Q9WQXE0TYmbHxr+G4L764uIbtu/0 cSUYp71DM3DsxiV1AcHtLcQI5LbETVMc4gCdnnyhf0tkciI6yMI6Mc6O19Uff51Fdr a28wcgLNnQ8lqDqi4COFJZApCg6mhKuBVVs9AHeBfhfN9ZZD7dq108Pg4/uO9dZo9D f0J/kpiRa546YOKMxKnVEKtE9RqIEeo9ukqNoFD+MIcF9XPzkK8nw3p/AF4L3OSljz 095yT0IUvLlMA== From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Jiri Olsa , Namhyung Kim , Adrian Hunter , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 3/5] perf beauty: Introduce faccessat2 flags scnprintf routine Date: Wed, 20 Mar 2024 16:31:13 -0300 Message-ID: <20240320193115.811899-4-acme@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240320193115.811899-1-acme@kernel.org> References: <20240320193115.811899-1-acme@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnaldo Carvalho de Melo The fsaccessat and fsaccessat2 now have beautifiers for its arguments. Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 9 +++++++++ tools/perf/trace/beauty/beauty.h | 3 +++ tools/perf/trace/beauty/fs_at_flags.c | 24 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 8417387aafa8295d..58546e8af9fcf481 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -947,6 +947,15 @@ static const struct syscall_fmt syscall_fmts[] = { .arg = { [1] = STRARRAY(op, epoll_ctl_ops), }, }, { .name = "eventfd2", .arg = { [1] = { .scnprintf = SCA_EFD_FLAGS, /* flags */ }, }, }, + { .name = "faccessat", + .arg = { [0] = { .scnprintf = SCA_FDAT, /* dirfd */ }, + [1] = { .scnprintf = SCA_FILENAME, /* pathname */ }, + [2] = { .scnprintf = SCA_ACCMODE, /* mode */ }, }, }, + { .name = "faccessat2", + .arg = { [0] = { .scnprintf = SCA_FDAT, /* dirfd */ }, + [1] = { .scnprintf = SCA_FILENAME, /* pathname */ }, + [2] = { .scnprintf = SCA_ACCMODE, /* mode */ }, + [3] = { .scnprintf = SCA_FACCESSAT2_FLAGS, /* flags */ }, }, }, { .name = "fchmodat", .arg = { [0] = { .scnprintf = SCA_FDAT, /* fd */ }, }, }, { .name = "fchownat", diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h index c94ae8701bc65a2f..78d10d92d351f8e2 100644 --- a/tools/perf/trace/beauty/beauty.h +++ b/tools/perf/trace/beauty/beauty.h @@ -237,6 +237,9 @@ size_t syscall_arg__scnprintf_socket_level(char *bf, size_t size, struct syscall size_t syscall_arg__scnprintf_fs_at_flags(char *bf, size_t size, struct syscall_arg *arg); #define SCA_FS_AT_FLAGS syscall_arg__scnprintf_fs_at_flags +size_t syscall_arg__scnprintf_faccessat2_flags(char *bf, size_t size, struct syscall_arg *arg); +#define SCA_FACCESSAT2_FLAGS syscall_arg__scnprintf_faccessat2_flags + size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_arg *arg); #define SCA_STATX_MASK syscall_arg__scnprintf_statx_mask diff --git a/tools/perf/trace/beauty/fs_at_flags.c b/tools/perf/trace/beauty/fs_at_flags.c index 2a099953d9935782..c1365e8f0b96ef43 100644 --- a/tools/perf/trace/beauty/fs_at_flags.c +++ b/tools/perf/trace/beauty/fs_at_flags.c @@ -7,6 +7,7 @@ #include "trace/beauty/beauty.h" #include +#include #include #include "trace/beauty/generated/fs_at_flags_array.c" @@ -24,3 +25,26 @@ size_t syscall_arg__scnprintf_fs_at_flags(char *bf, size_t size, struct syscall_ return fs_at__scnprintf_flags(flags, bf, size, show_prefix); } + +static size_t faccessat2__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix) +{ + int printed = 0; + + // AT_EACCESS is the same as AT_REMOVEDIR, that is in fs_at_flags_array, + // special case it here. + if (flags & AT_EACCESS) { + flags &= ~AT_EACCESS; + printed += scnprintf(bf + printed, size - printed, "%sEACCESS%s", + show_prefix ? strarray__fs_at_flags.prefix : "", flags ? "|" : ""); + } + + return strarray__scnprintf_flags(&strarray__fs_at_flags, bf + printed, size - printed, show_prefix, flags); +} + +size_t syscall_arg__scnprintf_faccessat2_flags(char *bf, size_t size, struct syscall_arg *arg) +{ + bool show_prefix = arg->show_string_prefix; + int flags = arg->val; + + return faccessat2__scnprintf_flags(flags, bf, size, show_prefix); +} -- 2.44.0