linux-user: add SO_PEERCRED support for getsockopt
[qemu.git] / linux-user / linux_loop.h
1 /* Copied from 2.6.25 kernel headers to avoid problems on older hosts. */
2 #ifndef _LINUX_LOOP_H
3 #define _LINUX_LOOP_H
4
5 /*
6 * include/linux/loop.h
7 *
8 * Written by Theodore Ts'o, 3/29/93.
9 *
10 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
11 * permitted under the GNU General Public License.
12 */
13
14 #define LO_NAME_SIZE 64
15 #define LO_KEY_SIZE 32
16
17
18 /*
19 * Loop flags
20 */
21 enum {
22 LO_FLAGS_READ_ONLY = 1,
23 LO_FLAGS_USE_AOPS = 2,
24 LO_FLAGS_AUTOCLEAR = 4,
25 };
26
27 #include <linux/version.h>
28 #include <asm/posix_types.h> /* for __kernel_old_dev_t */
29 #include <asm/types.h> /* for __u64 */
30
31 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) /* This is a guess. */
32 #define __kernel_old_dev_t __kernel_dev_t
33 #endif
34
35 /* Backwards compatibility version */
36 struct loop_info {
37 int lo_number; /* ioctl r/o */
38 __kernel_old_dev_t lo_device; /* ioctl r/o */
39 unsigned long lo_inode; /* ioctl r/o */
40 __kernel_old_dev_t lo_rdevice; /* ioctl r/o */
41 int lo_offset;
42 int lo_encrypt_type;
43 int lo_encrypt_key_size; /* ioctl w/o */
44 int lo_flags; /* ioctl r/o */
45 char lo_name[LO_NAME_SIZE];
46 unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
47 unsigned long lo_init[2];
48 char reserved[4];
49 };
50
51 struct loop_info64 {
52 __u64 lo_device; /* ioctl r/o */
53 __u64 lo_inode; /* ioctl r/o */
54 __u64 lo_rdevice; /* ioctl r/o */
55 __u64 lo_offset;
56 __u64 lo_sizelimit;/* bytes, 0 == max available */
57 __u32 lo_number; /* ioctl r/o */
58 __u32 lo_encrypt_type;
59 __u32 lo_encrypt_key_size; /* ioctl w/o */
60 __u32 lo_flags; /* ioctl r/o */
61 __u8 lo_file_name[LO_NAME_SIZE];
62 __u8 lo_crypt_name[LO_NAME_SIZE];
63 __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
64 __u64 lo_init[2];
65 };
66
67 /*
68 * Loop filter types
69 */
70
71 #define LO_CRYPT_NONE 0
72 #define LO_CRYPT_XOR 1
73 #define LO_CRYPT_DES 2
74 #define LO_CRYPT_FISH2 3 /* Twofish encryption */
75 #define LO_CRYPT_BLOW 4
76 #define LO_CRYPT_CAST128 5
77 #define LO_CRYPT_IDEA 6
78 #define LO_CRYPT_DUMMY 9
79 #define LO_CRYPT_SKIPJACK 10
80 #define LO_CRYPT_CRYPTOAPI 18
81 #define MAX_LO_CRYPT 20
82
83 /*
84 * IOCTL commands --- we will commandeer 0x4C ('L')
85 */
86
87 #define LOOP_SET_FD 0x4C00
88 #define LOOP_CLR_FD 0x4C01
89 #define LOOP_SET_STATUS 0x4C02
90 #define LOOP_GET_STATUS 0x4C03
91 #define LOOP_SET_STATUS64 0x4C04
92 #define LOOP_GET_STATUS64 0x4C05
93 #define LOOP_CHANGE_FD 0x4C06
94
95 #endif