#define pr_fmt(fmt) …
#include <linux/damon.h>
#include <linux/debugfs.h>
#include <linux/file.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/page_idle.h>
#include <linux/slab.h>
#define DAMON_DBGFS_DEPRECATION_NOTICE …
static struct damon_ctx **dbgfs_ctxs;
static int dbgfs_nr_ctxs;
static struct dentry **dbgfs_dirs;
static DEFINE_MUTEX(damon_dbgfs_lock);
static void damon_dbgfs_warn_deprecation(void)
{ … }
static char *user_input_str(const char __user *buf, size_t count, loff_t *ppos)
{ … }
static ssize_t dbgfs_attrs_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{ … }
static ssize_t dbgfs_attrs_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos)
{ … }
static int damos_action_to_dbgfs_scheme_action(enum damos_action action)
{ … }
static ssize_t sprint_schemes(struct damon_ctx *c, char *buf, ssize_t len)
{ … }
static ssize_t dbgfs_schemes_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{ … }
static void free_schemes_arr(struct damos **schemes, ssize_t nr_schemes)
{ … }
static enum damos_action dbgfs_scheme_action_to_damos_action(int dbgfs_action)
{ … }
static struct damos **str_to_schemes(const char *str, ssize_t len,
ssize_t *nr_schemes)
{ … }
static ssize_t dbgfs_schemes_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t sprint_target_ids(struct damon_ctx *ctx, char *buf, ssize_t len)
{ … }
static ssize_t dbgfs_target_ids_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{ … }
static int *str_to_ints(const char *str, ssize_t len, ssize_t *nr_ints)
{ … }
static void dbgfs_put_pids(struct pid **pids, int nr_pids)
{ … }
static struct pid **str_to_pids(const char *str, ssize_t len, ssize_t *nr_pids)
{ … }
static int dbgfs_set_targets(struct damon_ctx *ctx, ssize_t nr_targets,
struct pid **pids)
{ … }
static ssize_t dbgfs_target_ids_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos)
{ … }
static ssize_t sprint_init_regions(struct damon_ctx *c, char *buf, ssize_t len)
{ … }
static ssize_t dbgfs_init_regions_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{ … }
static int add_init_region(struct damon_ctx *c, int target_idx,
struct damon_addr_range *ar)
{ … }
static int set_init_regions(struct damon_ctx *c, const char *str, ssize_t len)
{ … }
static ssize_t dbgfs_init_regions_write(struct file *file,
const char __user *buf, size_t count,
loff_t *ppos)
{ … }
static ssize_t dbgfs_kdamond_pid_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{ … }
static int damon_dbgfs_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations attrs_fops = …;
static const struct file_operations schemes_fops = …;
static const struct file_operations target_ids_fops = …;
static const struct file_operations init_regions_fops = …;
static const struct file_operations kdamond_pid_fops = …;
static void dbgfs_fill_ctx_dir(struct dentry *dir, struct damon_ctx *ctx)
{ … }
static void dbgfs_before_terminate(struct damon_ctx *ctx)
{ … }
static struct damon_ctx *dbgfs_new_ctx(void)
{ … }
static void dbgfs_destroy_ctx(struct damon_ctx *ctx)
{ … }
static ssize_t damon_dbgfs_deprecated_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{ … }
static int dbgfs_mk_context(char *name)
{ … }
static ssize_t dbgfs_mk_context_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos)
{ … }
static int dbgfs_rm_context(char *name)
{ … }
static ssize_t dbgfs_rm_context_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos)
{ … }
static ssize_t dbgfs_monitor_on_read(struct file *file,
char __user *buf, size_t count, loff_t *ppos)
{ … }
static ssize_t dbgfs_monitor_on_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos)
{ … }
static int damon_dbgfs_static_file_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations deprecated_fops = …;
static const struct file_operations mk_contexts_fops = …;
static const struct file_operations rm_contexts_fops = …;
static const struct file_operations monitor_on_fops = …;
static int __init __damon_dbgfs_init(void)
{ … }
static int __init damon_dbgfs_init(void)
{ … }
module_init(…) …;
#include "dbgfs-test.h"