1 /* SPDX-License-Identifier: GPL-2.0-only */
6 * Phillip Lougher <phillip@squashfs.org.uk>
9 #ifndef CONFIG_SQUASHFS_FILE_DIRECT
10 struct squashfs_page_actor
{
17 static inline struct squashfs_page_actor
*squashfs_page_actor_init(void **page
,
18 int pages
, int length
)
20 struct squashfs_page_actor
*actor
= kmalloc(sizeof(*actor
), GFP_KERNEL
);
25 actor
->length
= length
? : pages
* PAGE_SIZE
;
32 static inline void *squashfs_first_page(struct squashfs_page_actor
*actor
)
35 return actor
->page
[0];
38 static inline void *squashfs_next_page(struct squashfs_page_actor
*actor
)
40 return actor
->next_page
== actor
->pages
? NULL
:
41 actor
->page
[actor
->next_page
++];
44 static inline void squashfs_finish_page(struct squashfs_page_actor
*actor
)
49 struct squashfs_page_actor
{
55 void *(*squashfs_first_page
)(struct squashfs_page_actor
*);
56 void *(*squashfs_next_page
)(struct squashfs_page_actor
*);
57 void (*squashfs_finish_page
)(struct squashfs_page_actor
*);
63 extern struct squashfs_page_actor
*squashfs_page_actor_init(void **, int, int);
64 extern struct squashfs_page_actor
*squashfs_page_actor_init_special(struct page
66 static inline void *squashfs_first_page(struct squashfs_page_actor
*actor
)
68 return actor
->squashfs_first_page(actor
);
70 static inline void *squashfs_next_page(struct squashfs_page_actor
*actor
)
72 return actor
->squashfs_next_page(actor
);
74 static inline void squashfs_finish_page(struct squashfs_page_actor
*actor
)
76 actor
->squashfs_finish_page(actor
);