lkml.org 
[lkml]   [2019]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 07/36] libperf: Add perf_mmap__put() function
Em Mon, Oct 07, 2019 at 02:53:15PM +0200, Jiri Olsa escreveu:
> +++ b/tools/perf/lib/mmap.c
> @@ -3,10 +3,12 @@
> #include <internal/mmap.h>
> #include <internal/lib.h>
>
> -void perf_mmap__init(struct perf_mmap *map, bool overwrite)
> +void perf_mmap__init(struct perf_mmap *map, bool overwrite,
> + libperf_unmap_cb_t unmap_cb)
> {
> map->fd = -1;
> map->overwrite = overwrite;
> + map->unmap_cb = unmap_cb;
> refcount_set(&map->refcnt, 0);
> }
>
> @@ -40,9 +42,19 @@ void perf_mmap__munmap(struct perf_mmap *map)
> map->fd = -1;
> refcount_set(&map->refcnt, 0);
> }
> + if (map && map->unmap_cb)
> + map->unmap_cb(map);
> }
>
> void perf_mmap__get(struct perf_mmap *map)
> {
> refcount_inc(&map->refcnt);
> }
> +
> +void perf_mmap__put(struct perf_mmap *map)
> +{
> + BUG_ON(map->base && refcount_read(&map->refcnt) == 0);

Added missing linux/kernel.h to this file to pick up BUG_ON().

- Arnaldo

\
 
 \ /
  Last update: 2019-10-10 15:12    [W:0.429 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site