lkml.org 
[lkml]   [2014]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] perf tools: Preparation for compressed kernel module support
On Mon, Nov 03, 2014 at 04:27:51PM +0900, Namhyung Kim wrote:

SNIP

> +static int decompress_dummy(const char *input __maybe_unused,
> + int output __maybe_unused)
> +{
> + return -1;
> +}
> +
> +static const struct {
> + const char *fmt;
> + int (*decompress)(const char *input, int output);
> +} compressions[] = {
> + { "gz", decompress_dummy },
> +};
> +
> +bool is_supported_compression(const char *ext)
> +{
> + unsigned i;
> +
> + for (i = 0; i < ARRAY_SIZE(compressions); i++) {
> + if (!strcmp(ext, compressions[i].fmt))
> + return true;
> + }
> + return false;
> +}
> +
> +bool is_kmodule_extension(const char *ext)
> +{
> + if (!strcmp(ext, "ko"))
> + return true;
> +
> + if (ext[2] == '\0' || (ext[2] == '.' && is_supported_compression(ext+3)))
> + return true;

I got stuck in here.. so any 2 chars string is kernel module extension?
plus how do u know ext[3] (or [2]) is valid memory?

thanks,
jirka


\
 
 \ /
  Last update: 2014-11-03 15:01    [W:0.148 / U:1.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site