opnsense-src/sys/compat/linuxkpi/common/include/linux/pagevec.h
Bjoern A. Zeeb 9e9c682ff3 LinuxKPI: reduce usage of struct vm_page and vm_page_t
We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41255
2023-08-07 00:55:30 +00:00

69 lines
1.1 KiB
C

/* Public domain. */
#ifndef _LINUXKPI_LINUX_PAGEVEC_H_
#define _LINUXKPI_LINUX_PAGEVEC_H_
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/errno.h>
#include <linux/pagemap.h>
#define PAGEVEC_SIZE 15
struct pagevec {
uint8_t nr;
struct page *pages[PAGEVEC_SIZE];
};
static inline unsigned int
pagevec_space(struct pagevec *pvec)
{
return PAGEVEC_SIZE - pvec->nr;
}
static inline void
pagevec_init(struct pagevec *pvec)
{
pvec->nr = 0;
}
static inline void
pagevec_reinit(struct pagevec *pvec)
{
pvec->nr = 0;
}
static inline unsigned int
pagevec_count(struct pagevec *pvec)
{
return pvec->nr;
}
static inline unsigned int
pagevec_add(struct pagevec *pvec, struct page *page)
{
pvec->pages[pvec->nr++] = page;
return PAGEVEC_SIZE - pvec->nr;
}
static inline void
__pagevec_release(struct pagevec *pvec)
{
release_pages(pvec->pages, pagevec_count(pvec));
pagevec_reinit(pvec);
}
static inline void
pagevec_release(struct pagevec *pvec)
{
if (pagevec_count(pvec))
__pagevec_release(pvec);
}
static inline void
check_move_unevictable_pages(struct pagevec *pvec)
{
}
#endif /* _LINUXKPI_LINUX_PAGEVEC_H_ */