5 * Phillip Lougher <phillip@squashfs.org.uk>
7 * This work is licensed under the terms of the GNU GPL, version 2. See
8 * the COPYING file in the top-level directory.
11 #ifndef CONFIG_SQUASHFS_FILE_DIRECT
12 struct squashfs_page_actor
{
19 static inline struct squashfs_page_actor
*squashfs_page_actor_init(void **page
,
20 int pages
, int length
)
22 struct squashfs_page_actor
*actor
= kmalloc(sizeof(*actor
), GFP_KERNEL
);
27 actor
->length
= length
? : pages
* PAGE_CACHE_SIZE
;
34 static inline void *squashfs_first_page(struct squashfs_page_actor
*actor
)
37 return actor
->page
[0];
40 static inline void *squashfs_next_page(struct squashfs_page_actor
*actor
)
42 return actor
->next_page
== actor
->pages
? NULL
:
43 actor
->page
[actor
->next_page
++];
46 static inline void squashfs_finish_page(struct squashfs_page_actor
*actor
)
51 struct squashfs_page_actor
{
57 void *(*squashfs_first_page
)(struct squashfs_page_actor
*);
58 void *(*squashfs_next_page
)(struct squashfs_page_actor
*);
59 void (*squashfs_finish_page
)(struct squashfs_page_actor
*);
65 extern struct squashfs_page_actor
*squashfs_page_actor_init(void **, int, int);
66 extern struct squashfs_page_actor
*squashfs_page_actor_init_special(struct page
68 static inline void *squashfs_first_page(struct squashfs_page_actor
*actor
)
70 return actor
->squashfs_first_page(actor
);
72 static inline void *squashfs_next_page(struct squashfs_page_actor
*actor
)
74 return actor
->squashfs_next_page(actor
);
76 static inline void squashfs_finish_page(struct squashfs_page_actor
*actor
)
78 actor
->squashfs_finish_page(actor
);