Upload Tizen:Base source
[framework/base/util-linux-ng.git] / mount / loop.h
1 #ifndef MNT_LOOP_H
2 #define MNT_LOOP_H
3
4 #include <linux/posix_types.h>
5 #include <stdint.h>
6 #include "linux_version.h"
7
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)
9 #define my_dev_t __kernel_dev_t
10 #else
11 #define my_dev_t __kernel_old_dev_t
12 #endif
13
14 #define LO_CRYPT_NONE   0
15 #define LO_CRYPT_XOR    1
16 #define LO_CRYPT_DES    2
17 #define LO_CRYPT_CRYPTOAPI 18
18
19 #define LOOP_SET_FD             0x4C00
20 #define LOOP_CLR_FD             0x4C01
21 #define LOOP_SET_STATUS         0x4C02
22 #define LOOP_GET_STATUS         0x4C03
23 #define LOOP_SET_STATUS64       0x4C04
24 #define LOOP_GET_STATUS64       0x4C05
25 /* #define LOOP_CHANGE_FD       0x4C06 */
26 #define LOOP_SET_CAPACITY       0x4C07
27
28 /* Flags for loop_into{64,}->lo_flags */
29 enum {
30         LO_FLAGS_READ_ONLY  = 1,
31         LO_FLAGS_USE_AOPS   = 2,
32         LO_FLAGS_AUTOCLEAR  = 4, /* New in 2.6.25 */
33 };
34
35 #define LO_NAME_SIZE    64
36 #define LO_KEY_SIZE     32
37
38 struct loop_info {
39         int             lo_number;
40         my_dev_t        lo_device;
41         unsigned long   lo_inode;
42         my_dev_t        lo_rdevice;
43         int             lo_offset;
44         int             lo_encrypt_type;
45         int             lo_encrypt_key_size;
46         int             lo_flags;
47         char            lo_name[LO_NAME_SIZE];
48         unsigned char   lo_encrypt_key[LO_KEY_SIZE];
49         unsigned long   lo_init[2];
50         char            reserved[4];
51 };
52
53 struct loop_info64 {
54         uint64_t        lo_device;
55         uint64_t        lo_inode;
56         uint64_t        lo_rdevice;
57         uint64_t        lo_offset;
58         uint64_t        lo_sizelimit; /* bytes, 0 == max available */
59         uint32_t        lo_number;
60         uint32_t        lo_encrypt_type;
61         uint32_t        lo_encrypt_key_size;
62         uint32_t        lo_flags;
63         uint8_t         lo_file_name[LO_NAME_SIZE];
64         uint8_t         lo_crypt_name[LO_NAME_SIZE];
65         uint8_t         lo_encrypt_key[LO_KEY_SIZE];
66         uint64_t        lo_init[2];
67 };
68
69 #endif /* MNT_LOOP_H */