From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH v3 16/20] trace-cmd library: Decompress file sections on reading
Date: Fri, 8 Oct 2021 07:22:10 +0300 [thread overview]
Message-ID: <20211008042214.977193-17-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20211008042214.977193-1-tz.stoyanov@gmail.com>
When reading sections from trace file v7 - check section flags to find
out if the section is compressed and decompress it.
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
lib/trace-cmd/trace-input.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index fac19bc3..a70bb0e6 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -480,12 +480,15 @@ static struct file_section *section_open(struct tracecmd_input *handle, int id)
if (lseek64(handle->fd, sec->data_offset, SEEK_SET) == (off64_t)-1)
return NULL;
+ if ((sec->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle))
+ return NULL;
return sec;
}
static void section_close(struct tracecmd_input *handle, struct file_section *sec)
{
- /* To Do */
+ if (sec->flags & TRACECMD_SEC_FL_COMPRESS)
+ in_uncompress_reset(handle);
}
static int section_add_or_update(struct tracecmd_input *handle, int id, int flags,
@@ -1108,6 +1111,8 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se
return -1;
section->data_offset = lseek64(handle->fd, 0, SEEK_CUR);
+ if ((section->flags & TRACECMD_SEC_FL_COMPRESS) && in_uncompress_block(handle))
+ return -1;
switch (section->id) {
case TRACECMD_OPTION_HEADER_INFO:
@@ -1133,6 +1138,9 @@ static int handle_section(struct tracecmd_input *handle, struct file_section *se
break;
}
+ if (section->flags & TRACECMD_SEC_FL_COMPRESS)
+ in_uncompress_reset(handle);
+
return ret;
}
--
2.31.1
next prev parent reply other threads:[~2021-10-08 4:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 4:21 [PATCH v3 00/20] Trace file version 7 - compression Tzvetomir Stoyanov (VMware)
2021-10-08 4:21 ` [PATCH v3 01/20] trace-cmd library: Add support for compression algorithms Tzvetomir Stoyanov (VMware)
2021-10-08 4:21 ` [PATCH v3 02/20] trace-cmd library: Internal helpers for compressing data Tzvetomir Stoyanov (VMware)
2021-10-08 4:21 ` [PATCH v3 03/20] trace-cmd library: Internal helpers for uncompressing data Tzvetomir Stoyanov (VMware)
2021-10-08 4:21 ` [PATCH v3 04/20] trace-cmd library: Inherit compression algorithm from input file Tzvetomir Stoyanov (VMware)
2021-10-08 4:21 ` [PATCH v3 05/20] trace-cmd library: New API to configure compression on an output handler Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 06/20] trace-cmd library: Write compression header in the trace file Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 07/20] trace-cmd library: Compress part of " Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 08/20] trace-cmd library: Add local helper function for data compression Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 09/20] trace-cmd library: Compress the trace data Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 10/20] trace-cmd library: Decompress the options section, if it is compressed Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 11/20] trace-cmd library: Read compression header Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 12/20] trace-cmd library: Extend the input handler with trace data decompression context Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 13/20] trace-cmd library: Initialize CPU data decompression logic Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 14/20] trace-cmd library: Add logic for in-memory decompression Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 15/20] trace-cmd library: Read compressed latency data Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` Tzvetomir Stoyanov (VMware) [this message]
2021-10-08 4:22 ` [PATCH v3 17/20] trace-cmd library: Add zlib compression algorithm Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 18/20] trace-cmd list: Show supported compression algorithms Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 19/20] trace-cmd record: Add compression to the trace context Tzvetomir Stoyanov (VMware)
2021-10-08 4:22 ` [PATCH v3 20/20] trace-cmd report: Add new parameter for trace file compression Tzvetomir Stoyanov (VMware)
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=20211008042214.977193-17-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).