xref: /openbmc/linux/include/uapi/linux/loop.h (revision ab1cb278)
1607ca46eSDavid Howells /*
2607ca46eSDavid Howells  * include/linux/loop.h
3607ca46eSDavid Howells  *
4607ca46eSDavid Howells  * Written by Theodore Ts'o, 3/29/93.
5607ca46eSDavid Howells  *
6607ca46eSDavid Howells  * Copyright 1993 by Theodore Ts'o.  Redistribution of this file is
7607ca46eSDavid Howells  * permitted under the GNU General Public License.
8607ca46eSDavid Howells  */
9607ca46eSDavid Howells #ifndef _UAPI_LINUX_LOOP_H
10607ca46eSDavid Howells #define _UAPI_LINUX_LOOP_H
11607ca46eSDavid Howells 
12607ca46eSDavid Howells 
13607ca46eSDavid Howells #define LO_NAME_SIZE	64
14607ca46eSDavid Howells #define LO_KEY_SIZE	32
15607ca46eSDavid Howells 
16607ca46eSDavid Howells 
17607ca46eSDavid Howells /*
18607ca46eSDavid Howells  * Loop flags
19607ca46eSDavid Howells  */
20607ca46eSDavid Howells enum {
21607ca46eSDavid Howells 	LO_FLAGS_READ_ONLY	= 1,
22607ca46eSDavid Howells 	LO_FLAGS_AUTOCLEAR	= 4,
23607ca46eSDavid Howells 	LO_FLAGS_PARTSCAN	= 8,
242e5ab5f3SMing Lei 	LO_FLAGS_DIRECT_IO	= 16,
25607ca46eSDavid Howells };
26607ca46eSDavid Howells 
27607ca46eSDavid Howells #include <asm/posix_types.h>	/* for __kernel_old_dev_t */
28607ca46eSDavid Howells #include <linux/types.h>	/* for __u64 */
29607ca46eSDavid Howells 
30607ca46eSDavid Howells /* Backwards compatibility version */
31607ca46eSDavid Howells struct loop_info {
32607ca46eSDavid Howells 	int		   lo_number;		/* ioctl r/o */
33607ca46eSDavid Howells 	__kernel_old_dev_t lo_device; 		/* ioctl r/o */
34607ca46eSDavid Howells 	unsigned long	   lo_inode; 		/* ioctl r/o */
35607ca46eSDavid Howells 	__kernel_old_dev_t lo_rdevice; 		/* ioctl r/o */
36607ca46eSDavid Howells 	int		   lo_offset;
37607ca46eSDavid Howells 	int		   lo_encrypt_type;
38607ca46eSDavid Howells 	int		   lo_encrypt_key_size; 	/* ioctl w/o */
39607ca46eSDavid Howells 	int		   lo_flags;			/* ioctl r/o */
40607ca46eSDavid Howells 	char		   lo_name[LO_NAME_SIZE];
41607ca46eSDavid Howells 	unsigned char	   lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
42607ca46eSDavid Howells 	unsigned long	   lo_init[2];
43607ca46eSDavid Howells 	char		   reserved[4];
44607ca46eSDavid Howells };
45607ca46eSDavid Howells 
46607ca46eSDavid Howells struct loop_info64 {
47607ca46eSDavid Howells 	__u64		   lo_device;			/* ioctl r/o */
48607ca46eSDavid Howells 	__u64		   lo_inode;			/* ioctl r/o */
49607ca46eSDavid Howells 	__u64		   lo_rdevice;			/* ioctl r/o */
50607ca46eSDavid Howells 	__u64		   lo_offset;
51607ca46eSDavid Howells 	__u64		   lo_sizelimit;/* bytes, 0 == max available */
52607ca46eSDavid Howells 	__u32		   lo_number;			/* ioctl r/o */
53607ca46eSDavid Howells 	__u32		   lo_encrypt_type;
54607ca46eSDavid Howells 	__u32		   lo_encrypt_key_size;		/* ioctl w/o */
55607ca46eSDavid Howells 	__u32		   lo_flags;			/* ioctl r/o */
56607ca46eSDavid Howells 	__u8		   lo_file_name[LO_NAME_SIZE];
57607ca46eSDavid Howells 	__u8		   lo_crypt_name[LO_NAME_SIZE];
58607ca46eSDavid Howells 	__u8		   lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
59607ca46eSDavid Howells 	__u64		   lo_init[2];
60607ca46eSDavid Howells };
61607ca46eSDavid Howells 
62607ca46eSDavid Howells /*
63607ca46eSDavid Howells  * Loop filter types
64607ca46eSDavid Howells  */
65607ca46eSDavid Howells 
66607ca46eSDavid Howells #define LO_CRYPT_NONE		0
67607ca46eSDavid Howells #define LO_CRYPT_XOR		1
68607ca46eSDavid Howells #define LO_CRYPT_DES		2
69607ca46eSDavid Howells #define LO_CRYPT_FISH2		3    /* Twofish encryption */
70607ca46eSDavid Howells #define LO_CRYPT_BLOW		4
71607ca46eSDavid Howells #define LO_CRYPT_CAST128	5
72607ca46eSDavid Howells #define LO_CRYPT_IDEA		6
73607ca46eSDavid Howells #define LO_CRYPT_DUMMY		9
74607ca46eSDavid Howells #define LO_CRYPT_SKIPJACK	10
75607ca46eSDavid Howells #define LO_CRYPT_CRYPTOAPI	18
76607ca46eSDavid Howells #define MAX_LO_CRYPT		20
77607ca46eSDavid Howells 
78607ca46eSDavid Howells /*
79607ca46eSDavid Howells  * IOCTL commands --- we will commandeer 0x4C ('L')
80607ca46eSDavid Howells  */
81607ca46eSDavid Howells 
82607ca46eSDavid Howells #define LOOP_SET_FD		0x4C00
83607ca46eSDavid Howells #define LOOP_CLR_FD		0x4C01
84607ca46eSDavid Howells #define LOOP_SET_STATUS		0x4C02
85607ca46eSDavid Howells #define LOOP_GET_STATUS		0x4C03
86607ca46eSDavid Howells #define LOOP_SET_STATUS64	0x4C04
87607ca46eSDavid Howells #define LOOP_GET_STATUS64	0x4C05
88607ca46eSDavid Howells #define LOOP_CHANGE_FD		0x4C06
89607ca46eSDavid Howells #define LOOP_SET_CAPACITY	0x4C07
90ab1cb278SMing Lei #define LOOP_SET_DIRECT_IO	0x4C08
91607ca46eSDavid Howells 
92607ca46eSDavid Howells /* /dev/loop-control interface */
93607ca46eSDavid Howells #define LOOP_CTL_ADD		0x4C80
94607ca46eSDavid Howells #define LOOP_CTL_REMOVE		0x4C81
95607ca46eSDavid Howells #define LOOP_CTL_GET_FREE	0x4C82
96607ca46eSDavid Howells #endif /* _UAPI_LINUX_LOOP_H */
97