xref: /openbsd/sys/dev/pci/drm/include/linux/pagevec.h (revision d415bd75)
1 /* Public domain. */
2 
3 #ifndef _LINUX_PAGEVEC_H
4 #define _LINUX_PAGEVEC_H
5 
6 #include <sys/types.h>
7 #include <sys/systm.h>
8 #include <sys/errno.h>
9 
10 #define PAGEVEC_SIZE 15
11 
12 struct pagevec {
13 	uint8_t	nr;
14 	struct vm_page *pages[PAGEVEC_SIZE];
15 };
16 
17 void __pagevec_release(struct pagevec *);
18 
19 static inline unsigned int
20 pagevec_space(struct pagevec *pvec)
21 {
22 	return PAGEVEC_SIZE - pvec->nr;
23 }
24 
25 static inline void
26 pagevec_init(struct pagevec *pvec)
27 {
28 	pvec->nr = 0;
29 }
30 
31 static inline void
32 pagevec_reinit(struct pagevec *pvec)
33 {
34 	pvec->nr = 0;
35 }
36 
37 static inline unsigned int
38 pagevec_count(struct pagevec *pvec)
39 {
40 	return pvec->nr;
41 }
42 
43 static inline unsigned int
44 pagevec_add(struct pagevec *pvec, struct vm_page *page)
45 {
46 	pvec->pages[pvec->nr++] = page;
47 	return PAGEVEC_SIZE - pvec->nr;
48 }
49 
50 #endif
51