Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef PAGE_ACTOR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define PAGE_ACTOR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) 2013
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Phillip Lougher <phillip@squashfs.org.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #ifndef CONFIG_SQUASHFS_FILE_DIRECT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct squashfs_page_actor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	void	**page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	int	pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	int	length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	int	next_page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) static inline struct squashfs_page_actor *squashfs_page_actor_init(void **page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	int pages, int length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct squashfs_page_actor *actor = kmalloc(sizeof(*actor), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	if (actor == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	actor->length = length ? : pages * PAGE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	actor->page = page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	actor->pages = pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	actor->next_page = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	return actor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static inline void *squashfs_first_page(struct squashfs_page_actor *actor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	actor->next_page = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	return actor->page[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static inline void *squashfs_next_page(struct squashfs_page_actor *actor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	return actor->next_page == actor->pages ? NULL :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		actor->page[actor->next_page++];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static inline void squashfs_finish_page(struct squashfs_page_actor *actor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	/* empty */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct squashfs_page_actor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		void		**buffer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		struct page	**page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	void	*pageaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	void    *(*squashfs_first_page)(struct squashfs_page_actor *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	void    *(*squashfs_next_page)(struct squashfs_page_actor *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	void    (*squashfs_finish_page)(struct squashfs_page_actor *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	int	pages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	int	length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	int	next_page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) extern struct squashfs_page_actor *squashfs_page_actor_init(void **, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) extern struct squashfs_page_actor *squashfs_page_actor_init_special(struct page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 							 **, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) static inline void *squashfs_first_page(struct squashfs_page_actor *actor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	return actor->squashfs_first_page(actor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static inline void *squashfs_next_page(struct squashfs_page_actor *actor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	return actor->squashfs_next_page(actor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static inline void squashfs_finish_page(struct squashfs_page_actor *actor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	actor->squashfs_finish_page(actor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #endif