1a113b103SEmmanuel Vadot /*-
2a113b103SEmmanuel Vadot * Copyright (c) 2020 The FreeBSD Foundation
3a113b103SEmmanuel Vadot *
4a113b103SEmmanuel Vadot * This software was developed by Emmanuel Vadot under sponsorship
5a113b103SEmmanuel Vadot * from the FreeBSD Foundation.
6a113b103SEmmanuel Vadot *
7a113b103SEmmanuel Vadot * Redistribution and use in source and binary forms, with or without
8a113b103SEmmanuel Vadot * modification, are permitted provided that the following conditions
9a113b103SEmmanuel Vadot * are met:
10a113b103SEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright
11a113b103SEmmanuel Vadot * notice, this list of conditions and the following disclaimer.
12a113b103SEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright
13a113b103SEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the
14a113b103SEmmanuel Vadot * documentation and/or other materials provided with the distribution.
15a113b103SEmmanuel Vadot *
16a113b103SEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17a113b103SEmmanuel Vadot * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18a113b103SEmmanuel Vadot * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19a113b103SEmmanuel Vadot * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20a113b103SEmmanuel Vadot * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21a113b103SEmmanuel Vadot * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22a113b103SEmmanuel Vadot * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23a113b103SEmmanuel Vadot * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24a113b103SEmmanuel Vadot * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25a113b103SEmmanuel Vadot * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26a113b103SEmmanuel Vadot * SUCH DAMAGE.
27a113b103SEmmanuel Vadot */
28a113b103SEmmanuel Vadot
29307f78f3SVladimir Kondratyev #ifndef _LINUXKPI_LINUX_PAGEMAP_H_
30307f78f3SVladimir Kondratyev #define _LINUXKPI_LINUX_PAGEMAP_H_
31a113b103SEmmanuel Vadot
32a113b103SEmmanuel Vadot #include <linux/mm.h>
33b829f450SEmmanuel Vadot #include <linux/highmem.h>
343d47e3bfSJean-Sébastien Pédron #include <linux/vmalloc.h>
35a113b103SEmmanuel Vadot
36*4e0d3f7bSJean-Sébastien Pédron #define invalidate_mapping_pages(...) \
37*4e0d3f7bSJean-Sébastien Pédron linux_invalidate_mapping_pages(__VA_ARGS__)
38*4e0d3f7bSJean-Sébastien Pédron
39*4e0d3f7bSJean-Sébastien Pédron unsigned long linux_invalidate_mapping_pages(vm_object_t obj, pgoff_t start,
40*4e0d3f7bSJean-Sébastien Pédron pgoff_t end);
41*4e0d3f7bSJean-Sébastien Pédron
42a113b103SEmmanuel Vadot static inline void
release_pages(struct page ** pages,int nr)43a113b103SEmmanuel Vadot release_pages(struct page **pages, int nr)
44a113b103SEmmanuel Vadot {
45a113b103SEmmanuel Vadot int i;
46a113b103SEmmanuel Vadot
47a113b103SEmmanuel Vadot for (i = 0; i < nr; i++)
48a113b103SEmmanuel Vadot put_page(pages[i]);
49a113b103SEmmanuel Vadot }
50a113b103SEmmanuel Vadot
514aa82e43SEmmanuel Vadot static inline void
mapping_clear_unevictable(vm_object_t mapping)524aa82e43SEmmanuel Vadot mapping_clear_unevictable(vm_object_t mapping)
534aa82e43SEmmanuel Vadot {
544aa82e43SEmmanuel Vadot }
554aa82e43SEmmanuel Vadot
56a113b103SEmmanuel Vadot #endif
57