Files
linux-apfs/drivers/block/loop.h
T

86 lines
2.1 KiB
C
Raw Normal View History

2005-04-16 15:20:36 -07:00
/*
2013-05-12 10:14:07 -04:00
* loop.h
2005-04-16 15:20:36 -07:00
*
* Written by Theodore Ts'o, 3/29/93.
*
* Copyright 1993 by Theodore Ts'o. Redistribution of this file is
* permitted under the GNU General Public License.
*/
2012-10-13 10:46:48 +01:00
#ifndef _LINUX_LOOP_H
#define _LINUX_LOOP_H
2005-04-16 15:20:36 -07:00
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/spinlock.h>
2006-03-23 03:00:38 -08:00
#include <linux/mutex.h>
2012-10-13 10:46:48 +01:00
#include <uapi/linux/loop.h>
2005-04-16 15:20:36 -07:00
/* Possible states of device */
enum {
Lo_unbound,
Lo_bound,
Lo_rundown,
};
struct loop_func_table;
struct loop_device {
int lo_number;
int lo_refcnt;
loff_t lo_offset;
loff_t lo_sizelimit;
int lo_flags;
int (*transfer)(struct loop_device *, int cmd,
struct page *raw_page, unsigned raw_off,
struct page *loop_page, unsigned loop_off,
int size, sector_t real_block);
char lo_file_name[LO_NAME_SIZE];
char lo_crypt_name[LO_NAME_SIZE];
char lo_encrypt_key[LO_KEY_SIZE];
int lo_encrypt_key_size;
struct loop_func_table *lo_encryption;
__u32 lo_init[2];
kuid_t lo_key_owner; /* Who set the key */
2005-04-16 15:20:36 -07:00
int (*ioctl)(struct loop_device *, int cmd,
unsigned long arg);
struct file * lo_backing_file;
struct block_device *lo_device;
unsigned lo_blocksize;
void *key_data;
2005-10-21 03:22:34 -04:00
gfp_t old_gfp_mask;
2005-04-16 15:20:36 -07:00
spinlock_t lo_lock;
2009-04-17 08:41:21 +02:00
struct bio_list lo_bio_list;
unsigned int lo_bio_count;
2005-04-16 15:20:36 -07:00
int lo_state;
2006-03-23 03:00:38 -08:00
struct mutex lo_ctl_mutex;
2006-09-29 01:59:11 -07:00
struct task_struct *lo_thread;
wait_queue_head_t lo_event;
/* wait queue for incoming requests */
wait_queue_head_t lo_req_wait;
2005-04-16 15:20:36 -07:00
2007-07-23 18:44:00 -07:00
struct request_queue *lo_queue;
2007-05-08 00:28:20 -07:00
struct gendisk *lo_disk;
2005-04-16 15:20:36 -07:00
};
/* Support for loadable transfer modules */
struct loop_func_table {
int number; /* filter type */
int (*transfer)(struct loop_device *lo, int cmd,
struct page *raw_page, unsigned raw_off,
struct page *loop_page, unsigned loop_off,
int size, sector_t real_block);
int (*init)(struct loop_device *, const struct loop_info64 *);
/* release is called from loop_unregister_transfer or clr_fd */
int (*release)(struct loop_device *);
int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
struct module *owner;
};
int loop_register_transfer(struct loop_func_table *funcs);
int loop_unregister_transfer(int number);
#endif