]>
Commit | Line | Data |
---|---|---|
a4b75251 TL |
1 | // SPDX-License-Identifier: BSD-3-Clause |
2 | /* Copyright 2016-2019, Intel Corporation */ | |
3 | ||
4 | /* | |
5 | * ctl_prefault.c -- implementation of the prefault CTL namespace | |
6 | */ | |
7 | ||
8 | #include "ctl.h" | |
9 | #include "set.h" | |
10 | #include "out.h" | |
11 | #include "ctl_global.h" | |
12 | ||
13 | static int | |
14 | CTL_READ_HANDLER(at_create)(void *ctx, enum ctl_query_source source, | |
15 | void *arg, struct ctl_indexes *indexes) | |
16 | { | |
17 | int *arg_out = arg; | |
18 | *arg_out = Prefault_at_create; | |
19 | ||
20 | return 0; | |
21 | } | |
22 | ||
23 | static int | |
24 | CTL_WRITE_HANDLER(at_create)(void *ctx, enum ctl_query_source source, | |
25 | void *arg, struct ctl_indexes *indexes) | |
26 | { | |
27 | int arg_in = *(int *)arg; | |
28 | ||
29 | Prefault_at_create = arg_in; | |
30 | ||
31 | return 0; | |
32 | } | |
33 | ||
34 | static int | |
35 | CTL_READ_HANDLER(at_open)(void *ctx, enum ctl_query_source source, | |
36 | void *arg, struct ctl_indexes *indexes) | |
37 | { | |
38 | int *arg_out = arg; | |
39 | *arg_out = Prefault_at_open; | |
40 | ||
41 | return 0; | |
42 | } | |
43 | ||
44 | static int | |
45 | CTL_WRITE_HANDLER(at_open)(void *ctx, enum ctl_query_source source, | |
46 | void *arg, struct ctl_indexes *indexes) | |
47 | { | |
48 | int arg_in = *(int *)arg; | |
49 | ||
50 | Prefault_at_open = arg_in; | |
51 | ||
52 | return 0; | |
53 | } | |
54 | ||
55 | static const struct ctl_argument CTL_ARG(at_create) = CTL_ARG_BOOLEAN; | |
56 | static const struct ctl_argument CTL_ARG(at_open) = CTL_ARG_BOOLEAN; | |
57 | ||
58 | static const struct ctl_node CTL_NODE(prefault)[] = { | |
59 | CTL_LEAF_RW(at_create), | |
60 | CTL_LEAF_RW(at_open), | |
61 | ||
62 | CTL_NODE_END | |
63 | }; | |
64 | ||
65 | void | |
66 | ctl_prefault_register(void) | |
67 | { | |
68 | CTL_REGISTER_MODULE(NULL, prefault); | |
69 | } |