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]
Date:	Wed, 3 Jun 2015 12:31:43 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
Cc:	mingo@...hat.com, ak@...ux.intel.com,
	Michael Ellerman <mpe@...erman.id.au>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	namhyung@...nel.org, linuxppc-dev@...ts.ozlabs.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v13 06/14] perf, tools: Support alias descriptions

On Tue, Jun 02, 2015 at 10:12:06AM -0700, Sukadev Bhattiprolu wrote:

SNIP

> @@ -1033,37 +1064,49 @@ void print_pmu_events(const char *event_glob, bool name_only)
>  						       event_glob))))
>  				continue;
>  
> -			if (is_cpu && !name_only)
> +			if (is_cpu && !name_only && !alias->desc)
>  				name = format_alias_or(buf, sizeof(buf), pmu, alias);
>  
> -			aliases[j] = strdup(name);
> -			if (aliases[j] == NULL)
> -				goto out_enomem;
> +			aliases[j].name = name;
> +			if (is_cpu && !name_only && !alias->desc)
> +				aliases[j].name = format_alias_or(buf, sizeof(buf),
> +								  pmu, alias);
> +			aliases[j].name = strdup(aliases[j].name);
> +			/* failure harmless */

yea but we still try to care everywhere.. ;-)
we would print "NULL" for name in the code below right?

please keep the above pattern:

			if (aliases[j].name == NULL)
				goto out_enomem;



> +			aliases[j].desc = alias->desc;
>  			j++;
>  		}
>  		if (pmu->selectable) {
>  			char *s;
>  			if (asprintf(&s, "%s//", pmu->name) < 0)
>  				goto out_enomem;
> -			aliases[j] = s;
> +			aliases[j].name = s;
>  			j++;
>  		}
>  	}
>  	len = j;
> -	qsort(aliases, len, sizeof(char *), cmp_string);
> +	qsort(aliases, len, sizeof(struct pair), cmp_pair);
>  	for (j = 0; j < len; j++) {
>  		if (name_only) {
> -			printf("%s ", aliases[j]);
> +			printf("%s ", aliases[j].name);
>  			continue;
>  		}
> -		printf("  %-50s [Kernel PMU event]\n", aliases[j]);
> +		if (aliases[j].desc) {
> +			if (numdesc++ == 0)
> +				printf("\n");
> +			printf("  %-50s\n", aliases[j].name);
> +			printf("%*s", 8, "[");
> +			wordwrap(aliases[j].desc, 8, columns, 0);
> +			printf("]\n");
> +		} else
> +			printf("  %-50s [Kernel PMU event]\n", aliases[j].name);
>  		printed++;

SNIP
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ