[PATCH v3 01/11] libtracefs: Add new public macros for bits manipulations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of the tracefs library APIs may have bit mask parameters. To
simplify the usage of such APIs, generic bit manipulations macros are
added to the library API:
 TRACEFS_BIT_SET
 TRACEFS_BIT_TEST
 TRACEFS_BIT_CLEAR

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
---
 include/tracefs.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/tracefs.h b/include/tracefs.h
index a2cda30..fa7f316 100644
--- a/include/tracefs.h
+++ b/include/tracefs.h
@@ -10,6 +10,10 @@
 #include <sched.h>
 #include <event-parse.h>
 
+#define TRACEFS_BIT_SET(M, B)	do { (M) |= (1ULL << (B)); } while (0)
+#define TRACEFS_BIT_TEST(M, B)	((M) & (1ULL<<(B)))
+#define TRACEFS_BIT_CLEAR(M, B)	do { (M) &= ~(1ULL << (B)); } while (0)
+
 char *tracefs_get_tracing_file(const char *name);
 void tracefs_put_tracing_file(char *name);
 
-- 
2.31.1




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux