perf symbols: Constify some DSO methods parameters
Those methods are not supposed to change the data structures they manipulate, so make that clearer by using the const qualifier in the function signature and in some variables. Suggested-by: Ingo Molnar <mingo@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-j7oyakex7zy3r82h33rdw25x@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ee021d4223
commit
3344996e4f
|
@ -89,7 +89,7 @@ int build_id__sprintf(const u8 *build_id, int len, char *bf)
|
|||
return raw - build_id;
|
||||
}
|
||||
|
||||
char *dso__build_id_filename(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];
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ extern struct perf_tool build_id__mark_dso_hit_ops;
|
|||
struct dso;
|
||||
|
||||
int build_id__sprintf(const u8 *build_id, int len, char *bf);
|
||||
char *dso__build_id_filename(struct dso *dso, char *bf, size_t size);
|
||||
char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size);
|
||||
|
||||
int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
|
||||
struct perf_sample *sample, struct perf_evsel *evsel,
|
||||
|
|
|
@ -28,7 +28,7 @@ char dso__symtab_origin(const struct dso *dso)
|
|||
return origin[dso->symtab_type];
|
||||
}
|
||||
|
||||
int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
|
||||
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
|
||||
char *root_dir, char *file, size_t size)
|
||||
{
|
||||
char build_id_hex[BUILD_ID_SIZE * 2 + 1];
|
||||
|
@ -200,11 +200,10 @@ dso_cache__free(struct rb_root *root)
|
|||
}
|
||||
}
|
||||
|
||||
static struct dso_cache*
|
||||
dso_cache__find(struct rb_root *root, u64 offset)
|
||||
static struct dso_cache *dso_cache__find(const struct rb_root *root, u64 offset)
|
||||
{
|
||||
struct rb_node **p = &root->rb_node;
|
||||
struct rb_node *parent = NULL;
|
||||
struct rb_node * const *p = &root->rb_node;
|
||||
const struct rb_node *parent = NULL;
|
||||
struct dso_cache *cache;
|
||||
|
||||
while (*p != NULL) {
|
||||
|
@ -566,7 +565,7 @@ void dsos__add(struct list_head *head, struct dso *dso)
|
|||
list_add_tail(&dso->node, head);
|
||||
}
|
||||
|
||||
struct dso *dsos__find(struct list_head *head, const char *name, bool cmp_short)
|
||||
struct dso *dsos__find(const struct list_head *head, const char *name, bool cmp_short)
|
||||
{
|
||||
struct dso *pos;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void dso__read_running_kernel_build_id(struct dso *dso,
|
|||
int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir);
|
||||
|
||||
char dso__symtab_origin(const struct dso *dso);
|
||||
int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
|
||||
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
|
||||
char *root_dir, char *file, size_t size);
|
||||
|
||||
int dso__data_fd(struct dso *dso, struct machine *machine);
|
||||
|
@ -143,7 +143,7 @@ struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
|
|||
const char *short_name, int dso_type);
|
||||
|
||||
void dsos__add(struct list_head *head, struct dso *dso);
|
||||
struct dso *dsos__find(struct list_head *head, const char *name,
|
||||
struct dso *dsos__find(const struct list_head *head, const char *name,
|
||||
bool cmp_short);
|
||||
struct dso *__dsos__findnew(struct list_head *head, const char *name);
|
||||
bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
|
||||
|
|
Loading…
Reference in a new issue