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