Commit d77fac7f authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Arnaldo Carvalho de Melo

perf buildid: Use SBUILD_ID_SIZE macro

Introduce SBUILD_ID_SIZE macro and use it instead of using BUILD_ID_SIZE
* 2 + 1.
Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20150715091428.8915.75265.stgit@localhost.localdomainSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 92f6c72e
...@@ -127,7 +127,7 @@ static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir, ...@@ -127,7 +127,7 @@ static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir,
static int build_id_cache__add_kcore(const char *filename, bool force) static int build_id_cache__add_kcore(const char *filename, bool force)
{ {
char dir[32], sbuildid[BUILD_ID_SIZE * 2 + 1]; char dir[32], sbuildid[SBUILD_ID_SIZE];
char from_dir[PATH_MAX], to_dir[PATH_MAX]; char from_dir[PATH_MAX], to_dir[PATH_MAX];
char *p; char *p;
...@@ -184,7 +184,7 @@ static int build_id_cache__add_kcore(const char *filename, bool force) ...@@ -184,7 +184,7 @@ static int build_id_cache__add_kcore(const char *filename, bool force)
static int build_id_cache__add_file(const char *filename) static int build_id_cache__add_file(const char *filename)
{ {
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[SBUILD_ID_SIZE];
u8 build_id[BUILD_ID_SIZE]; u8 build_id[BUILD_ID_SIZE];
int err; int err;
...@@ -204,7 +204,7 @@ static int build_id_cache__add_file(const char *filename) ...@@ -204,7 +204,7 @@ static int build_id_cache__add_file(const char *filename)
static int build_id_cache__remove_file(const char *filename) static int build_id_cache__remove_file(const char *filename)
{ {
u8 build_id[BUILD_ID_SIZE]; u8 build_id[BUILD_ID_SIZE];
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[SBUILD_ID_SIZE];
int err; int err;
...@@ -276,7 +276,7 @@ static int build_id_cache__fprintf_missing(struct perf_session *session, FILE *f ...@@ -276,7 +276,7 @@ static int build_id_cache__fprintf_missing(struct perf_session *session, FILE *f
static int build_id_cache__update_file(const char *filename) static int build_id_cache__update_file(const char *filename)
{ {
u8 build_id[BUILD_ID_SIZE]; u8 build_id[BUILD_ID_SIZE];
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[SBUILD_ID_SIZE];
int err = 0; int err = 0;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
static int sysfs__fprintf_build_id(FILE *fp) static int sysfs__fprintf_build_id(FILE *fp)
{ {
u8 kallsyms_build_id[BUILD_ID_SIZE]; u8 kallsyms_build_id[BUILD_ID_SIZE];
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[SBUILD_ID_SIZE];
if (sysfs__read_build_id("/sys/kernel/notes", kallsyms_build_id, if (sysfs__read_build_id("/sys/kernel/notes", kallsyms_build_id,
sizeof(kallsyms_build_id)) != 0) sizeof(kallsyms_build_id)) != 0)
...@@ -35,7 +35,7 @@ static int sysfs__fprintf_build_id(FILE *fp) ...@@ -35,7 +35,7 @@ static int sysfs__fprintf_build_id(FILE *fp)
static int filename__fprintf_build_id(const char *name, FILE *fp) static int filename__fprintf_build_id(const char *name, FILE *fp)
{ {
u8 build_id[BUILD_ID_SIZE]; u8 build_id[BUILD_ID_SIZE];
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[SBUILD_ID_SIZE];
if (filename__read_build_id(name, build_id, if (filename__read_build_id(name, build_id,
sizeof(build_id)) != sizeof(build_id)) sizeof(build_id)) != sizeof(build_id))
......
...@@ -124,7 +124,7 @@ static char *build_id__filename(const char *sbuild_id, char *bf, size_t size) ...@@ -124,7 +124,7 @@ static char *build_id__filename(const char *sbuild_id, char *bf, size_t size)
char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size)
{ {
char build_id_hex[BUILD_ID_SIZE * 2 + 1]; char build_id_hex[SBUILD_ID_SIZE];
if (!dso->has_build_id) if (!dso->has_build_id)
return NULL; return NULL;
...@@ -384,7 +384,7 @@ static int build_id_cache__add_b(const u8 *build_id, size_t build_id_size, ...@@ -384,7 +384,7 @@ static int build_id_cache__add_b(const u8 *build_id, size_t build_id_size,
const char *name, bool is_kallsyms, const char *name, bool is_kallsyms,
bool is_vdso) bool is_vdso)
{ {
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[SBUILD_ID_SIZE];
build_id__sprintf(build_id, build_id_size, sbuild_id); build_id__sprintf(build_id, build_id_size, sbuild_id);
......
#ifndef PERF_BUILD_ID_H_ #ifndef PERF_BUILD_ID_H_
#define PERF_BUILD_ID_H_ 1 #define PERF_BUILD_ID_H_ 1
#define BUILD_ID_SIZE 20 #define BUILD_ID_SIZE 20
#define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)
#include "tool.h" #include "tool.h"
#include "strlist.h" #include "strlist.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment