diff mbox series

[v4,5/5] libtracefs: Rename tracefs_option_is_set()

Message ID 20210409180423.72497-6-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series Refactor the APIs for tracing options | expand

Commit Message

Yordan Karadzhov April 9, 2021, 6:04 p.m. UTC
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) <y.karadz@gmail.com>
---
 Documentation/libtracefs-option-bits.txt | 10 +++++-----
 include/tracefs.h                        |  4 ++--
 src/tracefs-tools.c                      |  4 ++--
 utest/tracefs-utest.c                    |  8 ++++----
 4 files changed, 13 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/libtracefs-option-bits.txt b/Documentation/libtracefs-option-bits.txt
index d713a5e..10e832e 100644
--- a/Documentation/libtracefs-option-bits.txt
+++ b/Documentation/libtracefs-option-bits.txt
@@ -3,7 +3,7 @@  libtracefs(3)
 
 NAME
 ----
-tracefs_option_set, tracefs_option_clear, tracefs_option_is_set -
+tracefs_option_set, tracefs_option_clear, tracefs_option_mask_is_set -
 Set, clear, check option in a bitmask.
 
 SYNOPSIS
@@ -14,7 +14,7 @@  SYNOPSIS
 
 void *tracefs_option_set*(struct tracefs_options_mask pass:[*]_options_, enum tracefs_option_id _id_);
 void *tracefs_option_clear*(struct tracefs_options_mask pass:[*]_options_, enum tracefs_option_id _id_);
-bool *tracefs_option_is_set*(struct tracefs_options_mask _options_, enum tracefs_option_id _id_);
+bool *tracefs_option_mask_is_set*(struct tracefs_options_mask _options_, enum tracefs_option_id _id_);
 --
 
 DESCRIPTION
@@ -27,12 +27,12 @@  _options_ bitmask.
 The _tracefs_option_clear()_ function clears the bit, corresponding to the option with _id_ in the
 _options_ bitmask.
 
-The _tracefs_option_is_set()_ function checks if the bit, corresponding to the option with _id_ is
+The _tracefs_option_mask_is_set()_ function checks if the bit, corresponding to the option with _id_ is
 set in the _options_ bitmask.
 
 RETURN VALUE
 ------------
-The _tracefs_option_is_set()_ function returns true if the bit is set, false otherwise.
+The _tracefs_option_mask_is_set()_ function returns true if the bit is set, false otherwise.
 
 EXAMPLE
 -------
@@ -45,7 +45,7 @@  memset(&options, 0, sizeof(options));
 ...
 tracefs_option_set(&options, TRACEFS_OPTION_EVENT_FORK | TRACEFS_OPTION_FUNCTION_FORK);
 ...
-if (tracefs_option_is_set(options, TRACEFS_OPTION_EVENT_FORK))
+if (tracefs_option_mask_is_set(options, TRACEFS_OPTION_EVENT_FORK))
 	tracefs_option_clear(&options, TRACEFS_OPTION_EVENT_FORK);
 ...
 --
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 f539323..15ad3b6 100644
--- a/src/tracefs-tools.c
+++ b/src/tracefs-tools.c
@@ -359,14 +359,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));