lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201126175137.GE70905@kernel.org>
Date:   Thu, 26 Nov 2020 14:51:37 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     Ian Rogers <irogers@...gle.com>,
        lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Song Liu <songliubraving@...com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexey Budankov <alexey.budankov@...ux.intel.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [PATCH 20/25] perf tools: Add is_perf_data function

Em Thu, Nov 26, 2020 at 06:00:21PM +0100, Jiri Olsa escreveu:
> Adding is_perf_data function that returns true if
> the given path is perf data file. It will be used
> in following patches.

Thanks, applied.

- Arnaldo

 
> Acked-by: Ian Rogers <irogers@...gle.com>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
>  tools/perf/util/data.c | 19 +++++++++++++++++++
>  tools/perf/util/data.h |  1 +
>  2 files changed, 20 insertions(+)
> 
> diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
> index 05bbcb663c41..f29af4fc3d09 100644
> --- a/tools/perf/util/data.c
> +++ b/tools/perf/util/data.c
> @@ -492,3 +492,22 @@ char *perf_data__kallsyms_name(struct perf_data *data)
>  
>  	return kallsyms_name;
>  }
> +
> +bool is_perf_data(const char *path)
> +{
> +	bool ret = false;
> +	FILE *file;
> +	u64 magic;
> +
> +	file = fopen(path, "r");
> +	if (!file)
> +		return false;
> +
> +	if (fread(&magic, 1, 8, file) < 8)
> +		goto out;
> +
> +	ret = is_perf_magic(magic);
> +out:
> +	fclose(file);
> +	return ret;
> +}
> diff --git a/tools/perf/util/data.h b/tools/perf/util/data.h
> index c563fcbb0288..62a3e66fbee8 100644
> --- a/tools/perf/util/data.h
> +++ b/tools/perf/util/data.h
> @@ -98,4 +98,5 @@ int perf_data__update_dir(struct perf_data *data);
>  unsigned long perf_data__size(struct perf_data *data);
>  int perf_data__make_kcore_dir(struct perf_data *data, char *buf, size_t buf_sz);
>  char *perf_data__kallsyms_name(struct perf_data *data);
> +bool is_perf_data(const char *path);
>  #endif /* __PERF_DATA_H */
> -- 
> 2.26.2
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ