4 #include <linux/kdev_t.h>
9 * Written by Theodore Ts'o, 3/29/93.
11 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
12 * permitted under the GNU Public License.
15 #define LO_NAME_SIZE 64
16 #define LO_KEY_SIZE 32
22 struct dentry
*lo_dentry
;
27 int lo_encrypt_key_size
;
29 int (*transfer
)(struct loop_device
*, int cmd
,
30 char *raw_buf
, char *loop_buf
, int size
,
32 char lo_name
[LO_NAME_SIZE
];
33 char lo_encrypt_key
[LO_KEY_SIZE
];
35 uid_t lo_key_owner
; /* Who set the key */
36 int (*ioctl
)(struct loop_device
*, int cmd
,
39 struct file
* lo_backing_file
;
41 char key_reserved
[48]; /* for use by the filter modules */
44 typedef int (* transfer_proc_t
)(struct loop_device
*, int cmd
,
45 char *raw_buf
, char *loop_buf
, int size
,
48 #endif /* __KERNEL__ */
53 #define LO_FLAGS_DO_BMAP 0x00000001
54 #define LO_FLAGS_READ_ONLY 0x00000002
57 * Note that this structure gets the wrong offsets when directly used
58 * from a glibc program, because glibc has a 32bit dev_t.
59 * Prevent people from shooting in their own foot.
61 #if __GLIBC__ >= 2 && !defined(dev_t)
62 #error "Wrong dev_t in loop.h"
66 * This uses kdev_t because glibc currently has no appropiate
67 * conversion version for the loop ioctls.
68 * The situation is very unpleasant
72 int lo_number
; /* ioctl r/o */
73 dev_t lo_device
; /* ioctl r/o */
74 unsigned long lo_inode
; /* ioctl r/o */
75 dev_t lo_rdevice
; /* ioctl r/o */
78 int lo_encrypt_key_size
; /* ioctl w/o */
79 int lo_flags
; /* ioctl r/o */
80 char lo_name
[LO_NAME_SIZE
];
81 unsigned char lo_encrypt_key
[LO_KEY_SIZE
]; /* ioctl w/o */
82 unsigned long lo_init
[2];
90 #define LO_CRYPT_NONE 0
91 #define LO_CRYPT_XOR 1
92 #define LO_CRYPT_DES 2
93 #define LO_CRYPT_FISH2 3 /* Brand new Twofish encryption */
94 #define LO_CRYPT_BLOW 4
95 #define LO_CRYPT_CAST128 5
96 #define LO_CRYPT_IDEA 6
97 #define LO_CRYPT_DUMMY 9
98 #define LO_CRYPT_SKIPJACK 10
99 #define MAX_LO_CRYPT 20
102 /* Support for loadable transfer modules */
103 struct loop_func_table
{
104 int number
; /* filter type */
105 int (*transfer
)(struct loop_device
*lo
, int cmd
,
106 char *raw_buf
, char *loop_buf
, int size
,
108 int (*init
)(struct loop_device
*, struct loop_info
*);
109 /* release is called from loop_unregister_transfer or clr_fd */
110 int (*release
)(struct loop_device
*);
111 int (*ioctl
)(struct loop_device
*, int cmd
, unsigned long arg
);
112 /* lock and unlock manage the module use counts */
113 void (*lock
)(struct loop_device
*);
114 void (*unlock
)(struct loop_device
*);
117 int loop_register_transfer(struct loop_func_table
*funcs
);
118 int loop_unregister_transfer(int number
);
122 * IOCTL commands --- we will commandeer 0x4C ('L')
125 #define LOOP_SET_FD 0x4C00
126 #define LOOP_CLR_FD 0x4C01
127 #define LOOP_SET_STATUS 0x4C02
128 #define LOOP_GET_STATUS 0x4C03