summaryrefslogtreecommitdiffstats
path: root/src/pmdk/src/common/ctl_fallocate.c
blob: ac0af6ed23559337f04585c651294d4f323b8dd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright 2018-2019, Intel Corporation */

/*
 * ctl_fallocate.c -- implementation of the fallocate CTL namespace
 */

#include "ctl.h"
#include "set.h"
#include "out.h"
#include "ctl_global.h"
#include "file.h"

static int
CTL_READ_HANDLER(at_create)(void *ctx, enum ctl_query_source source,
	void *arg, struct ctl_indexes *indexes)
{
	int *arg_out = arg;
	*arg_out = Fallocate_at_create;

	return 0;
}

static int
CTL_WRITE_HANDLER(at_create)(void *ctx, enum ctl_query_source source,
	void *arg, struct ctl_indexes *indexes)
{
	int arg_in = *(int *)arg;
	Fallocate_at_create = arg_in;

	return 0;
}

static struct ctl_argument CTL_ARG(at_create) = CTL_ARG_BOOLEAN;

static const struct ctl_node CTL_NODE(fallocate)[] = {
	CTL_LEAF_RW(at_create),

	CTL_NODE_END
};

void
ctl_fallocate_register(void)
{
	CTL_REGISTER_MODULE(NULL, fallocate);
}