Lines Matching refs:actor
24 static void *cache_first_page(struct squashfs_page_actor *actor) in cache_first_page() argument
26 actor->next_page = 1; in cache_first_page()
27 return actor->buffer[0]; in cache_first_page()
30 static void *cache_next_page(struct squashfs_page_actor *actor) in cache_next_page() argument
32 if (actor->next_page == actor->pages) in cache_next_page()
35 return actor->buffer[actor->next_page++]; in cache_next_page()
38 static void cache_finish_page(struct squashfs_page_actor *actor) in cache_finish_page() argument
46 struct squashfs_page_actor *actor = kmalloc(sizeof(*actor), GFP_KERNEL); in squashfs_page_actor_init() local
48 if (actor == NULL) in squashfs_page_actor_init()
51 actor->length = length ? : pages * PAGE_CACHE_SIZE; in squashfs_page_actor_init()
52 actor->buffer = buffer; in squashfs_page_actor_init()
53 actor->pages = pages; in squashfs_page_actor_init()
54 actor->next_page = 0; in squashfs_page_actor_init()
55 actor->squashfs_first_page = cache_first_page; in squashfs_page_actor_init()
56 actor->squashfs_next_page = cache_next_page; in squashfs_page_actor_init()
57 actor->squashfs_finish_page = cache_finish_page; in squashfs_page_actor_init()
58 return actor; in squashfs_page_actor_init()
62 static void *direct_first_page(struct squashfs_page_actor *actor) in direct_first_page() argument
64 actor->next_page = 1; in direct_first_page()
65 return actor->pageaddr = kmap_atomic(actor->page[0]); in direct_first_page()
68 static void *direct_next_page(struct squashfs_page_actor *actor) in direct_next_page() argument
70 if (actor->pageaddr) in direct_next_page()
71 kunmap_atomic(actor->pageaddr); in direct_next_page()
73 return actor->pageaddr = actor->next_page == actor->pages ? NULL : in direct_next_page()
74 kmap_atomic(actor->page[actor->next_page++]); in direct_next_page()
77 static void direct_finish_page(struct squashfs_page_actor *actor) in direct_finish_page() argument
79 if (actor->pageaddr) in direct_finish_page()
80 kunmap_atomic(actor->pageaddr); in direct_finish_page()
86 struct squashfs_page_actor *actor = kmalloc(sizeof(*actor), GFP_KERNEL); in squashfs_page_actor_init_special() local
88 if (actor == NULL) in squashfs_page_actor_init_special()
91 actor->length = length ? : pages * PAGE_CACHE_SIZE; in squashfs_page_actor_init_special()
92 actor->page = page; in squashfs_page_actor_init_special()
93 actor->pages = pages; in squashfs_page_actor_init_special()
94 actor->next_page = 0; in squashfs_page_actor_init_special()
95 actor->pageaddr = NULL; in squashfs_page_actor_init_special()
96 actor->squashfs_first_page = direct_first_page; in squashfs_page_actor_init_special()
97 actor->squashfs_next_page = direct_next_page; in squashfs_page_actor_init_special()
98 actor->squashfs_finish_page = direct_finish_page; in squashfs_page_actor_init_special()
99 return actor; in squashfs_page_actor_init_special()