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
| ||
|
Date: Wed, 22 Oct 2014 15:44:18 +0900 From: Namhyung Kim <namhyung@...nel.org> To: Wang Nan <wangnan0@...wei.com> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>, Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Jiri Olsa <jolsa@...hat.com>, Adrian Hunter <adrian.hunter@...el.com>, Namhyung Kim <namhyung.kim@....com>, Waiman Long <Waiman.Long@...com>, <linux-kernel@...r.kernel.org>, Li Zefan <lizefan@...wei.com> Subject: Re: [PATCH] perf tools: makes CPUINFO_PROC to array for different kernel version Hi Wang, On Thu, 16 Oct 2014 11:08:43 +0800, Wang Nan wrote: > After kerne 3.7 (commit b4b8f770eb10a1bccaf8aa0ec1956e2dd7ed1e0a), > /proc/cpuinfo replcae 'Processor' to 'model name'. This patch makes > CPUINFO_PROC to an array and provides two choices for ARM, make it > compatible for different kernel version. > > Signed-off-by: Wang Nan <wangnan0@...wei.com> > -static int write_cpudesc(int fd, struct perf_header *h __maybe_unused, > - struct perf_evlist *evlist __maybe_unused) > +static int __write_cpudesc(int fd, struct perf_header *h __maybe_unused, > + struct perf_evlist *evlist __maybe_unused, const char *cpuinfo_proc) You don't need to pass @h and @evlist if they're not used. > { > -#ifndef CPUINFO_PROC > -#define CPUINFO_PROC NULL > -#endif > FILE *file; > char *buf = NULL; > char *s, *p; > - const char *search = CPUINFO_PROC; > + const char *search = cpuinfo_proc; > size_t len = 0; > int ret = -1; > > @@ -640,6 +637,23 @@ done: > return ret; > } > > +static int write_cpudesc(int fd, struct perf_header *h __maybe_unused, > + struct perf_evlist *evlist __maybe_unused) > +{ > +#ifndef CPUINFO_PROC > +#define CPUINFO_PROC {"model name", } > +#endif > + const char *cpuinfo_procs[] = CPUINFO_PROC; > + unsigned int i; Please put a blank line between declaration and the function body. Other than that, looks good to me. Thanks, Namhyung > + for (i = 0; i < ARRAY_SIZE(cpuinfo_procs); i++) { > + int ret; > + ret = __write_cpudesc(fd, h, evlist, cpuinfo_procs[i]); > + if (ret >= 0) > + return ret; > + } > + return -1; > +} > + > static int write_nrcpus(int fd, struct perf_header *h __maybe_unused, > struct perf_evlist *evlist __maybe_unused) > { -- 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