blob: eb6ba1b609345620add1e6764595838fd47853d1 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_LOOP_H
8#define _UAPI_LINUX_LOOP_H
9#define LO_NAME_SIZE 64
10#define LO_KEY_SIZE 32
Ben Cheng655a7c02013-10-16 16:09:24 -070011enum {
Tao Baod7db5942015-01-28 10:07:51 -080012 LO_FLAGS_READ_ONLY = 1,
13 LO_FLAGS_AUTOCLEAR = 4,
14 LO_FLAGS_PARTSCAN = 8,
Christopher Ferris05d08e92016-02-04 13:16:38 -080015 LO_FLAGS_DIRECT_IO = 16,
Ben Cheng655a7c02013-10-16 16:09:24 -070016};
Christopher Ferris8177cdf2020-08-03 11:53:55 -070017#define LOOP_SET_STATUS_SETTABLE_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN)
18#define LOOP_SET_STATUS_CLEARABLE_FLAGS (LO_FLAGS_AUTOCLEAR)
19#define LOOP_CONFIGURE_SETTABLE_FLAGS (LO_FLAGS_READ_ONLY | LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN | LO_FLAGS_DIRECT_IO)
Ben Cheng655a7c02013-10-16 16:09:24 -070020#include <asm/posix_types.h>
21#include <linux/types.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080022struct loop_info {
Tao Baod7db5942015-01-28 10:07:51 -080023 int lo_number;
24 __kernel_old_dev_t lo_device;
25 unsigned long lo_inode;
Christopher Ferris05d08e92016-02-04 13:16:38 -080026 __kernel_old_dev_t lo_rdevice;
Tao Baod7db5942015-01-28 10:07:51 -080027 int lo_offset;
28 int lo_encrypt_type;
29 int lo_encrypt_key_size;
Christopher Ferris05d08e92016-02-04 13:16:38 -080030 int lo_flags;
Tao Baod7db5942015-01-28 10:07:51 -080031 char lo_name[LO_NAME_SIZE];
32 unsigned char lo_encrypt_key[LO_KEY_SIZE];
33 unsigned long lo_init[2];
Christopher Ferris05d08e92016-02-04 13:16:38 -080034 char reserved[4];
Ben Cheng655a7c02013-10-16 16:09:24 -070035};
36struct loop_info64 {
Tao Baod7db5942015-01-28 10:07:51 -080037 __u64 lo_device;
Christopher Ferris05d08e92016-02-04 13:16:38 -080038 __u64 lo_inode;
Tao Baod7db5942015-01-28 10:07:51 -080039 __u64 lo_rdevice;
40 __u64 lo_offset;
41 __u64 lo_sizelimit;
Christopher Ferris05d08e92016-02-04 13:16:38 -080042 __u32 lo_number;
Tao Baod7db5942015-01-28 10:07:51 -080043 __u32 lo_encrypt_type;
44 __u32 lo_encrypt_key_size;
45 __u32 lo_flags;
Christopher Ferris05d08e92016-02-04 13:16:38 -080046 __u8 lo_file_name[LO_NAME_SIZE];
Tao Baod7db5942015-01-28 10:07:51 -080047 __u8 lo_crypt_name[LO_NAME_SIZE];
48 __u8 lo_encrypt_key[LO_KEY_SIZE];
49 __u64 lo_init[2];
Christopher Ferris05d08e92016-02-04 13:16:38 -080050};
Christopher Ferris8177cdf2020-08-03 11:53:55 -070051struct loop_config {
52 __u32 fd;
53 __u32 block_size;
54 struct loop_info64 info;
55 __u64 __reserved[8];
56};
Ben Cheng655a7c02013-10-16 16:09:24 -070057#define LO_CRYPT_NONE 0
58#define LO_CRYPT_XOR 1
59#define LO_CRYPT_DES 2
Christopher Ferris05d08e92016-02-04 13:16:38 -080060#define LO_CRYPT_FISH2 3
Ben Cheng655a7c02013-10-16 16:09:24 -070061#define LO_CRYPT_BLOW 4
62#define LO_CRYPT_CAST128 5
63#define LO_CRYPT_IDEA 6
Christopher Ferris05d08e92016-02-04 13:16:38 -080064#define LO_CRYPT_DUMMY 9
Ben Cheng655a7c02013-10-16 16:09:24 -070065#define LO_CRYPT_SKIPJACK 10
66#define LO_CRYPT_CRYPTOAPI 18
67#define MAX_LO_CRYPT 20
Christopher Ferris05d08e92016-02-04 13:16:38 -080068#define LOOP_SET_FD 0x4C00
Ben Cheng655a7c02013-10-16 16:09:24 -070069#define LOOP_CLR_FD 0x4C01
70#define LOOP_SET_STATUS 0x4C02
71#define LOOP_GET_STATUS 0x4C03
Christopher Ferris05d08e92016-02-04 13:16:38 -080072#define LOOP_SET_STATUS64 0x4C04
Ben Cheng655a7c02013-10-16 16:09:24 -070073#define LOOP_GET_STATUS64 0x4C05
74#define LOOP_CHANGE_FD 0x4C06
75#define LOOP_SET_CAPACITY 0x4C07
Christopher Ferris05d08e92016-02-04 13:16:38 -080076#define LOOP_SET_DIRECT_IO 0x4C08
Christopher Ferris1308ad32017-11-14 17:32:13 -080077#define LOOP_SET_BLOCK_SIZE 0x4C09
Christopher Ferris8177cdf2020-08-03 11:53:55 -070078#define LOOP_CONFIGURE 0x4C0A
Christopher Ferris05d08e92016-02-04 13:16:38 -080079#define LOOP_CTL_ADD 0x4C80
Ben Cheng655a7c02013-10-16 16:09:24 -070080#define LOOP_CTL_REMOVE 0x4C81
81#define LOOP_CTL_GET_FREE 0x4C82
Ben Cheng655a7c02013-10-16 16:09:24 -070082#endif