opnsense-src/sys/compat/linuxkpi/common/include/linux/pagemap.h
Jean-Sébastien Pédron 843107faca linuxkpi: Move invalidate_mapping_pages() to <linux/pagemap.h>
[Why]
This is consistent with Linux.

[How]
The definition is moved from <linux/shmem_fs.h> to <linux/pagemap.h> and
the latter is included from the former. This is how it is done on Linux.

Prototypes are also expanded with argument names. I got a build failure
in the DRM 5.18 drivers because the compiler considered that the
`pgoff_t` argument was there twice.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43018

(cherry picked from commit 4e0d3f7b3c3295e51ded2bab39f36842f405b4eb)
2024-02-17 23:58:35 +03:00

56 lines
1.9 KiB
C

/*-
* Copyright (c) 2020 The FreeBSD Foundation
*
* This software was developed by Emmanuel Vadot under sponsorship
* from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _LINUXKPI_LINUX_PAGEMAP_H_
#define _LINUXKPI_LINUX_PAGEMAP_H_
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/vmalloc.h>
#define invalidate_mapping_pages(...) \
linux_invalidate_mapping_pages(__VA_ARGS__)
unsigned long linux_invalidate_mapping_pages(vm_object_t obj, pgoff_t start,
pgoff_t end);
static inline void
release_pages(struct page **pages, int nr)
{
int i;
for (i = 0; i < nr; i++)
put_page(pages[i]);
}
static inline void
mapping_clear_unevictable(vm_object_t mapping)
{
}
#endif