From 74d30a561c231eeef91fc7fee6ef728eef61aa29 Mon Sep 17 00:00:00 2001 From: default Date: Tue, 31 Jan 2023 18:33:45 +0100 Subject: [PATCH] Some symbol renaming. --- data.c | 8 ++++---- snac.h | 2 +- upgrade.c | 12 ++++++------ utils.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data.c b/data.c index a55885d..e402a0e 100644 --- a/data.c +++ b/data.c @@ -15,10 +15,10 @@ #include #include -double db_layout = 2.7; +double disk_layout = 2.7; -int db_upgrade(d_char **error); +int snac_upgrade(d_char **error); int srv_open(char *basedir, int auto_upgrade) /* opens a server */ @@ -71,9 +71,9 @@ int srv_open(char *basedir, int auto_upgrade) } if (auto_upgrade) - ret = db_upgrade(&error); + ret = snac_upgrade(&error); else { - if (xs_number_get(xs_dict_get(srv_config, "layout")) < db_layout) + if (xs_number_get(xs_dict_get(srv_config, "layout")) < disk_layout) error = xs_fmt("ERROR: disk layout changed - execute 'snac upgrade' first"); else ret = 1; diff --git a/snac.h b/snac.h index 1678e86..ecf47a4 100644 --- a/snac.h +++ b/snac.h @@ -5,7 +5,7 @@ #define USER_AGENT "snac/" VERSION -extern double db_layout; +extern double disk_layout; extern d_char *srv_basedir; extern d_char *srv_config; extern d_char *srv_baseurl; diff --git a/upgrade.c b/upgrade.c index 19fc39a..1b735c2 100644 --- a/upgrade.c +++ b/upgrade.c @@ -11,7 +11,7 @@ #include -int db_upgrade(d_char **error) +int snac_upgrade(xs_str **error) { int ret = 1; int changed = 0; @@ -23,10 +23,10 @@ int db_upgrade(d_char **error) f = nf = xs_number_get(layout); - if (!(f < db_layout)) + if (!(f < disk_layout)) break; - srv_log(xs_fmt("db_upgrade %1.1lf < %1.1lf", f, db_layout)); + srv_log(xs_fmt("disk layout upgrade needed (%1.1lf < %1.1lf)", f, disk_layout)); if (f < 2.0) { *error = xs_fmt("ERROR: unsupported old disk layout %1.1lf\n", f); @@ -294,14 +294,14 @@ int db_upgrade(d_char **error) xs *nv = xs_number_new(f); srv_config = xs_dict_set(srv_config, "layout", nv); - srv_log(xs_fmt("db_upgrade converted to version %1.1lf", f)); + srv_log(xs_fmt("disk layout upgraded to version %1.1lf", f)); changed++; } else break; } - if (f > db_layout) { + if (f > disk_layout) { *error = xs_fmt("ERROR: unknown future version %lf\n", f); ret = 0; } @@ -316,7 +316,7 @@ int db_upgrade(d_char **error) fwrite(j, strlen(j), 1, f); fclose(f); - srv_log(xs_fmt("upgraded db %s after %d changes", fn, changed)); + srv_log(xs_fmt("disk layout upgraded %s after %d changes", fn, changed)); } else ret = 0; diff --git a/utils.c b/utils.c index 5639aa0..4bc1b01 100644 --- a/utils.c +++ b/utils.c @@ -103,7 +103,7 @@ int initdb(const char *basedir) srv_config = xs_json_loads(default_srv_config); - xs *layout = xs_number_new(db_layout); + xs *layout = xs_number_new(disk_layout); srv_config = xs_dict_set(srv_config, "layout", layout); printf("Network address [%s]:\n", xs_dict_get(srv_config, "address"));