]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/bcachefs_ioctl.h
Allow disk commands to specify member by index
[bcachefs-tools-debian] / libbcachefs / bcachefs_ioctl.h
1 #ifndef _LINUX_BCACHE_IOCTL_H
2 #define _LINUX_BCACHE_IOCTL_H
3
4 #include <linux/uuid.h>
5 #include "bcachefs_format.h"
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 #define BCH_FORCE_IF_DATA_LOST          (1 << 0)
12 #define BCH_FORCE_IF_METADATA_LOST      (1 << 1)
13 #define BCH_FORCE_IF_DATA_DEGRADED      (1 << 2)
14 #define BCH_FORCE_IF_METADATA_DEGRADED  (1 << 3)
15
16 #define BCH_FORCE_IF_DEGRADED                   \
17         (BCH_FORCE_IF_DATA_DEGRADED|            \
18          BCH_FORCE_IF_METADATA_DEGRADED)
19
20 #define BCH_BY_INDEX                    (1 << 4)
21
22 /* global control dev: */
23
24 #define BCH_IOCTL_ASSEMBLE      _IOW(0xbc, 1, struct bch_ioctl_assemble)
25 #define BCH_IOCTL_INCREMENTAL   _IOW(0xbc, 2, struct bch_ioctl_incremental)
26
27 struct bch_ioctl_assemble {
28         __u32                   flags;
29         __u32                   nr_devs;
30         __u64                   pad;
31         __u64                   devs[];
32 };
33
34 struct bch_ioctl_incremental {
35         __u32                   flags;
36         __u64                   pad;
37         __u64                   dev;
38 };
39
40 /* filesystem ioctls: */
41
42 #define BCH_IOCTL_QUERY_UUID    _IOR(0xbc,      1,  struct bch_ioctl_query_uuid)
43 #define BCH_IOCTL_START         _IOW(0xbc,      2,  struct bch_ioctl_start)
44 #define BCH_IOCTL_STOP          _IO(0xbc,       3)
45 #define BCH_IOCTL_DISK_ADD      _IOW(0xbc,      4,  struct bch_ioctl_disk)
46 #define BCH_IOCTL_DISK_REMOVE   _IOW(0xbc,      5,  struct bch_ioctl_disk)
47 #define BCH_IOCTL_DISK_ONLINE   _IOW(0xbc,      6,  struct bch_ioctl_disk)
48 #define BCH_IOCTL_DISK_OFFLINE  _IOW(0xbc,      7,  struct bch_ioctl_disk)
49 #define BCH_IOCTL_DISK_SET_STATE _IOW(0xbc,     8,  struct bch_ioctl_disk_set_state)
50 #define BCH_IOCTL_DISK_EVACUATE _IOW(0xbc,      9,  struct bch_ioctl_disk)
51 #define BCH_IOCTL_DATA          _IOW(0xbc,      10, struct bch_ioctl_data)
52
53 struct bch_ioctl_query_uuid {
54         uuid_le                 uuid;
55 };
56
57 struct bch_ioctl_start {
58         __u32                   flags;
59         __u32                   pad;
60 };
61
62 struct bch_ioctl_disk {
63         __u32                   flags;
64         __u32                   pad;
65         __u64                   dev;
66 };
67
68 struct bch_ioctl_disk_set_state {
69         __u32                   flags;
70         __u8                    new_state;
71         __u8                    pad[3];
72         __u64                   dev;
73 };
74
75 #define BCH_REWRITE_INCREASE_REPLICAS   (1 << 0)
76 #define BCH_REWRITE_DECREASE_REPLICAS   (1 << 1)
77
78 #define BCH_REWRITE_RECOMPRESS          (1 << 0)
79 #define BCH_REWRITE_DECREASE_REPLICAS   (1 << 1)
80
81 enum bch_data_ops {
82         BCH_DATA_SCRUB,
83 };
84
85 struct bch_data_op {
86         __u8                    type;
87 };
88
89 struct bch_ioctl_data {
90         __u32                   flags;
91         __u32                   pad;
92
93         __u64                   start_inode;
94         __u64                   start_offset;
95
96         __u64                   end_inode;
97         __u64                   end_offset;
98 };
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif /* _LINUX_BCACHE_IOCTL_H */