From 96561ba0d33a28aa41c3d2f288c2efbf5b581906 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sun, 1 Mar 2020 16:18:07 +0100 Subject: [PATCH] main: userspace control for compat_deletions --- kernel/sy_old/mars_main.c | 21 ++++++++++++++++++++- kernel/sy_old/strategy.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/kernel/sy_old/mars_main.c b/kernel/sy_old/mars_main.c index 2377207b..caec5466 100644 --- a/kernel/sy_old/mars_main.c +++ b/kernel/sy_old/mars_main.c @@ -39,7 +39,7 @@ /* In contrast, this _should_ be updated when _compatible_ features * are added. */ -#define OPTIONAL_FEATURES_VERSION "2" +#define OPTIONAL_FEATURES_VERSION "3" // disable this only for debugging! #define RUN_PEERS @@ -549,6 +549,7 @@ enum { CL_GBL_ACTUAL_ITEMS, CL_TREE, CL_FEATURES, + CL_COMPAT_DELETIONS, /* transient, to re-disappear */ CL_EMERGENCY, CL_REST_SPACE, // resource definitions @@ -5397,6 +5398,15 @@ static int check_deleted(void *buf, struct mars_dent *dent) return 0; } +/* transient, to re-disappear */ +static +int get_compat_deletions(void *buf, struct mars_dent *dent) +{ + if (dent && dent->new_link) + sscanf(dent->new_link, "%d", &compat_deletions); + return 0; +} + static int make_res(void *buf, struct mars_dent *dent) { @@ -5653,6 +5663,15 @@ static const struct main_class main_classes[] = { .cl_type = 'l', .cl_father = CL_ROOT, }, + /* transient, to re-disappear */ + [CL_COMPAT_DELETIONS] = { + .cl_name = "compat-deletions", + .cl_len = 16, + .cl_type = 'l', + .cl_hostcontext = false, + .cl_father = CL_ROOT, + .cl_forward = get_compat_deletions, + }, /* Indicate whether filesystem is full */ [CL_EMERGENCY] = { diff --git a/kernel/sy_old/strategy.h b/kernel/sy_old/strategy.h index 0821fe50..48d04ecd 100644 --- a/kernel/sy_old/strategy.h +++ b/kernel/sy_old/strategy.h @@ -31,6 +31,9 @@ #define MARS_ARGV_MAX 4 +/* transient, to re-disappear */ +extern int compat_deletions; + extern loff_t global_total_space; extern loff_t global_remaining_space;