All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 1/5] trace-cmd: Create TRACECMD_MAGIC macro for magic number of trace-cmd data file
Date: Wed, 22 Jan 2020 12:12:51 -0500	[thread overview]
Message-ID: <20200122171329.057095088@goodmis.org> (raw)
In-Reply-To: 20200122171250.252248737@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Instead of copying the magic number around different files, just declare a
macro for it in the exported trace-cmd header and use that.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/trace-cmd/trace-cmd.h | 2 ++
 lib/trace-cmd/trace-input.c   | 2 +-
 tracecmd/trace-dump.c         | 3 +--
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index ee8cdc75a9b2..1f5a98b3f7af 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -8,6 +8,8 @@
 
 #include "traceevent/event-parse.h"
 
+#define TRACECMD_MAGIC { 23, 8, 68 }
+
 #define ARRAY_SIZE(_a) (sizeof(_a) / sizeof((_a)[0]))
 #define __weak __attribute__((weak))
 #define __noreturn __attribute__((noreturn))
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 68da3a776d19..6d7f0feff3c0 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -2861,7 +2861,7 @@ struct hook_list *tracecmd_hooks(struct tracecmd_input *handle)
 struct tracecmd_input *tracecmd_alloc_fd(int fd)
 {
 	struct tracecmd_input *handle;
-	char test[] = { 23, 8, 68 };
+	char test[] = TRACECMD_MAGIC;
 	unsigned int page_size;
 	char *version;
 	char buf[BUFSIZ];
diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
index d95b34c12776..ed6705886e39 100644
--- a/tracecmd/trace-dump.c
+++ b/tracecmd/trace-dump.c
@@ -14,7 +14,6 @@
 #include "trace-local.h"
 
 #define DEF_INPUT_FILE	"trace.dat"
-#define MAGIC_HEAD	{ 0x17, 0x08, 0x44 }
 #define TRACING_STR	"tracing"
 #define HEAD_PAGE_STR	"header_page"
 #define HEAD_PAGE_EVENT	"header_event"
@@ -142,7 +141,7 @@ static int read_file_number(int fd, void *digit, int size)
 
 static void dump_initial_format(int fd)
 {
-	char magic[] = MAGIC_HEAD;
+	char magic[] = TRACECMD_MAGIC;
 	char buf[DUMP_SIZE];
 	int val4;
 
-- 
2.24.1



  reply	other threads:[~2020-01-22 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 17:12 [PATCH 0/5] trace-cmd: A few updates Steven Rostedt
2020-01-22 17:12 ` Steven Rostedt [this message]
2020-01-22 17:12 ` [PATCH 2/5] trace-cmd: Place "trace.dat" into the macro DEFAULT_INPUT_FILE Steven Rostedt
2020-01-22 17:12 ` [PATCH 3/5] trace-cmd: Add installation of ld.conf.d file for library paths Steven Rostedt
2020-01-22 17:22   ` Steven Rostedt
2020-01-22 17:12 ` [PATCH 4/5] trace-cmd: Have libtracecmd.so include libtraceevent Steven Rostedt
2020-01-22 17:12 ` [PATCH 5/5] trace-cmd: Remove unused trace_util function declarations Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200122171329.057095088@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.