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