builtin-buildid-cache.c (a11c51acc52822754d66a11c15f6f6edd4d23c55) builtin-buildid-cache.c (0b5a7935f3b5b7d40293b02c3e552f3d67af208b)
1/*
2 * builtin-buildid-cache.c
3 *
4 * Builtin buildid-cache command: Manages build-id cache
5 *
6 * Copyright (C) 2010, Red Hat Inc.
7 * Copyright (C) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
8 */

--- 11 unchanged lines hidden (view full) ---

20#include "util/strlist.h"
21#include "util/build-id.h"
22#include "util/session.h"
23#include "util/symbol.h"
24
25static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid)
26{
27 char root_dir[PATH_MAX];
1/*
2 * builtin-buildid-cache.c
3 *
4 * Builtin buildid-cache command: Manages build-id cache
5 *
6 * Copyright (C) 2010, Red Hat Inc.
7 * Copyright (C) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
8 */

--- 11 unchanged lines hidden (view full) ---

20#include "util/strlist.h"
21#include "util/build-id.h"
22#include "util/session.h"
23#include "util/symbol.h"
24
25static int build_id_cache__kcore_buildid(const char *proc_dir, char *sbuildid)
26{
27 char root_dir[PATH_MAX];
28 char notes[PATH_MAX];
29 u8 build_id[BUILD_ID_SIZE];
30 char *p;
31
32 strlcpy(root_dir, proc_dir, sizeof(root_dir));
33
34 p = strrchr(root_dir, '/');
35 if (!p)
36 return -1;
37 *p = '\0';
28 char *p;
29
30 strlcpy(root_dir, proc_dir, sizeof(root_dir));
31
32 p = strrchr(root_dir, '/');
33 if (!p)
34 return -1;
35 *p = '\0';
38
39 scnprintf(notes, sizeof(notes), "%s/sys/kernel/notes", root_dir);
40
41 if (sysfs__read_build_id(notes, build_id, sizeof(build_id)))
42 return -1;
43
44 build_id__sprintf(build_id, sizeof(build_id), sbuildid);
45
46 return 0;
36 return sysfs__sprintf_build_id(root_dir, sbuildid);
47}
48
49static int build_id_cache__kcore_dir(char *dir, size_t sz)
50{
51 struct timeval tv;
52 struct tm tm;
53 char dt[32];
54

--- 78 unchanged lines hidden (view full) ---

133
134 strlcpy(from_dir, filename, sizeof(from_dir));
135
136 p = strrchr(from_dir, '/');
137 if (!p || strcmp(p + 1, "kcore"))
138 return -1;
139 *p = '\0';
140
37}
38
39static int build_id_cache__kcore_dir(char *dir, size_t sz)
40{
41 struct timeval tv;
42 struct tm tm;
43 char dt[32];
44

--- 78 unchanged lines hidden (view full) ---

123
124 strlcpy(from_dir, filename, sizeof(from_dir));
125
126 p = strrchr(from_dir, '/');
127 if (!p || strcmp(p + 1, "kcore"))
128 return -1;
129 *p = '\0';
130
141 if (build_id_cache__kcore_buildid(from_dir, sbuildid))
131 if (build_id_cache__kcore_buildid(from_dir, sbuildid) < 0)
142 return -1;
143
144 scnprintf(to_dir, sizeof(to_dir), "%s/[kernel.kcore]/%s",
145 buildid_dir, sbuildid);
146
147 if (!force &&
148 !build_id_cache__kcore_existing(from_dir, to_dir, sizeof(to_dir))) {
149 pr_debug("same kcore found in %s\n", to_dir);

--- 299 unchanged lines hidden ---
132 return -1;
133
134 scnprintf(to_dir, sizeof(to_dir), "%s/[kernel.kcore]/%s",
135 buildid_dir, sbuildid);
136
137 if (!force &&
138 !build_id_cache__kcore_existing(from_dir, to_dir, sizeof(to_dir))) {
139 pr_debug("same kcore found in %s\n", to_dir);

--- 299 unchanged lines hidden ---