0001
0002
0003
0004
0005 #ifndef _UAPI_LINUX_LOOP_H
0006 #define _UAPI_LINUX_LOOP_H
0007
0008
0009 #define LO_NAME_SIZE 64
0010 #define LO_KEY_SIZE 32
0011
0012
0013
0014
0015
0016 enum {
0017 LO_FLAGS_READ_ONLY = 1,
0018 LO_FLAGS_AUTOCLEAR = 4,
0019 LO_FLAGS_PARTSCAN = 8,
0020 LO_FLAGS_DIRECT_IO = 16,
0021 };
0022
0023
0024 #define LOOP_SET_STATUS_SETTABLE_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN)
0025
0026
0027 #define LOOP_SET_STATUS_CLEARABLE_FLAGS (LO_FLAGS_AUTOCLEAR)
0028
0029
0030 #define LOOP_CONFIGURE_SETTABLE_FLAGS (LO_FLAGS_READ_ONLY | LO_FLAGS_AUTOCLEAR \
0031 | LO_FLAGS_PARTSCAN | LO_FLAGS_DIRECT_IO)
0032
0033 #include <asm/posix_types.h> /* for __kernel_old_dev_t */
0034 #include <linux/types.h> /* for __u64 */
0035
0036
0037 struct loop_info {
0038 int lo_number;
0039 __kernel_old_dev_t lo_device;
0040 unsigned long lo_inode;
0041 __kernel_old_dev_t lo_rdevice;
0042 int lo_offset;
0043 int lo_encrypt_type;
0044 int lo_encrypt_key_size;
0045 int lo_flags;
0046 char lo_name[LO_NAME_SIZE];
0047 unsigned char lo_encrypt_key[LO_KEY_SIZE];
0048 unsigned long lo_init[2];
0049 char reserved[4];
0050 };
0051
0052 struct loop_info64 {
0053 __u64 lo_device;
0054 __u64 lo_inode;
0055 __u64 lo_rdevice;
0056 __u64 lo_offset;
0057 __u64 lo_sizelimit;
0058 __u32 lo_number;
0059 __u32 lo_encrypt_type;
0060 __u32 lo_encrypt_key_size;
0061 __u32 lo_flags;
0062 __u8 lo_file_name[LO_NAME_SIZE];
0063 __u8 lo_crypt_name[LO_NAME_SIZE];
0064 __u8 lo_encrypt_key[LO_KEY_SIZE];
0065 __u64 lo_init[2];
0066 };
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 struct loop_config {
0078 __u32 fd;
0079 __u32 block_size;
0080 struct loop_info64 info;
0081 __u64 __reserved[8];
0082 };
0083
0084
0085
0086
0087
0088 #define LO_CRYPT_NONE 0
0089 #define LO_CRYPT_XOR 1
0090 #define LO_CRYPT_DES 2
0091 #define LO_CRYPT_FISH2 3
0092 #define LO_CRYPT_BLOW 4
0093 #define LO_CRYPT_CAST128 5
0094 #define LO_CRYPT_IDEA 6
0095 #define LO_CRYPT_DUMMY 9
0096 #define LO_CRYPT_SKIPJACK 10
0097 #define LO_CRYPT_CRYPTOAPI 18
0098 #define MAX_LO_CRYPT 20
0099
0100
0101
0102
0103
0104 #define LOOP_SET_FD 0x4C00
0105 #define LOOP_CLR_FD 0x4C01
0106 #define LOOP_SET_STATUS 0x4C02
0107 #define LOOP_GET_STATUS 0x4C03
0108 #define LOOP_SET_STATUS64 0x4C04
0109 #define LOOP_GET_STATUS64 0x4C05
0110 #define LOOP_CHANGE_FD 0x4C06
0111 #define LOOP_SET_CAPACITY 0x4C07
0112 #define LOOP_SET_DIRECT_IO 0x4C08
0113 #define LOOP_SET_BLOCK_SIZE 0x4C09
0114 #define LOOP_CONFIGURE 0x4C0A
0115
0116
0117 #define LOOP_CTL_ADD 0x4C80
0118 #define LOOP_CTL_REMOVE 0x4C81
0119 #define LOOP_CTL_GET_FREE 0x4C82
0120 #endif