linux/mm/damon/dbgfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * DAMON Debugfs Interface
 *
 * Author: SeongJae Park <[email protected]>
 */

#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)
{}

/*
 * Returns non-empty string on success, negative error code otherwise.
 */
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)
{}

/*
 * Return corresponding dbgfs' scheme action value (int) for the given
 * damos_action if the given damos_action value is valid and supported by
 * dbgfs, negative error code otherwise.
 */
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)
{}

/*
 * Return corresponding damos_action for the given dbgfs input for a scheme
 * action if the input is valid, negative error code otherwise.
 */
static enum damos_action dbgfs_scheme_action_to_damos_action(int dbgfs_action)
{}

/*
 * Converts a string into an array of struct damos pointers
 *
 * Returns an array of struct damos pointers that converted if the conversion
 * success, or NULL otherwise.
 */
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)
{}

/*
 * Converts a string into an integers array
 *
 * Returns an array of integers array if the conversion success, or NULL
 * otherwise.
 */
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)
{}

/*
 * Converts a string into an struct pid pointers array
 *
 * Returns an array of struct pid pointers if the conversion success, or NULL
 * otherwise.
 */
static struct pid **str_to_pids(const char *str, ssize_t len, ssize_t *nr_pids)
{}

/*
 * dbgfs_set_targets() - Set monitoring targets.
 * @ctx:	monitoring context
 * @nr_targets:	number of targets
 * @pids:	array of target pids (size is same to @nr_targets)
 *
 * This function should not be called while the kdamond is running.  @pids is
 * ignored if the context is not configured to have pid in each target.  On
 * failure, reference counts of all pids in @pids are decremented.
 *
 * Return: 0 on success, negative error code otherwise.
 */
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)
{}

/*
 * Make a context of @name and create a debugfs directory for it.
 *
 * This function should be called while holding damon_dbgfs_lock.
 *
 * Returns 0 on success, negative error code otherwise.
 */
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)
{}

/*
 * Remove a context of @name and its debugfs directory.
 *
 * This function should be called while holding damon_dbgfs_lock.
 *
 * Return 0 on success, negative error code otherwise.
 */
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)
{}

/*
 * Functions for the initialization
 */

static int __init damon_dbgfs_init(void)
{}

module_init();

#include "dbgfs-test.h"