From patchwork Thu Apr 8 14:00:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12191205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A1C3C433B4 for ; Thu, 8 Apr 2021 14:00:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A33D61130 for ; Thu, 8 Apr 2021 14:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231371AbhDHOAs (ORCPT ); Thu, 8 Apr 2021 10:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbhDHOAs (ORCPT ); Thu, 8 Apr 2021 10:00:48 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 351AAC061761 for ; Thu, 8 Apr 2021 07:00:37 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id s15so2566583edd.4 for ; Thu, 08 Apr 2021 07:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uFCmyoZmsYF6TR1HKFUQCv6oPEMxr+ouFLjkaPL86hk=; b=Rf1Me6UIQkziM5QMiM+r96A4y90P22S2MsnOi/Uv+o1cyMGS0rvJxK2xdy3mt64E4s 3fENdp+3Ov3NGekbv1CIvKQRLthJiQXNzGxj3IRKitnP/+ubl6Oh+eRjEjI3o4bfDzwW OjqpDlgQaMpon/JOb/e+mf9vOI14mTkHFSkXOtBs/Pwjl3BZlxbErpBFVsANBoxR5AGa tX6oVi7bhzw2NzJVDOtlYIU7gJx9EZsVDYB4V/a1mdAcOzMqE/wLgIHHjq/yey9y57qQ NImXpMPPYkwpWk7smhl9qESGXSoaxZP0X91Aja5EHyHNu03beJCD7LGALSqQBHbWkKS9 Af+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uFCmyoZmsYF6TR1HKFUQCv6oPEMxr+ouFLjkaPL86hk=; b=P7T+LEo+gW/Q1SGn5jCvrPtZd7SxaNUBM27EUEoulnkDpRzKEhzC9YSuagaoIL7MUd 7sOUO4rtLWZiOKy1EIcs7gIESLsg5mKEo52VDgwJFw0atSuOYCu6/4flJl79/FLY/viM N/uBlJsyotTDZ2vQn71MJhEtGjnn10HdOAYnoeLNrkA9uxeUR97CWfvqFruxkdDnlE+R LOySj3SzkYRa/1eo9Thuj/vcB5bMS2FlLiooCmm82nm9wR1y4lIq0zHZ5IM4saCiew/5 HDqF87SmG4gWKEgAj8FTakGP0R7aTdbAXvV1jiKY0C7GwaLgVkyQ4S+GZas+kJuC0T8E kdrg== X-Gm-Message-State: AOAM531IAEH+8AVt0DqnRzweXlBBgooHRrrbzdEz5lNrG2lFQlzc7nSW CacnXwmfhPIbVrNGXSBZipo= X-Google-Smtp-Source: ABdhPJzulMcrt1Wke23DklPP/BJGglYby7wXS8fZ4+wRgwDJyTdxm2/c0pB9EUjUSCeOpvdeOfjSUQ== X-Received: by 2002:a05:6402:42d1:: with SMTP id i17mr11237567edc.131.1617890436006; Thu, 08 Apr 2021 07:00:36 -0700 (PDT) Received: from localhost.localdomain ([95.87.199.133]) by smtp.gmail.com with ESMTPSA id jt18sm8212150ejc.96.2021.04.08.07.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 07:00:35 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, tz.stoyanov@gmail.com, "Yordan Karadzhov (VMware)" Subject: [PATCH v3 1/5] libtracefs: Fix issues with tracefs_option_id() Date: Thu, 8 Apr 2021 17:00:20 +0300 Message-Id: <20210408140024.13093-2-y.karadz@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210408140024.13093-1-y.karadz@gmail.com> References: <20210408140024.13093-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Few mistakes have been made when introducing this API function. First of all, its declaration is missing from the header file. In addition to this the argument type is missing "const". Signed-off-by: Yordan Karadzhov (VMware) --- include/tracefs.h | 1 + src/tracefs-tools.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tracefs.h b/include/tracefs.h index 70b7ebe..d3db8b5 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -145,6 +145,7 @@ bool tracefs_option_is_enabled(struct tracefs_instance *instance, enum tracefs_o int tracefs_option_enable(struct tracefs_instance *instance, enum tracefs_option_id id); int tracefs_option_diasble(struct tracefs_instance *instance, enum tracefs_option_id id); const char *tracefs_option_name(enum tracefs_option_id id); +enum tracefs_option_id tracefs_option_id(const char *name); /* * RESET - Reset on opening filter file (O_TRUNC) diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c index d48062c..f409def 100644 --- a/src/tracefs-tools.c +++ b/src/tracefs-tools.c @@ -192,7 +192,7 @@ const char *tracefs_option_name(enum tracefs_option_id id) * Returns trace option ID or TRACEFS_OPTION_INVALID in case of an error or * unknown option name. */ -enum tracefs_option_id tracefs_option_id(char *name) +enum tracefs_option_id tracefs_option_id(const char *name) { int i; From patchwork Thu Apr 8 14:00:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12191209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B651FC43461 for ; Thu, 8 Apr 2021 14:00:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 897CD610E5 for ; Thu, 8 Apr 2021 14:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231480AbhDHOAv (ORCPT ); Thu, 8 Apr 2021 10:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbhDHOAu (ORCPT ); Thu, 8 Apr 2021 10:00:50 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54F45C061760 for ; Thu, 8 Apr 2021 07:00:38 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id e7so2537179edu.10 for ; Thu, 08 Apr 2021 07:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HKUHAOpNrUrKqASrdS1VZ77GIFGbq5QAtjB5KFl/0SU=; b=FnP0kXHBvdBTYJyh0R81FRToIAcdjYgmCu6DsUGsAAHdLmvfgcb7FUd2WeSZWbonYm 2sk8w/g5iB1uZnCvu4uFNG7v0LDlE3y10aabdZcBDso8MCybYAj8e4VEghyrvj0aTL+5 nYLKIRv/5ltRFwYL9hcufzE0sM1koaZhEkgW2QqNrXDJ/KrX7qx0HnZ0tfXckFf0UO4t l1qEFRI25T6b68p2PJKgFEWobxD6Mjtj9keLtD4H+JerafGs41Z8hr5MGnjBcH16l/WM wpOpW7YIvPWqEdxw1aQ4kVW86jw7UPtGrYE4GQb8dIckvSChXeHOhVRDNEbeVdP5VAgF egTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HKUHAOpNrUrKqASrdS1VZ77GIFGbq5QAtjB5KFl/0SU=; b=hlX4X/XHPQ6tteVy0j2ow2YQy+HMxq/7aI9plcXhMqqS9BvdyaKSsYEXJOLA6ygJVI SIjZmlT44iAahLhq3ZEjWgWAVP+6x/0VVau9v6n6Zpyv+juaX182LvzSzMo5zrZ93mlD z52nmnQSulMhsMU2zgLl0+hTeu2+95z81iMWKV50K1c8izdJkU+wpdyGIhI3PlliUgNN /W3mAs3aDeS3DOrU87VcAPQMn1h/vPk6/FuqBkq+abcGXMCzPJnu1r3wHazyCaYqRoyz s/4rFkMBoE+NaiDaEkXGXrEYG0k0ZHscik+DBM2lqNS8Y+2eu8N9L9qjOrCTxnxLkGba SZbA== X-Gm-Message-State: AOAM533b2ZCpJLC7xznQlD/fpPp9E/DPSJGYUzwbUCjdbeB4j+yvITE3 fhQGgZTdQbIOvCBGWa69KaCM/rf6Ounlvw== X-Google-Smtp-Source: ABdhPJxPKIKKNAF7ZwC1h33JiotteEQFqJ4d3E0MJK+T4X8m/gEoI8ORjwMtY5EpcRFoawV5QYf88A== X-Received: by 2002:a05:6402:2786:: with SMTP id b6mr11656217ede.310.1617890437144; Thu, 08 Apr 2021 07:00:37 -0700 (PDT) Received: from localhost.localdomain ([95.87.199.133]) by smtp.gmail.com with ESMTPSA id jt18sm8212150ejc.96.2021.04.08.07.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 07:00:36 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, tz.stoyanov@gmail.com, "Yordan Karadzhov (VMware)" Subject: [PATCH v3 2/5] libtracefs: Modify the arguments of tracefs_option_is_set() Date: Thu, 8 Apr 2021 17:00:21 +0300 Message-Id: <20210408140024.13093-3-y.karadz@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210408140024.13093-1-y.karadz@gmail.com> References: <20210408140024.13093-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org This function is supposed to take as argument a mask returned by "tracefs_options_get_supported()" or "tracefs_options_get_enabled()", hence this argument must be a pointer. Signed-off-by: Yordan Karadzhov (VMware) --- include/tracefs.h | 4 ++-- src/tracefs-tools.c | 5 +++-- utest/tracefs-utest.c | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/tracefs.h b/include/tracefs.h index d3db8b5..95016c8 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -136,8 +136,8 @@ struct tracefs_options_mask { }; void tracefs_option_set(struct tracefs_options_mask *options, enum tracefs_option_id id); void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_option_id id); -bool tracefs_option_is_set(struct tracefs_options_mask options, enum tracefs_option_id id); - +bool tracefs_option_is_set(struct tracefs_options_mask *options, + enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance); bool tracefs_option_is_supported(struct tracefs_instance *instance, enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_enabled(struct tracefs_instance *instance); diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c index f409def..25c0cea 100644 --- a/src/tracefs-tools.c +++ b/src/tracefs-tools.c @@ -370,10 +370,11 @@ bool tracefs_option_is_enabled(struct tracefs_instance *instance, enum tracefs_o * Returns true if an option with given id is set in the bitmask, * false if it is not set. */ -bool tracefs_option_is_set(struct tracefs_options_mask options, enum tracefs_option_id id) +bool tracefs_option_is_set(struct tracefs_options_mask *options, + enum tracefs_option_id id) { if (id > TRACEFS_OPTION_INVALID) - return options.mask & (1ULL << (id - 1)); + return options->mask & (1ULL << (id - 1)); return false; } diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c index ed2693b..9cb2a09 100644 --- a/utest/tracefs-utest.c +++ b/utest/tracefs-utest.c @@ -547,7 +547,7 @@ static bool check_options_mask_empty(struct tracefs_options_mask *mask) int i; for (i = 1; i < TRACEFS_OPTION_MAX; i++) { - if (tracefs_option_is_set(*mask, i)) + if (tracefs_option_is_set(mask, i)) return false; } return true; @@ -580,9 +580,9 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) CU_TEST(strcmp(name, "unknown")); snprintf(file, PATH_MAX, "options/%s", name); - if (tracefs_option_is_set(*all, i)) { + if (tracefs_option_is_set(all, i)) { tracefs_option_clear(all, i); - CU_TEST(!tracefs_option_is_set(*all, i)); + CU_TEST(!tracefs_option_is_set(all, i)); CU_TEST(check_option(instance, i, true, -1)); CU_TEST(tracefs_option_is_supported(instance, i)); } else { @@ -590,9 +590,9 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) CU_TEST(!tracefs_option_is_supported(instance, i)); } - if (tracefs_option_is_set(*enabled, i)) { + if (tracefs_option_is_set(enabled, i)) { tracefs_option_clear(enabled, i); - CU_TEST(!tracefs_option_is_set(*enabled, i)); + CU_TEST(!tracefs_option_is_set(enabled, i)); CU_TEST(check_option(instance, i, true, 1)); CU_TEST(tracefs_option_is_supported(instance, i)); CU_TEST(tracefs_option_is_enabled(instance, i)); @@ -600,7 +600,7 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) CU_TEST(check_option(instance, i, true, 0)); CU_TEST(tracefs_option_enable(instance, i) == 0); CU_TEST(check_option(instance, i, true, 1)); - } else if (tracefs_option_is_set(*all_copy, i)) { + } else if (tracefs_option_is_set(all_copy, i)) { CU_TEST(check_option(instance, i, true, 0)); CU_TEST(tracefs_option_is_supported(instance, i)); CU_TEST(!tracefs_option_is_enabled(instance, i)); From patchwork Thu Apr 8 14:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12191213 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D18ADC433B4 for ; Thu, 8 Apr 2021 14:00:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99D10610E5 for ; Thu, 8 Apr 2021 14:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbhDHOAy (ORCPT ); Thu, 8 Apr 2021 10:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbhDHOAx (ORCPT ); Thu, 8 Apr 2021 10:00:53 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06CD0C061761 for ; Thu, 8 Apr 2021 07:00:42 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id x4so2576492edd.2 for ; Thu, 08 Apr 2021 07:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pKDm3+GxFvpE0BU6yXTHppPxiKAz97coAfSJVQVLE4c=; b=c+gKFpkNI5K7ZyjLyU4F6ZTJ08GXh8ulRVK/iqiJmNfX5DNr3HSh6XPK6f42BNusl/ W4kksHDLNrjYeH4D6qa4ESMm03tl7W6myXbRr44bMQg1/+dbhaRrgR/VI7RsBcRfs2o2 kzmbt4Dx9xvqDH4IN5397UQvirR8F1z4kGeKsNfBxOlhLNlowbvl7cx1wvU8KrUOd60y Qzd3cVpwdpnn6NsSTXBzMBV8goA0AJng1AXWiVJu9WsQyE3aPfoP63e3PGBkNEEQinzu 8jqFD2m4sZV1kJkwDBdMsiHdLbTWnOXKTLbACf44UFCDsBIq3h+A6on1Bgje1p1By5II +fJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pKDm3+GxFvpE0BU6yXTHppPxiKAz97coAfSJVQVLE4c=; b=jF8mJOsKH24R/aF3RTjLoy/6T9GwIRBKlvEOFpRgAYhnBLqkaYdsjZgso0HC4XmWAM ey5zQUoAAUAdi68WhM1ghgUaPNYjWdGbGgAmL1OU1Jvs22n72WzetCc4EMipbD7CB6wn 2H0/4jXVYp7NNG2C2etu2HeNDTLUCnL9bT613kY9miliTOela9YRg9z0bX5mv3tdStG0 9LDluQViHusrfw4LiOBa3bKxh4h2HItBP5g4K1a/OdMFAHiV9CMGY+N3NiJE4GcvN8Rp 4jSGDvOGoFKJ0AwPgpSy2X5YP3jPR86cGuEUUn/aw+oxMr7fRd/xOXDvzl3XNdxMiEPM Aa2g== X-Gm-Message-State: AOAM532LmanKJjXWWudktDUFV+jrZhrgUb4v2Qi/NMDFbi91fRHLIRov pKUHyp8JgINvk/FtOYY65ek= X-Google-Smtp-Source: ABdhPJyln0c4WjWADTBi69D6wx5dQ63nc2+2SHPPK48qg9GnIrS3fLcirKehC1ewNtztTDaENM4uiw== X-Received: by 2002:a05:6402:520b:: with SMTP id s11mr11778901edd.212.1617890437937; Thu, 08 Apr 2021 07:00:37 -0700 (PDT) Received: from localhost.localdomain ([95.87.199.133]) by smtp.gmail.com with ESMTPSA id jt18sm8212150ejc.96.2021.04.08.07.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 07:00:37 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, tz.stoyanov@gmail.com, "Yordan Karadzhov (VMware)" Subject: [PATCH v3 3/5] libtracefs: Encapsulate "struct tracefs_options_mask" Date: Thu, 8 Apr 2021 17:00:22 +0300 Message-Id: <20210408140024.13093-4-y.karadz@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210408140024.13093-1-y.karadz@gmail.com> References: <20210408140024.13093-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org The definition of the mask gets hidden from the user. This way we will be able to modify this definition in the future, without breaking the API. Such a modification will be compulsory, if too many new tracing options are added in the future. Note that encapsulating the mask definition, requires two API methods to be eliminated, however those methods have no particular use-cases for the moment. Signed-off-by: Yordan Karadzhov (VMware) --- include/tracefs-local.h | 4 ++++ include/tracefs.h | 6 +----- src/tracefs-tools.c | 26 ++------------------------ utest/tracefs-utest.c | 4 ---- 4 files changed, 7 insertions(+), 33 deletions(-) diff --git a/include/tracefs-local.h b/include/tracefs-local.h index 6865611..076b013 100644 --- a/include/tracefs-local.h +++ b/include/tracefs-local.h @@ -14,6 +14,10 @@ #define BUILD_BUG_ON(cond) \ do { if (!(1/!(cond))) { } } while (0) +struct tracefs_options_mask { + unsigned long long mask; +}; + struct tracefs_instance { char *trace_dir; char *name; diff --git a/include/tracefs.h b/include/tracefs.h index 95016c8..e1fbef6 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -131,11 +131,7 @@ enum tracefs_option_id { }; #define TRACEFS_OPTION_MAX (TRACEFS_OPTION_VERBOSE + 1) -struct tracefs_options_mask { - unsigned long long mask; -}; -void tracefs_option_set(struct tracefs_options_mask *options, enum tracefs_option_id id); -void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_option_id id); +struct tracefs_options_mask; bool tracefs_option_is_set(struct tracefs_options_mask *options, enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance); diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c index 25c0cea..fc9644a 100644 --- a/src/tracefs-tools.c +++ b/src/tracefs-tools.c @@ -239,8 +239,8 @@ static struct tracefs_options_mask *trace_get_options(struct tracefs_instance *i continue; } id = tracefs_option_id(dent->d_name); - if (id != TRACEFS_OPTION_INVALID) - tracefs_option_set(bitmask, id); + if (id > TRACEFS_OPTION_INVALID) + bitmask->mask |= (1ULL << (id - 1)); } closedir(dir); tracefs_put_tracing_file(dname); @@ -378,28 +378,6 @@ bool tracefs_option_is_set(struct tracefs_options_mask *options, return false; } -/** - * tracefs_option_set - Set option in options bitmask - * @options: Pointer to a bitmask with options - * @id: trace option id - */ -void tracefs_option_set(struct tracefs_options_mask *options, enum tracefs_option_id id) -{ - if (options && id > TRACEFS_OPTION_INVALID) - options->mask |= (1ULL << (id - 1)); -} - -/** - * tracefs_option_clear - Clear option from options bitmask - * @options: Pointer to a bitmask with options - * @id: trace option id - */ -void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_option_id id) -{ - if (options && id > TRACEFS_OPTION_INVALID) - options->mask &= ~(1ULL << (id - 1)); -} - struct func_list { struct func_list *next; unsigned int start; diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c index 9cb2a09..af28779 100644 --- a/utest/tracefs-utest.c +++ b/utest/tracefs-utest.c @@ -581,8 +581,6 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) snprintf(file, PATH_MAX, "options/%s", name); if (tracefs_option_is_set(all, i)) { - tracefs_option_clear(all, i); - CU_TEST(!tracefs_option_is_set(all, i)); CU_TEST(check_option(instance, i, true, -1)); CU_TEST(tracefs_option_is_supported(instance, i)); } else { @@ -591,8 +589,6 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) } if (tracefs_option_is_set(enabled, i)) { - tracefs_option_clear(enabled, i); - CU_TEST(!tracefs_option_is_set(enabled, i)); CU_TEST(check_option(instance, i, true, 1)); CU_TEST(tracefs_option_is_supported(instance, i)); CU_TEST(tracefs_option_is_enabled(instance, i)); From patchwork Thu Apr 8 14:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12191211 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FDB3C433ED for ; Thu, 8 Apr 2021 14:00:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F130E6102A for ; Thu, 8 Apr 2021 14:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231534AbhDHOAv (ORCPT ); Thu, 8 Apr 2021 10:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231474AbhDHOAv (ORCPT ); Thu, 8 Apr 2021 10:00:51 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B197C061761 for ; Thu, 8 Apr 2021 07:00:40 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id r22so2537878edq.9 for ; Thu, 08 Apr 2021 07:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L1+6bckY8j+5tuL+UpJPMiQSD6J2rmrse4iKktx5esU=; b=vT/OYmGW4ya3le2NIEwpqrCTPoOASKgAiXb20bmstO5wm7WkdKFyamBPZgGbG6FlmI UZVB0vfC6wclmpGJVArClvpzEME8tTmfun8Dxw6hvbaPayDqjdipkoQSI/HcOXlAhooj hMsNbO2fMtbhhN0xzUfFuVBB5kdCEGO4KF0hX6N4iyxO8gWHZp9erayP3QQftBwKVh38 9gNxymRts4sy9AcNyIZtRZc0XFsVzcxgtDN87eYBMUnyRpYb/dvcyYER7ZtemiqKQBD8 6XaBtMZmMKwqzo2LhbPcYrEtJbfszUupp+9hDQLsSZeInYJ3m2Zx1+G+rPZbTAg5eZWv 6P9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L1+6bckY8j+5tuL+UpJPMiQSD6J2rmrse4iKktx5esU=; b=aBSO7+bhmtDLTJ8X4F9ua5ItGGRc190aDq0Y8IY4ambywARNSMzV3adcyMnUfFmkE6 i7R8AUXZ8JpqyXK6vcrmJYNVj78W2qytctfmISC/G4trQHUsnR4w/pgT9rgW+Phj6AOg Sf05Nqhto59f7Qya0tu+Wrrt7OTi6Ye3gb/YU+2VCig7MGm7OvaU2CVf1NTBO9VKMb2x xYv9tFYHtgOPaJWdJdQkGpQDWyNDq7slBmOP+XBrnDU/73NAed2o/7+e3aP7TtCqkIdq NtWqf6429SmXNwIWix+9v4lrdQs1kXuhkZbFoqAcnqkeHQ0v3WIqbd97oEsAd1JV26Nt 6Vtg== X-Gm-Message-State: AOAM533Gd+KUfF3jZcPQKx7XOzF3fumnLTQBI4AA7WqdxTow8O/vfArz EBROwtndletD6wt5u3lBiMY1Wtm4YURQJg== X-Google-Smtp-Source: ABdhPJwyvzFBDg/VT4WbSHWbAkIdnnZLsb7+p1pArcPMFkIl9xdwsXt8o9UBH9bFTOSHB6LeiyDjLg== X-Received: by 2002:aa7:dac5:: with SMTP id x5mr2908586eds.286.1617890438700; Thu, 08 Apr 2021 07:00:38 -0700 (PDT) Received: from localhost.localdomain ([95.87.199.133]) by smtp.gmail.com with ESMTPSA id jt18sm8212150ejc.96.2021.04.08.07.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 07:00:38 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, tz.stoyanov@gmail.com, "Yordan Karadzhov (VMware)" Subject: [PATCH v3 4/5] libtracefs: Option's bit masks to be owned by the instance Date: Thu, 8 Apr 2021 17:00:23 +0300 Message-Id: <20210408140024.13093-5-y.karadz@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210408140024.13093-1-y.karadz@gmail.com> References: <20210408140024.13093-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org If the instance owns two mask objects, we no longer need to dynamically allocate memory in tracefs_options_get_supported() and tracefs_options_get_enabled(). This will simplify the code on the caller side, since the user is no longer responsible for freeing those masks. Signed-off-by: Yordan Karadzhov (VMware) --- Documentation/libtracefs-option-get.txt | 4 +--- include/tracefs-local.h | 8 ++++++++ include/tracefs.h | 2 +- src/tracefs-instance.c | 15 +++++++++++++++ src/tracefs-tools.c | 24 ++++++++++++++---------- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Documentation/libtracefs-option-get.txt b/Documentation/libtracefs-option-get.txt index 9b3cb56..3290f24 100644 --- a/Documentation/libtracefs-option-get.txt +++ b/Documentation/libtracefs-option-get.txt @@ -52,14 +52,13 @@ EXAMPLE -- #include ... -struct tracefs_options_mask *options; +const struct tracefs_options_mask *options; ... options = tracefs_options_get_supported(NULL); if (!options) { /* Failed to get supported options */ } else { ... - free(options); } ... options = tracefs_options_get_enabled(NULL); @@ -67,7 +66,6 @@ if (!options) { /* Failed to get options, enabled in the top instance */ } else { ... - free(options); } ... diff --git a/include/tracefs-local.h b/include/tracefs-local.h index 076b013..eb8c81b 100644 --- a/include/tracefs-local.h +++ b/include/tracefs-local.h @@ -25,6 +25,8 @@ struct tracefs_instance { int flags; int ftrace_filter_fd; int ftrace_notrace_fd; + struct tracefs_options_mask supported_opts; + struct tracefs_options_mask enabled_opts; }; extern pthread_mutex_t toplevel_lock; @@ -48,4 +50,10 @@ char *trace_find_tracing_dir(void); #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666*/ #endif +struct tracefs_options_mask * +supported_opts_mask(struct tracefs_instance *instance); + +struct tracefs_options_mask * +enabled_opts_mask(struct tracefs_instance *instance); + #endif /* _TRACE_FS_LOCAL_H */ diff --git a/include/tracefs.h b/include/tracefs.h index e1fbef6..ea9dbd0 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -132,7 +132,7 @@ enum tracefs_option_id { #define TRACEFS_OPTION_MAX (TRACEFS_OPTION_VERBOSE + 1) struct tracefs_options_mask; -bool tracefs_option_is_set(struct tracefs_options_mask *options, +bool tracefs_option_is_set(const struct tracefs_options_mask *options, enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance); bool tracefs_option_is_supported(struct tracefs_instance *instance, enum tracefs_option_id id); diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c index 599c3a7..74122aa 100644 --- a/src/tracefs-instance.c +++ b/src/tracefs-instance.c @@ -21,6 +21,21 @@ #define FLAG_INSTANCE_NEWLY_CREATED (1 << 0) +struct tracefs_options_mask toplevel_supported_opts; +struct tracefs_options_mask toplevel_enabled_opts; + +__hidden inline struct tracefs_options_mask * +supported_opts_mask(struct tracefs_instance *instance) +{ + return instance? &instance->supported_opts : &toplevel_supported_opts; +} + +__hidden inline struct tracefs_options_mask * +enabled_opts_mask(struct tracefs_instance *instance) +{ + return instance? &instance->enabled_opts : &toplevel_enabled_opts; +} + /** * instance_alloc - allocate a new ftrace instance * @trace_dir - Full path to the tracing directory, where the instance is diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c index fc9644a..b6967db 100644 --- a/src/tracefs-tools.c +++ b/src/tracefs-tools.c @@ -211,6 +211,7 @@ enum tracefs_option_id tracefs_option_id(const char *name) static struct tracefs_options_mask *trace_get_options(struct tracefs_instance *instance, bool enabled) { + pthread_mutex_t *lock = instance ? &instance->lock : &toplevel_lock; struct tracefs_options_mask *bitmask; enum tracefs_option_id id; char file[PATH_MAX]; @@ -219,9 +220,6 @@ static struct tracefs_options_mask *trace_get_options(struct tracefs_instance *i DIR *dir = NULL; long long val; - bitmask = calloc(1, sizeof(struct tracefs_options_mask)); - if (!bitmask) - return NULL; dname = tracefs_instance_get_file(instance, "options"); if (!dname) goto error; @@ -229,6 +227,11 @@ static struct tracefs_options_mask *trace_get_options(struct tracefs_instance *i if (!dir) goto error; + bitmask = enabled? enabled_opts_mask(instance) : + supported_opts_mask(instance); + + pthread_mutex_lock(lock); + bitmask->mask = 0; while ((dent = readdir(dir))) { if (*dent->d_name == '.') continue; @@ -242,6 +245,8 @@ static struct tracefs_options_mask *trace_get_options(struct tracefs_instance *i if (id > TRACEFS_OPTION_INVALID) bitmask->mask |= (1ULL << (id - 1)); } + pthread_mutex_unlock(lock); + closedir(dir); tracefs_put_tracing_file(dname); @@ -251,7 +256,6 @@ error: if (dir) closedir(dir); tracefs_put_tracing_file(dname); - free(bitmask); return NULL; } @@ -259,8 +263,8 @@ error: * tracefs_options_get_supported - Get all supported trace options in given instance * @instance: ftrace instance, can be NULL for the top instance * - * Returns allocated bitmask structure with all trace options, supported in given - * instance, or NULL in case of an error. The returned structure must be freed with free() + * Returns bitmask structure with all trace options, supported in given instance, + * or NULL in case of an error. */ struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance) { @@ -271,8 +275,8 @@ struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instan * tracefs_options_get_enabled - Get all currently enabled trace options in given instance * @instance: ftrace instance, can be NULL for the top instance * - * Returns allocated bitmask structure with all trace options, enabled in given - * instance, or NULL in case of an error. The returned structure must be freed with free() + * Returns bitmask structure with all trace options, enabled in given instance, + * or NULL in case of an error. */ struct tracefs_options_mask *tracefs_options_get_enabled(struct tracefs_instance *instance) { @@ -282,7 +286,7 @@ struct tracefs_options_mask *tracefs_options_get_enabled(struct tracefs_instance static int trace_config_option(struct tracefs_instance *instance, enum tracefs_option_id id, bool set) { - char *set_str = set ? "1" : "0"; + const char *set_str = set ? "1" : "0"; char file[PATH_MAX]; const char *name; @@ -370,7 +374,7 @@ bool tracefs_option_is_enabled(struct tracefs_instance *instance, enum tracefs_o * Returns true if an option with given id is set in the bitmask, * false if it is not set. */ -bool tracefs_option_is_set(struct tracefs_options_mask *options, +bool tracefs_option_is_set(const struct tracefs_options_mask *options, enum tracefs_option_id id) { if (id > TRACEFS_OPTION_INVALID) From patchwork Thu Apr 8 14:00:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12191215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CDD4C43462 for ; Thu, 8 Apr 2021 14:00:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD3E8610E5 for ; Thu, 8 Apr 2021 14:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231474AbhDHOAy (ORCPT ); Thu, 8 Apr 2021 10:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231537AbhDHOAx (ORCPT ); Thu, 8 Apr 2021 10:00:53 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD174C061760 for ; Thu, 8 Apr 2021 07:00:40 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 18so2568928edx.3 for ; Thu, 08 Apr 2021 07:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aigXluwuEOx02rzW9nLCvHAuZ0s0Xv+OeSwDwSd0AaU=; b=G7nVOsHgz8s6XaOQIbdTXUXgsO6XQDtVw0Sv6Q6QwOmLoCH5074Qo8Y+PAvBVu8gHR d0D6fHGE4UDC+Pe+13sS0cT7Q45mTfpHQeRR0FDe+mJFdvYFJtUlduRlIqPSBLxWOPi+ YrPUjQ6Thna7dmfzEKb0zxgSlMixrt2v98joQSvOWSTsO2+RBfZb8V5ZZzJmqzgjdQAO DW3AAka3sk3GYpKXp/Tb8lABzpEG2nJVf8eBpu/7eU0cJZK7af4W7vM1vIRYlEG4cXTV nMDa2J9pKRMEZ1jX/rfhFIYikOXdrY51EoaDGTNc1zkDJG1hdJNRzqwqWpE2awY0Mz8y WI3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aigXluwuEOx02rzW9nLCvHAuZ0s0Xv+OeSwDwSd0AaU=; b=EPm5PCmc2Zwdz9m5dwmjvYi2wi0IoCFbeW0LJDKba8/d7D6V9xLkdZ107rFV/ca0ff IaNQyMbAFf1TA9ytHLC724uL0kXC2XtYbmpUr2m8Fu4G4owcuWDRmd2wZ5lf3EVOoR8Y 13tl6TNqESSIwPGnie5X+WknlpFju9TpaqoJvkpua2/WLowEheoIW/iM/OB92abqNImK 9IxL8alRXvjVWXWaRvBdmaIHvhzqxe2yNM04o2KJY8l5k4w5MEz+ocmLajp0MH/UFEFU piaw8dV7HwaG66TgpP5n2KbsByhKjS46JOjyM4+B5qqSbuaDQLDQL9t+twQ/hIQD73Yg /byA== X-Gm-Message-State: AOAM532lVf9+xW1QtEoNHi3pg4fc8/SjD+gW/StICkjdwH2nRcu22arr fHj4nktxDFgRDFP2MslKB6w= X-Google-Smtp-Source: ABdhPJz7JAej8eJv4FQctE+1cIrFh9YNeo7QHyMChZLprgTgr5t6xAyEx1QDRq1TzH8QFEWC6E8Xkg== X-Received: by 2002:a50:f19d:: with SMTP id x29mr2343705edl.102.1617890439510; Thu, 08 Apr 2021 07:00:39 -0700 (PDT) Received: from localhost.localdomain ([95.87.199.133]) by smtp.gmail.com with ESMTPSA id jt18sm8212150ejc.96.2021.04.08.07.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 07:00:39 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, tz.stoyanov@gmail.com, "Yordan Karadzhov (VMware)" Subject: [PATCH v3 5/5] libtracefs: Rename tracefs_option_is_set() Date: Thu, 8 Apr 2021 17:00:24 +0300 Message-Id: <20210408140024.13093-6-y.karadz@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210408140024.13093-1-y.karadz@gmail.com> References: <20210408140024.13093-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org The old name of the function is potentially confusing. Indeed the function do not check anything about the option itself (is it supported or is it enabled). The function only check if inside the mask the bit that corresponds to a given option is set. Signed-off-by: Yordan Karadzhov (VMware) --- include/tracefs.h | 4 ++-- src/tracefs-tools.c | 4 ++-- utest/tracefs-utest.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/tracefs.h b/include/tracefs.h index ea9dbd0..daae419 100644 --- a/include/tracefs.h +++ b/include/tracefs.h @@ -132,8 +132,8 @@ enum tracefs_option_id { #define TRACEFS_OPTION_MAX (TRACEFS_OPTION_VERBOSE + 1) struct tracefs_options_mask; -bool tracefs_option_is_set(const struct tracefs_options_mask *options, - enum tracefs_option_id id); +bool tracefs_option_mask_is_set(const struct tracefs_options_mask *options, + enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_supported(struct tracefs_instance *instance); bool tracefs_option_is_supported(struct tracefs_instance *instance, enum tracefs_option_id id); struct tracefs_options_mask *tracefs_options_get_enabled(struct tracefs_instance *instance); diff --git a/src/tracefs-tools.c b/src/tracefs-tools.c index b6967db..126fc57 100644 --- a/src/tracefs-tools.c +++ b/src/tracefs-tools.c @@ -367,14 +367,14 @@ bool tracefs_option_is_enabled(struct tracefs_instance *instance, enum tracefs_o } /** - * tracefs_option_is_set - Check if given option is set in the bitmask + * tracefs_option_mask_is_set - Check if given option is set in the bitmask * @options: Options bitmask * @id: trace option id * * Returns true if an option with given id is set in the bitmask, * false if it is not set. */ -bool tracefs_option_is_set(const struct tracefs_options_mask *options, +bool tracefs_option_mask_is_set(const struct tracefs_options_mask *options, enum tracefs_option_id id) { if (id > TRACEFS_OPTION_INVALID) diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c index af28779..185ac2a 100644 --- a/utest/tracefs-utest.c +++ b/utest/tracefs-utest.c @@ -547,7 +547,7 @@ static bool check_options_mask_empty(struct tracefs_options_mask *mask) int i; for (i = 1; i < TRACEFS_OPTION_MAX; i++) { - if (tracefs_option_is_set(mask, i)) + if (tracefs_option_mask_is_set(mask, i)) return false; } return true; @@ -580,7 +580,7 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) CU_TEST(strcmp(name, "unknown")); snprintf(file, PATH_MAX, "options/%s", name); - if (tracefs_option_is_set(all, i)) { + if (tracefs_option_mask_is_set(all, i)) { CU_TEST(check_option(instance, i, true, -1)); CU_TEST(tracefs_option_is_supported(instance, i)); } else { @@ -588,7 +588,7 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) CU_TEST(!tracefs_option_is_supported(instance, i)); } - if (tracefs_option_is_set(enabled, i)) { + if (tracefs_option_mask_is_set(enabled, i)) { CU_TEST(check_option(instance, i, true, 1)); CU_TEST(tracefs_option_is_supported(instance, i)); CU_TEST(tracefs_option_is_enabled(instance, i)); @@ -596,7 +596,7 @@ static void test_instance_tracing_options(struct tracefs_instance *instance) CU_TEST(check_option(instance, i, true, 0)); CU_TEST(tracefs_option_enable(instance, i) == 0); CU_TEST(check_option(instance, i, true, 1)); - } else if (tracefs_option_is_set(all_copy, i)) { + } else if (tracefs_option_mask_is_set(all_copy, i)) { CU_TEST(check_option(instance, i, true, 0)); CU_TEST(tracefs_option_is_supported(instance, i)); CU_TEST(!tracefs_option_is_enabled(instance, i));