[PATCH] PCI: Add pci_walk_bus function to PCI core (nonrecursive)
[linux-2.6/pdupreez.git] / include / linux / loop.h
blob53fa51595443e81d2878ab22902f0815d1933844
1 #ifndef _LINUX_LOOP_H
2 #define _LINUX_LOOP_H
4 /*
5 * include/linux/loop.h
7 * Written by Theodore Ts'o, 3/29/93.
9 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
10 * permitted under the GNU General Public License.
13 #define LO_NAME_SIZE 64
14 #define LO_KEY_SIZE 32
16 #ifdef __KERNEL__
17 #include <linux/bio.h>
18 #include <linux/blkdev.h>
19 #include <linux/spinlock.h>
21 /* Possible states of device */
22 enum {
23 Lo_unbound,
24 Lo_bound,
25 Lo_rundown,
28 struct loop_func_table;
30 struct loop_device {
31 int lo_number;
32 int lo_refcnt;
33 loff_t lo_offset;
34 loff_t lo_sizelimit;
35 int lo_flags;
36 int (*transfer)(struct loop_device *, int cmd,
37 struct page *raw_page, unsigned raw_off,
38 struct page *loop_page, unsigned loop_off,
39 int size, sector_t real_block);
40 char lo_file_name[LO_NAME_SIZE];
41 char lo_crypt_name[LO_NAME_SIZE];
42 char lo_encrypt_key[LO_KEY_SIZE];
43 int lo_encrypt_key_size;
44 struct loop_func_table *lo_encryption;
45 __u32 lo_init[2];
46 uid_t lo_key_owner; /* Who set the key */
47 int (*ioctl)(struct loop_device *, int cmd,
48 unsigned long arg);
50 struct file * lo_backing_file;
51 struct block_device *lo_device;
52 unsigned lo_blocksize;
53 void *key_data;
55 int old_gfp_mask;
57 spinlock_t lo_lock;
58 struct bio *lo_bio;
59 struct bio *lo_biotail;
60 int lo_state;
61 struct semaphore lo_sem;
62 struct semaphore lo_ctl_mutex;
63 struct semaphore lo_bh_mutex;
64 int lo_pending;
66 request_queue_t *lo_queue;
69 #endif /* __KERNEL__ */
72 * Loop flags
74 enum {
75 LO_FLAGS_READ_ONLY = 1,
76 LO_FLAGS_USE_AOPS = 2,
79 #include <asm/posix_types.h> /* for __kernel_old_dev_t */
80 #include <asm/types.h> /* for __u64 */
82 /* Backwards compatibility version */
83 struct loop_info {
84 int lo_number; /* ioctl r/o */
85 __kernel_old_dev_t lo_device; /* ioctl r/o */
86 unsigned long lo_inode; /* ioctl r/o */
87 __kernel_old_dev_t lo_rdevice; /* ioctl r/o */
88 int lo_offset;
89 int lo_encrypt_type;
90 int lo_encrypt_key_size; /* ioctl w/o */
91 int lo_flags; /* ioctl r/o */
92 char lo_name[LO_NAME_SIZE];
93 unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
94 unsigned long lo_init[2];
95 char reserved[4];
98 struct loop_info64 {
99 __u64 lo_device; /* ioctl r/o */
100 __u64 lo_inode; /* ioctl r/o */
101 __u64 lo_rdevice; /* ioctl r/o */
102 __u64 lo_offset;
103 __u64 lo_sizelimit;/* bytes, 0 == max available */
104 __u32 lo_number; /* ioctl r/o */
105 __u32 lo_encrypt_type;
106 __u32 lo_encrypt_key_size; /* ioctl w/o */
107 __u32 lo_flags; /* ioctl r/o */
108 __u8 lo_file_name[LO_NAME_SIZE];
109 __u8 lo_crypt_name[LO_NAME_SIZE];
110 __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
111 __u64 lo_init[2];
115 * Loop filter types
118 #define LO_CRYPT_NONE 0
119 #define LO_CRYPT_XOR 1
120 #define LO_CRYPT_DES 2
121 #define LO_CRYPT_FISH2 3 /* Twofish encryption */
122 #define LO_CRYPT_BLOW 4
123 #define LO_CRYPT_CAST128 5
124 #define LO_CRYPT_IDEA 6
125 #define LO_CRYPT_DUMMY 9
126 #define LO_CRYPT_SKIPJACK 10
127 #define LO_CRYPT_CRYPTOAPI 18
128 #define MAX_LO_CRYPT 20
130 #ifdef __KERNEL__
131 /* Support for loadable transfer modules */
132 struct loop_func_table {
133 int number; /* filter type */
134 int (*transfer)(struct loop_device *lo, int cmd,
135 struct page *raw_page, unsigned raw_off,
136 struct page *loop_page, unsigned loop_off,
137 int size, sector_t real_block);
138 int (*init)(struct loop_device *, const struct loop_info64 *);
139 /* release is called from loop_unregister_transfer or clr_fd */
140 int (*release)(struct loop_device *);
141 int (*ioctl)(struct loop_device *, int cmd, unsigned long arg);
142 struct module *owner;
145 int loop_register_transfer(struct loop_func_table *funcs);
146 int loop_unregister_transfer(int number);
148 #endif
150 * IOCTL commands --- we will commandeer 0x4C ('L')
153 #define LOOP_SET_FD 0x4C00
154 #define LOOP_CLR_FD 0x4C01
155 #define LOOP_SET_STATUS 0x4C02
156 #define LOOP_GET_STATUS 0x4C03
157 #define LOOP_SET_STATUS64 0x4C04
158 #define LOOP_GET_STATUS64 0x4C05
159 #define LOOP_CHANGE_FD 0x4C06
161 #endif