4 * Written by Theodore Ts'o, 3/29/93.
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
12 #include <linux/bio.h>
13 #include <linux/blkdev.h>
14 #include <linux/spinlock.h>
15 #include <linux/mutex.h>
16 #include <uapi/linux/loop.h>
18 /* Possible states of device */
25 struct loop_func_table;
33 int (*transfer)(struct loop_device *, int cmd,
34 struct page *raw_page, unsigned raw_off,
35 struct page *loop_page, unsigned loop_off,
36 int size, sector_t real_block);
37 char lo_file_name[LO_NAME_SIZE];
38 char lo_crypt_name[LO_NAME_SIZE];
39 char lo_encrypt_key[LO_KEY_SIZE];
40 int lo_encrypt_key_size;
41 struct loop_func_table *lo_encryption;
43 kuid_t lo_key_owner; /* Who set the key */
44 int (*ioctl)(struct loop_device *, int cmd,
47 struct file * lo_backing_file;
48 struct block_device *lo_device;
49 unsigned lo_blocksize;
55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
58 struct mutex lo_ctl_mutex;
59 struct task_struct *lo_thread;
60 wait_queue_head_t lo_event;
61 /* wait queue for incoming requests */
62 wait_queue_head_t lo_req_wait;
64 struct request_queue *lo_queue;
65 struct gendisk *lo_disk;
68 /* Support for loadable transfer modules */
69 struct loop_func_table {
70 int number; /* filter type */
71 int (*transfer)(struct loop_device *lo, int cmd,
72 struct page *raw_page, unsigned raw_off,
73 struct page *loop_page, unsigned loop_off,
74 int size, sector_t real_block);
75 int (*init)(struct loop_device *, const struct loop_info64 *);
76 /* release is called from loop_unregister_transfer or clr_fd */
77 int (*release)(struct loop_device *);
78 int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
82 int loop_register_transfer(struct loop_func_table *funcs);
83 int loop_unregister_transfer(int number);