1 // SPDX-License-Identifier: GPL-2.0
3 * Common Primitives for DAMON Modules
5 * Author: SeongJae Park <sjpark@amazon.de>
8 #include <linux/damon.h>
10 #include "modules-common.h"
13 * Allocate, set, and return a DAMON context for the physical address space.
14 * @ctxp: Pointer to save the point to the newly created context
15 * @targetp: Pointer to save the point to the newly created target
17 int damon_modules_new_paddr_ctx_target(struct damon_ctx **ctxp,
18 struct damon_target **targetp)
20 struct damon_ctx *ctx;
21 struct damon_target *target;
23 ctx = damon_new_ctx();
27 if (damon_select_ops(ctx, DAMON_OPS_PADDR)) {
28 damon_destroy_ctx(ctx);
32 target = damon_new_target();
34 damon_destroy_ctx(ctx);
37 damon_add_target(ctx, target);