summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/include/linux/pagevec.h
blob: 27b8631338afb5a8102c94bfd9f4b3a0ca75f74c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Public domain. */

#ifndef _LINUX_PAGEVEC_H
#define _LINUX_PAGEVEC_H

#include <sys/types.h>
#include <sys/systm.h>
#include <sys/errno.h>

#define PAGEVEC_SIZE 15

struct pagevec {
	uint8_t	nr;
	struct vm_page *pages[PAGEVEC_SIZE];
};

void __pagevec_release(struct pagevec *);

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 vm_page *page)
{
	pvec->pages[pvec->nr++] = page;
	return PAGEVEC_SIZE - pvec->nr;
}

#endif