]>
Commit | Line | Data |
---|---|---|
a4b75251 TL |
1 | // SPDX-License-Identifier: BSD-3-Clause |
2 | /* Copyright 2019, Intel Corporation */ | |
3 | ||
4 | /* | |
5 | * ctl_cow.c -- implementation of the CTL copy on write namespace | |
6 | */ | |
7 | ||
8 | #include "ctl.h" | |
9 | #include "set.h" | |
10 | #include "out.h" | |
11 | #include "ctl_global.h" | |
12 | ||
13 | /* | |
14 | * CTL_READ_HANDLER(at_open) -- returns at_open field | |
15 | */ | |
16 | static int | |
17 | CTL_READ_HANDLER(at_open)(void *ctx, | |
18 | enum ctl_query_source source, void *arg, struct ctl_indexes *indexes) | |
19 | { | |
20 | int *arg_out = arg; | |
21 | *arg_out = COW_at_open; | |
22 | return 0; | |
23 | } | |
24 | /* | |
25 | * CTL_WRITE_HANDLER(at_open) -- sets the at_open field in copy_on_write | |
26 | */ | |
27 | static int | |
28 | CTL_WRITE_HANDLER(at_open)(void *ctx, | |
29 | enum ctl_query_source source, void *arg, struct ctl_indexes *indexes) | |
30 | { | |
31 | int arg_in = *(int *)arg; | |
32 | COW_at_open = arg_in; | |
33 | return 0; | |
34 | } | |
35 | ||
36 | static struct ctl_argument CTL_ARG(at_open) = CTL_ARG_BOOLEAN; | |
37 | ||
38 | static const struct ctl_node CTL_NODE(copy_on_write)[] = { | |
39 | CTL_LEAF_RW(at_open), | |
40 | ||
41 | CTL_NODE_END | |
42 | }; | |
43 | ||
44 | /* | |
45 | * cow_ctl_register -- registers ctl nodes for "copy_on_write" module | |
46 | */ | |
47 | void | |
48 | ctl_cow_register(void) | |
49 | { | |
50 | CTL_REGISTER_MODULE(NULL, copy_on_write); | |
51 | } |