xref: /aosp_15_r20/external/ltp/include/lapi/loop.h (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker /*
3*49cdfc7eSAndroid Build Coastguard Worker  * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved.
4*49cdfc7eSAndroid Build Coastguard Worker  * Author: Yang Xu <[email protected]>
5*49cdfc7eSAndroid Build Coastguard Worker  */
6*49cdfc7eSAndroid Build Coastguard Worker #ifndef LAPI_LOOP_H__
7*49cdfc7eSAndroid Build Coastguard Worker #define LAPI_LOOP_H__
8*49cdfc7eSAndroid Build Coastguard Worker 
9*49cdfc7eSAndroid Build Coastguard Worker #include "config.h"
10*49cdfc7eSAndroid Build Coastguard Worker #include <linux/types.h>
11*49cdfc7eSAndroid Build Coastguard Worker #include <linux/loop.h>
12*49cdfc7eSAndroid Build Coastguard Worker 
13*49cdfc7eSAndroid Build Coastguard Worker #ifndef LO_FLAGS_PARTSCAN
14*49cdfc7eSAndroid Build Coastguard Worker # define LO_FLAGS_PARTSCAN 8
15*49cdfc7eSAndroid Build Coastguard Worker #endif
16*49cdfc7eSAndroid Build Coastguard Worker 
17*49cdfc7eSAndroid Build Coastguard Worker #ifndef LO_FLAGS_DIRECT_IO
18*49cdfc7eSAndroid Build Coastguard Worker # define LO_FLAGS_DIRECT_IO 16
19*49cdfc7eSAndroid Build Coastguard Worker #endif
20*49cdfc7eSAndroid Build Coastguard Worker 
21*49cdfc7eSAndroid Build Coastguard Worker #ifndef LOOP_SET_CAPACITY
22*49cdfc7eSAndroid Build Coastguard Worker # define LOOP_SET_CAPACITY 0x4C07
23*49cdfc7eSAndroid Build Coastguard Worker #endif
24*49cdfc7eSAndroid Build Coastguard Worker 
25*49cdfc7eSAndroid Build Coastguard Worker #ifndef LOOP_SET_DIRECT_IO
26*49cdfc7eSAndroid Build Coastguard Worker # define LOOP_SET_DIRECT_IO 0x4C08
27*49cdfc7eSAndroid Build Coastguard Worker #endif
28*49cdfc7eSAndroid Build Coastguard Worker 
29*49cdfc7eSAndroid Build Coastguard Worker #ifndef LOOP_SET_BLOCK_SIZE
30*49cdfc7eSAndroid Build Coastguard Worker # define LOOP_SET_BLOCK_SIZE 0x4C09
31*49cdfc7eSAndroid Build Coastguard Worker #endif
32*49cdfc7eSAndroid Build Coastguard Worker 
33*49cdfc7eSAndroid Build Coastguard Worker #ifndef LOOP_CONFIGURE
34*49cdfc7eSAndroid Build Coastguard Worker # define LOOP_CONFIGURE 0x4C0A
35*49cdfc7eSAndroid Build Coastguard Worker #endif
36*49cdfc7eSAndroid Build Coastguard Worker 
37*49cdfc7eSAndroid Build Coastguard Worker #ifndef HAVE_STRUCT_LOOP_CONFIG
38*49cdfc7eSAndroid Build Coastguard Worker /*
39*49cdfc7eSAndroid Build Coastguard Worker  * struct loop_config - Complete configuration for a loop device.
40*49cdfc7eSAndroid Build Coastguard Worker  * @fd: fd of the file to be used as a backing file for the loop device.
41*49cdfc7eSAndroid Build Coastguard Worker  * @block_size: block size to use; ignored if 0.
42*49cdfc7eSAndroid Build Coastguard Worker  * @info: struct loop_info64 to configure the loop device with.
43*49cdfc7eSAndroid Build Coastguard Worker  *
44*49cdfc7eSAndroid Build Coastguard Worker  * This structure is used with the LOOP_CONFIGURE ioctl, and can be used to
45*49cdfc7eSAndroid Build Coastguard Worker  * atomically setup and configure all loop device parameters at once.
46*49cdfc7eSAndroid Build Coastguard Worker  */
47*49cdfc7eSAndroid Build Coastguard Worker struct loop_config {
48*49cdfc7eSAndroid Build Coastguard Worker 	__u32			fd;
49*49cdfc7eSAndroid Build Coastguard Worker 	__u32                   block_size;
50*49cdfc7eSAndroid Build Coastguard Worker 	struct loop_info64	info;
51*49cdfc7eSAndroid Build Coastguard Worker 	__u64			__reserved[8];
52*49cdfc7eSAndroid Build Coastguard Worker };
53*49cdfc7eSAndroid Build Coastguard Worker #endif
54*49cdfc7eSAndroid Build Coastguard Worker 
55*49cdfc7eSAndroid Build Coastguard Worker #endif /* LAPI_LOOP_H__ */
56