aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-12 10:14:07 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:46:45 -0400
commit83a8761142cb38536e9e88dfc2432d331ea4e257 (patch)
treeff4d62cb9f0380b9fe0891f9d0c09fa748b369ba /drivers
parente06aeb571653ffb4398e915bba3a34af665ae98b (diff)
move linux/loop.h to drivers/block
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/cryptoloop.c2
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/loop.h85
3 files changed, 87 insertions, 2 deletions
diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 8b6bb764b0a3..99e773cb70d0 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -25,9 +25,9 @@
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/crypto.h> 26#include <linux/crypto.h>
27#include <linux/blkdev.h> 27#include <linux/blkdev.h>
28#include <linux/loop.h>
29#include <linux/scatterlist.h> 28#include <linux/scatterlist.h>
30#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include "loop.h"
31 31
32MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
33MODULE_DESCRIPTION("loop blockdevice transferfunction adaptor / CryptoAPI"); 33MODULE_DESCRIPTION("loop blockdevice transferfunction adaptor / CryptoAPI");
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index d92d50fd84b7..40e715531aa6 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -63,7 +63,6 @@
63#include <linux/init.h> 63#include <linux/init.h>
64#include <linux/swap.h> 64#include <linux/swap.h>
65#include <linux/slab.h> 65#include <linux/slab.h>
66#include <linux/loop.h>
67#include <linux/compat.h> 66#include <linux/compat.h>
68#include <linux/suspend.h> 67#include <linux/suspend.h>
69#include <linux/freezer.h> 68#include <linux/freezer.h>
@@ -76,6 +75,7 @@
76#include <linux/sysfs.h> 75#include <linux/sysfs.h>
77#include <linux/miscdevice.h> 76#include <linux/miscdevice.h>
78#include <linux/falloc.h> 77#include <linux/falloc.h>
78#include "loop.h"
79 79
80#include <asm/uaccess.h> 80#include <asm/uaccess.h>
81 81
diff --git a/drivers/block/loop.h b/drivers/block/loop.h
new file mode 100644
index 000000000000..90df5d6485b6
--- /dev/null
+++ b/drivers/block/loop.h
@@ -0,0 +1,85 @@
1/*
2 * loop.h
3 *
4 * Written by Theodore Ts'o, 3/29/93.
5 *
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
8 */
9#ifndef _LINUX_LOOP_H
10#define _LINUX_LOOP_H
11
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>
17
18/* Possible states of device */
19enum {
20 Lo_unbound,
21 Lo_bound,
22 Lo_rundown,
23};
24
25struct loop_func_table;
26
27struct loop_device {
28 int lo_number;
29 int lo_refcnt;
30 loff_t lo_offset;
31 loff_t lo_sizelimit;
32 int lo_flags;
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;
42 __u32 lo_init[2];
43 kuid_t lo_key_owner; /* Who set the key */
44 int (*ioctl)(struct loop_device *, int cmd,
45 unsigned long arg);
46
47 struct file * lo_backing_file;
48 struct block_device *lo_device;
49 unsigned lo_blocksize;
50 void *key_data;
51
52 gfp_t old_gfp_mask;
53
54 spinlock_t lo_lock;
55 struct bio_list lo_bio_list;
56 unsigned int lo_bio_count;
57 int lo_state;
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;
63
64 struct request_queue *lo_queue;
65 struct gendisk *lo_disk;
66};
67
68/* Support for loadable transfer modules */
69struct 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);
79 struct module *owner;
80};
81
82int loop_register_transfer(struct loop_func_table *funcs);
83int loop_unregister_transfer(int number);
84
85#endif