^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __PERF_DSOS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __PERF_DSOS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "rwsem.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct dso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) struct dso_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * DSOs are put into both a list for fast iteration and rbtree for fast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * long name lookup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) struct dsos {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct list_head head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) struct rb_root root; /* rbtree root sorted by long name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) struct rw_semaphore lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) void __dsos__add(struct dsos *dsos, struct dso *dso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) void dsos__add(struct dsos *dsos, struct dso *dso);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct dso *__dsos__addnew(struct dsos *dsos, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct dso *__dsos__find(struct dsos *dsos, const char *name, bool cmp_short);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, struct dso_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct dso *__dsos__findnew_link_by_longname_id(struct rb_root *root, struct dso *dso,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) const char *name, struct dso_id *id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) bool (skip)(struct dso *dso, int parm), int parm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) size_t __dsos__fprintf(struct list_head *head, FILE *fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #endif /* __PERF_DSOS */