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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * loop.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Written by Theodore Ts'o, 3/29/93.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright 1993 by Theodore Ts'o.  Redistribution of this file is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * permitted under the GNU General Public License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #ifndef _LINUX_LOOP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _LINUX_LOOP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/bio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/blkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/blk-mq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/mutex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/kthread.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <uapi/linux/loop.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) /* Possible states of device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	Lo_unbound,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	Lo_bound,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	Lo_rundown,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct loop_func_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct loop_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	int		lo_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	atomic_t	lo_refcnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	loff_t		lo_offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	loff_t		lo_sizelimit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	int		lo_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	int		(*transfer)(struct loop_device *, int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 				    struct page *raw_page, unsigned raw_off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 				    struct page *loop_page, unsigned loop_off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 				    int size, sector_t real_block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	char		lo_file_name[LO_NAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	char		lo_crypt_name[LO_NAME_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	char		lo_encrypt_key[LO_KEY_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	int		lo_encrypt_key_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct loop_func_table *lo_encryption;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	__u32           lo_init[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	kuid_t		lo_key_owner;	/* Who set the key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	int		(*ioctl)(struct loop_device *, int cmd, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 				 unsigned long arg); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	struct file *	lo_backing_file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	struct block_device *lo_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	void		*key_data; 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	gfp_t		old_gfp_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	spinlock_t		lo_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	int			lo_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	struct kthread_worker	worker;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	struct task_struct	*worker_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	bool			use_dio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	bool			sysfs_inited;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	struct request_queue	*lo_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	struct blk_mq_tag_set	tag_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	struct gendisk		*lo_disk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct loop_cmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	struct kthread_work work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	bool use_aio; /* use AIO interface to handle I/O */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	atomic_t ref; /* only for aio */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	long ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	struct kiocb iocb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	struct bio_vec *bvec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	struct cgroup_subsys_state *css;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* Support for loadable transfer modules */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct loop_func_table {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	int number;	/* filter type */ 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	int (*transfer)(struct loop_device *lo, int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 			struct page *raw_page, unsigned raw_off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 			struct page *loop_page, unsigned loop_off,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 			int size, sector_t real_block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 	int (*init)(struct loop_device *, const struct loop_info64 *); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 	/* release is called from loop_unregister_transfer or clr_fd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 	int (*release)(struct loop_device *); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 	struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) }; 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) int loop_register_transfer(struct loop_func_table *funcs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) int loop_unregister_transfer(int number); 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #endif