[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250925150427.67394-13-johannes.thumshirn@wdc.com>
Date: Thu, 25 Sep 2025 17:04:17 +0200
From: Johannes Thumshirn <johannes.thumshirn@....com>
To: Jens Axboe <axboe@...nel.dk>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
linux-btrace@...r.kernel.org,
John Garry <john.g.garry@...cle.com>,
Hannes Reinecke <hare@...e.de>,
Damien Le Moal <dlemoal@...nel.org>,
Christoph Hellwig <hch@....de>,
Naohiro Aota <naohiro.aota@....com>,
Shinichiro Kawasaki <shinichiro.kawasaki@....com>,
Chaitanya Kulkarni <chaitanyak@...dia.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH blktrace v2 12/22] blkiomon: read 'magic' first
Similar to blkparse, read the 'magic' portion of 'struct blk_io_trace'
first when reading the trace.
This is a preparation of supporting multiple trace protocol versions.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....com>
---
blkiomon.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/blkiomon.c b/blkiomon.c
index f8b0c9d..05f2d00 100644
--- a/blkiomon.c
+++ b/blkiomon.c
@@ -460,19 +460,28 @@ static int blkiomon_do_fifo(void)
bit = &t->bit;
while (up) {
+ __u32 magic;
+
+ if (fread(&magic, sizeof(magic), 1, ifp) != 1) {
+ if (!feof(ifp))
+ fprintf(stderr,
+ "blkiomon: could not read trace");
+ break;
+ }
if (fread(bit, sizeof(*bit), 1, ifp) != 1) {
if (!feof(ifp))
fprintf(stderr,
"blkiomon: could not read trace");
break;
}
+ bit->magic = magic;
if (ferror(ifp)) {
clearerr(ifp);
fprintf(stderr, "blkiomon: error while reading trace");
break;
}
- if (data_is_native == -1 && check_data_endianness(bit->magic)) {
+ if (data_is_native == -1 && check_data_endianness(magic)) {
fprintf(stderr, "blkiomon: endianess problem\n");
break;
}
--
2.51.0
Powered by blists - more mailing lists