Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
loop.h
Go to the documentation of this file.
1 /*
2  * include/linux/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 */
19 enum {
23 };
24 
25 struct loop_func_table;
26 
27 struct 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);
43  kuid_t lo_key_owner; /* Who set the key */
44  int (*ioctl)(struct loop_device *, int cmd,
45  unsigned long arg);
46 
49  unsigned lo_blocksize;
50  void *key_data;
51 
53 
56  int lo_state;
60 
62  struct gendisk *lo_disk;
63 };
64 
65 /* Support for loadable transfer modules */
67  int number; /* filter type */
68  int (*transfer)(struct loop_device *lo, int cmd,
69  struct page *raw_page, unsigned raw_off,
70  struct page *loop_page, unsigned loop_off,
71  int size, sector_t real_block);
72  int (*init)(struct loop_device *, const struct loop_info64 *);
73  /* release is called from loop_unregister_transfer or clr_fd */
74  int (*release)(struct loop_device *);
75  int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
76  struct module *owner;
77 };
78 
79 int loop_register_transfer(struct loop_func_table *funcs);
80 int loop_unregister_transfer(int number);
81 
82 #endif