#include <linux/pid.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include "sysfs-common.h"
struct damon_sysfs_region { … };
static struct damon_sysfs_region *damon_sysfs_region_alloc(void)
{ … }
static ssize_t start_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static ssize_t start_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t end_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static ssize_t end_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{ … }
static void damon_sysfs_region_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_region_start_attr = …;
static struct kobj_attribute damon_sysfs_region_end_attr = …;
static struct attribute *damon_sysfs_region_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_region_ktype = …;
struct damon_sysfs_regions { … };
static struct damon_sysfs_regions *damon_sysfs_regions_alloc(void)
{ … }
static void damon_sysfs_regions_rm_dirs(struct damon_sysfs_regions *regions)
{ … }
static int damon_sysfs_regions_add_dirs(struct damon_sysfs_regions *regions,
int nr_regions)
{ … }
static ssize_t nr_regions_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t nr_regions_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_regions_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_regions_nr_attr = …;
static struct attribute *damon_sysfs_regions_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_regions_ktype = …;
struct damon_sysfs_target { … };
static struct damon_sysfs_target *damon_sysfs_target_alloc(void)
{ … }
static int damon_sysfs_target_add_dirs(struct damon_sysfs_target *target)
{ … }
static void damon_sysfs_target_rm_dirs(struct damon_sysfs_target *target)
{ … }
static ssize_t pid_target_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t pid_target_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_target_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_target_pid_attr = …;
static struct attribute *damon_sysfs_target_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_target_ktype = …;
struct damon_sysfs_targets { … };
static struct damon_sysfs_targets *damon_sysfs_targets_alloc(void)
{ … }
static void damon_sysfs_targets_rm_dirs(struct damon_sysfs_targets *targets)
{ … }
static int damon_sysfs_targets_add_dirs(struct damon_sysfs_targets *targets,
int nr_targets)
{ … }
static ssize_t nr_targets_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t nr_targets_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_targets_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_targets_nr_attr = …;
static struct attribute *damon_sysfs_targets_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_targets_ktype = …;
struct damon_sysfs_intervals { … };
static struct damon_sysfs_intervals *damon_sysfs_intervals_alloc(
unsigned long sample_us, unsigned long aggr_us,
unsigned long update_us)
{ … }
static ssize_t sample_us_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t sample_us_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static ssize_t aggr_us_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static ssize_t aggr_us_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t update_us_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t update_us_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_intervals_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_intervals_sample_us_attr = …;
static struct kobj_attribute damon_sysfs_intervals_aggr_us_attr = …;
static struct kobj_attribute damon_sysfs_intervals_update_us_attr = …;
static struct attribute *damon_sysfs_intervals_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_intervals_ktype = …;
struct damon_sysfs_attrs { … };
static struct damon_sysfs_attrs *damon_sysfs_attrs_alloc(void)
{ … }
static int damon_sysfs_attrs_add_dirs(struct damon_sysfs_attrs *attrs)
{ … }
static void damon_sysfs_attrs_rm_dirs(struct damon_sysfs_attrs *attrs)
{ … }
static void damon_sysfs_attrs_release(struct kobject *kobj)
{ … }
static struct attribute *damon_sysfs_attrs_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_attrs_ktype = …;
static const char * const damon_sysfs_ops_strs[] = …;
struct damon_sysfs_context { … };
static struct damon_sysfs_context *damon_sysfs_context_alloc(
enum damon_ops_id ops_id)
{ … }
static int damon_sysfs_context_set_attrs(struct damon_sysfs_context *context)
{ … }
static int damon_sysfs_context_set_targets(struct damon_sysfs_context *context)
{ … }
static int damon_sysfs_context_set_schemes(struct damon_sysfs_context *context)
{ … }
static int damon_sysfs_context_add_dirs(struct damon_sysfs_context *context)
{ … }
static void damon_sysfs_context_rm_dirs(struct damon_sysfs_context *context)
{ … }
static ssize_t avail_operations_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t operations_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t operations_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_context_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_context_avail_operations_attr = …;
static struct kobj_attribute damon_sysfs_context_operations_attr = …;
static struct attribute *damon_sysfs_context_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_context_ktype = …;
struct damon_sysfs_contexts { … };
static struct damon_sysfs_contexts *damon_sysfs_contexts_alloc(void)
{ … }
static void damon_sysfs_contexts_rm_dirs(struct damon_sysfs_contexts *contexts)
{ … }
static int damon_sysfs_contexts_add_dirs(struct damon_sysfs_contexts *contexts,
int nr_contexts)
{ … }
static ssize_t nr_contexts_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t nr_contexts_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_contexts_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_contexts_nr_attr
= …;
static struct attribute *damon_sysfs_contexts_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_contexts_ktype = …;
struct damon_sysfs_kdamond { … };
static struct damon_sysfs_kdamond *damon_sysfs_kdamond_alloc(void)
{ … }
static int damon_sysfs_kdamond_add_dirs(struct damon_sysfs_kdamond *kdamond)
{ … }
static void damon_sysfs_kdamond_rm_dirs(struct damon_sysfs_kdamond *kdamond)
{ … }
static bool damon_sysfs_ctx_running(struct damon_ctx *ctx)
{ … }
enum damon_sysfs_cmd { … };
static const char * const damon_sysfs_cmd_strs[] = …;
struct damon_sysfs_cmd_request { … };
static struct damon_sysfs_cmd_request damon_sysfs_cmd_request;
static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static int damon_sysfs_set_attrs(struct damon_ctx *ctx,
struct damon_sysfs_attrs *sys_attrs)
{ … }
static void damon_sysfs_destroy_targets(struct damon_ctx *ctx)
{ … }
static int damon_sysfs_set_regions(struct damon_target *t,
struct damon_sysfs_regions *sysfs_regions)
{ … }
static int damon_sysfs_add_target(struct damon_sysfs_target *sys_target,
struct damon_ctx *ctx)
{ … }
static int damon_sysfs_add_targets(struct damon_ctx *ctx,
struct damon_sysfs_targets *sysfs_targets)
{ … }
static bool damon_sysfs_schemes_regions_updating;
static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
{ … }
static int damon_sysfs_upd_schemes_stats(struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_upd_schemes_regions_start(
struct damon_sysfs_kdamond *kdamond, bool total_bytes_only)
{ … }
static int damon_sysfs_upd_schemes_regions_stop(
struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_clear_schemes_regions(
struct damon_sysfs_kdamond *kdamond)
{ … }
static inline bool damon_sysfs_kdamond_running(
struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_apply_inputs(struct damon_ctx *ctx,
struct damon_sysfs_context *sys_ctx)
{ … }
static struct damon_ctx *damon_sysfs_build_ctx(
struct damon_sysfs_context *sys_ctx);
static int damon_sysfs_commit_input(struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_commit_schemes_quota_goals(
struct damon_sysfs_kdamond *sysfs_kdamond)
{ … }
static int damon_sysfs_upd_schemes_effective_quotas(
struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_cmd_request_callback(struct damon_ctx *c, bool active,
bool after_aggregation)
{ … }
static int damon_sysfs_after_wmarks_check(struct damon_ctx *c)
{ … }
static int damon_sysfs_after_sampling(struct damon_ctx *c)
{ … }
static int damon_sysfs_after_aggregation(struct damon_ctx *c)
{ … }
static struct damon_ctx *damon_sysfs_build_ctx(
struct damon_sysfs_context *sys_ctx)
{ … }
static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_turn_damon_off(struct damon_sysfs_kdamond *kdamond)
{ … }
static int damon_sysfs_handle_cmd(enum damon_sysfs_cmd cmd,
struct damon_sysfs_kdamond *kdamond)
{ … }
static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t pid_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static void damon_sysfs_kdamond_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_kdamond_state_attr = …;
static struct kobj_attribute damon_sysfs_kdamond_pid_attr = …;
static struct attribute *damon_sysfs_kdamond_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_kdamond_ktype = …;
struct damon_sysfs_kdamonds { … };
static struct damon_sysfs_kdamonds *damon_sysfs_kdamonds_alloc(void)
{ … }
static void damon_sysfs_kdamonds_rm_dirs(struct damon_sysfs_kdamonds *kdamonds)
{ … }
static bool damon_sysfs_kdamonds_busy(struct damon_sysfs_kdamond **kdamonds,
int nr_kdamonds)
{ … }
static int damon_sysfs_kdamonds_add_dirs(struct damon_sysfs_kdamonds *kdamonds,
int nr_kdamonds)
{ … }
static ssize_t nr_kdamonds_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{ … }
static ssize_t nr_kdamonds_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{ … }
static void damon_sysfs_kdamonds_release(struct kobject *kobj)
{ … }
static struct kobj_attribute damon_sysfs_kdamonds_nr_attr = …;
static struct attribute *damon_sysfs_kdamonds_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_kdamonds_ktype = …;
struct damon_sysfs_ui_dir { … };
static struct damon_sysfs_ui_dir *damon_sysfs_ui_dir_alloc(void)
{ … }
static int damon_sysfs_ui_dir_add_dirs(struct damon_sysfs_ui_dir *ui_dir)
{ … }
static void damon_sysfs_ui_dir_release(struct kobject *kobj)
{ … }
static struct attribute *damon_sysfs_ui_dir_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static const struct kobj_type damon_sysfs_ui_dir_ktype = …;
static int __init damon_sysfs_init(void)
{ … }
subsys_initcall(damon_sysfs_init);
#include "sysfs-test.h"