]> git.proxmox.com Git - ceph.git/blame - ceph/src/pmdk/src/common/ctl_prefault.c
import ceph 16.2.7
[ceph.git] / ceph / src / pmdk / src / common / ctl_prefault.c
CommitLineData
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
13static int
14CTL_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
23static int
24CTL_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
34static int
35CTL_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
44static int
45CTL_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
55static const struct ctl_argument CTL_ARG(at_create) = CTL_ARG_BOOLEAN;
56static const struct ctl_argument CTL_ARG(at_open) = CTL_ARG_BOOLEAN;
57
58static 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
65void
66ctl_prefault_register(void)
67{
68 CTL_REGISTER_MODULE(NULL, prefault);
69}