From cceea7f6d4362af86d40ef40b73c5f1ec3e3a7b2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 9 Aug 2011 20:41:15 +0000 Subject: [PATCH] - client: rename MODE to RUN_MODE, and rename vars accordingly svn path=/trunk/boinc/; revision=23974 --- checkin_notes | 6 +++++- client/acct_mgr.cpp | 2 +- client/client_state.cpp | 14 +++++++------- client/client_state.h | 6 +++--- client/client_types.cpp | 10 +++++----- client/client_types.h | 4 ++-- client/cs_prefs.cpp | 6 +++--- client/cs_statefile.cpp | 12 ++++++------ client/gui_rpc_server_ops.cpp | 24 ++++++++++++------------ client/sim.cpp | 8 +++----- client/work_fetch.h | 1 - 11 files changed, 47 insertions(+), 46 deletions(-) diff --git a/checkin_notes b/checkin_notes index b1d6499bdc..a3ccca38ab 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4771,4 +4771,8 @@ Charlie 8 Aug 2011 client/ coproc_detect.cpp - \ No newline at end of file + +David 9 Aug 2011 + - client: rename MODE to RUN_MODE, and rename vars accordingly + + client/various diff --git a/client/acct_mgr.cpp b/client/acct_mgr.cpp index 400d81f9e7..2022e6c18b 100644 --- a/client/acct_mgr.cpp +++ b/client/acct_mgr.cpp @@ -107,7 +107,7 @@ int ACCT_MGR_OP::do_rpc( gstate.core_client_version.major, gstate.core_client_version.minor, gstate.core_client_version.release, - run_mode_name[gstate.run_mode.get_perm()] + run_mode_name[gstate.cpu_run_mode.get_perm()] ); if (strlen(gstate.acct_mgr_info.previous_host_cpid)) { fprintf(f, diff --git a/client/client_state.cpp b/client/client_state.cpp index 2d3936113d..fb45ca183a 100644 --- a/client/client_state.cpp +++ b/client/client_state.cpp @@ -102,9 +102,9 @@ CLIENT_STATE::CLIENT_STATE() strcpy(main_host_venue, ""); strcpy(attach_project_url, ""); strcpy(attach_project_auth, ""); - run_mode.set(RUN_MODE_AUTO, 0); - gpu_mode.set(RUN_MODE_AUTO, 0); - network_mode.set(RUN_MODE_AUTO, 0); + cpu_run_mode.set(RUN_MODE_AUTO, 0); + gpu_run_mode.set(RUN_MODE_AUTO, 0); + network_run_mode.set(RUN_MODE_AUTO, 0); started_by_screensaver = false; requested_exit = false; os_requested_suspend = false; @@ -842,7 +842,7 @@ bool CLIENT_STATE::poll_slow_events() { // if ( old_network_suspend_reason == SUSPEND_REASON_NETWORK_QUOTA_EXCEEDED - && network_mode.get_current() == RUN_MODE_AUTO + && network_run_mode.get_current() == RUN_MODE_AUTO ) { pers_file_xfers->add_random_delay(3600); } @@ -1944,9 +1944,9 @@ void CLIENT_STATE::clear_absolute_times() { new_version_check_time = now; all_projects_list_check_time = now; retry_shmem_time = 0; - run_mode.temp_timeout = 0; - gpu_mode.temp_timeout = 0; - network_mode.temp_timeout = 0; + cpu_run_mode.temp_timeout = 0; + gpu_run_mode.temp_timeout = 0; + network_run_mode.temp_timeout = 0; time_stats.last_update = now; unsigned int i; diff --git a/client/client_state.h b/client/client_state.h index 8675383441..b0d4011cba 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -101,9 +101,9 @@ struct CLIENT_STATE { VERSION_INFO core_client_version; string statefile_platform_name; int file_xfer_giveup_period; - MODE run_mode; - MODE gpu_mode; - MODE network_mode; + RUN_MODE cpu_run_mode; + RUN_MODE gpu_run_mode; + RUN_MODE network_run_mode; bool started_by_screensaver; bool exit_before_start; bool check_all_logins; diff --git a/client/client_types.cpp b/client/client_types.cpp index 37adc33a43..47cc0b7d5a 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -2120,13 +2120,13 @@ void RESULT::abort_inactive(int status) { exit_status = status; } -MODE::MODE() { +RUN_MODE::RUN_MODE() { perm_mode = 0; temp_mode = 0; temp_timeout = 0; } -void MODE::set(int mode, double duration) { +void RUN_MODE::set(int mode, double duration) { if (mode == RUN_MODE_RESTORE) { temp_timeout = 0; temp_mode = perm_mode; @@ -2143,11 +2143,11 @@ void MODE::set(int mode, double duration) { } } -int MODE::get_perm() { +int RUN_MODE::get_perm() { return perm_mode; } -int MODE::get_current() { +int RUN_MODE::get_current() { if (temp_timeout > gstate.now) { return temp_mode; } else { @@ -2155,7 +2155,7 @@ int MODE::get_current() { } } -double MODE::delay() { +double RUN_MODE::delay() { if (temp_timeout > gstate.now) { return temp_timeout - gstate.now; } else { diff --git a/client/client_types.h b/client/client_types.h index e6feea4926..4504af4187 100644 --- a/client/client_types.h +++ b/client/client_types.h @@ -778,11 +778,11 @@ struct RESULT { // represents an always/auto/never value, possibly temporarily overridden -struct MODE { +struct RUN_MODE { int perm_mode; int temp_mode; double temp_timeout; - MODE(); + RUN_MODE(); void set(int mode, double duration); int get_perm(); int get_current(); diff --git a/client/cs_prefs.cpp b/client/cs_prefs.cpp index 118b236c01..7cd80ab231 100644 --- a/client/cs_prefs.cpp +++ b/client/cs_prefs.cpp @@ -105,7 +105,7 @@ int CLIENT_STATE::check_suspend_processing() { return SUSPEND_REASON_OS; } - switch (run_mode.get_current()) { + switch (cpu_run_mode.get_current()) { case RUN_MODE_ALWAYS: break; case RUN_MODE_NEVER: return SUSPEND_REASON_USER_REQ; @@ -156,7 +156,7 @@ int CLIENT_STATE::check_suspend_processing() { if (!coprocs.none()) { int old_gpu_suspend_reason = gpu_suspend_reason; gpu_suspend_reason = 0; - switch (gpu_mode.get_current()) { + switch (gpu_run_mode.get_current()) { case RUN_MODE_ALWAYS: break; case RUN_MODE_NEVER: @@ -249,7 +249,7 @@ void CLIENT_STATE::check_suspend_network() { ALLOW_NETWORK_IF_RECENT_RPC_PERIOD ); - switch(network_mode.get_current()) { + switch(network_run_mode.get_current()) { case RUN_MODE_ALWAYS: return; case RUN_MODE_NEVER: diff --git a/client/cs_statefile.cpp b/client/cs_statefile.cpp index 9e010c4e19..80472bb951 100644 --- a/client/cs_statefile.cpp +++ b/client/cs_statefile.cpp @@ -441,15 +441,15 @@ int CLIENT_STATE::parse_state_file_aux(const char* fname) { continue; } if (parse_int(buf, "", retval)) { - run_mode.set(retval, 0); + cpu_run_mode.set(retval, 0); continue; } if (parse_int(buf, "", retval)) { - gpu_mode.set(retval, 0); + gpu_run_mode.set(retval, 0); continue; } if (parse_int(buf, "", retval)) { - network_mode.set(retval, 0); + network_run_mode.set(retval, 0); continue; } if (parse_int(buf, "", old_major_version)) { @@ -727,9 +727,9 @@ int CLIENT_STATE::write_state(MIOFILE& f) { core_client_version.major, core_client_version.minor, core_client_version.release, - run_mode.get_perm(), - gpu_mode.get_perm(), - network_mode.get_perm(), + cpu_run_mode.get_perm(), + gpu_run_mode.get_perm(), + network_run_mode.get_perm(), cpu_benchmarks_pending?"\n":"", new_version_check_time, all_projects_list_check_time diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp index 5e6d640a02..bc06f596ac 100644 --- a/client/gui_rpc_server_ops.cpp +++ b/client/gui_rpc_server_ops.cpp @@ -311,7 +311,7 @@ static void handle_set_run_mode(char* buf, MIOFILE& fout) { fout.printf("Missing mode\n"); return; } - gstate.run_mode.set(mode, duration); + gstate.cpu_run_mode.set(mode, duration); fout.printf("\n"); } @@ -331,7 +331,7 @@ static void handle_set_gpu_mode(char* buf, MIOFILE& fout) { fout.printf("Missing mode\n"); return; } - gstate.gpu_mode.set(mode, duration); + gstate.gpu_run_mode.set(mode, duration); gstate.request_schedule_cpus("GPU mode changed"); fout.printf("\n"); } @@ -357,7 +357,7 @@ static void handle_set_network_mode(char* buf, MIOFILE& fout) { // gstate.gui_rpcs.time_of_last_rpc_needing_network = 0; - gstate.network_mode.set(mode, duration); + gstate.network_run_mode.set(mode, duration); fout.printf("\n"); } @@ -573,17 +573,17 @@ static void handle_get_cc_status(GUI_RPC_CONN* gr, MIOFILE& fout) { net_status.network_status(), gstate.acct_mgr_info.password_error?1:0, gstate.suspend_reason, - gstate.run_mode.get_current(), - gstate.run_mode.get_perm(), - gstate.run_mode.delay(), + gstate.cpu_run_mode.get_current(), + gstate.cpu_run_mode.get_perm(), + gstate.cpu_run_mode.delay(), gpu_suspend_reason, - gstate.gpu_mode.get_current(), - gstate.gpu_mode.get_perm(), - gstate.gpu_mode.delay(), + gstate.gpu_run_mode.get_current(), + gstate.gpu_run_mode.get_perm(), + gstate.gpu_run_mode.delay(), gstate.network_suspend_reason, - gstate.network_mode.get_current(), - gstate.network_mode.get_perm(), - gstate.network_mode.delay(), + gstate.network_run_mode.get_current(), + gstate.network_run_mode.get_perm(), + gstate.network_run_mode.delay(), config.disallow_attach?1:0, config.simple_gui_only?1:0 ); diff --git a/client/sim.cpp b/client/sim.cpp index d49ff95220..a73fdbb8cd 100644 --- a/client/sim.cpp +++ b/client/sim.cpp @@ -1060,8 +1060,7 @@ static void write_inputs() { ); if (use_rec) { fprintf(f, - "REC half-life: %f\n", - rec_half_life + "REC half-life: %f\n", config.rec_half_life ); } fprintf(f, @@ -1106,8 +1105,7 @@ void simulate() { ); if (use_rec) { fprintf(summary_file, - " REC half-life: %f\n", - rec_half_life + " REC half-life: %f\n", config.rec_half_life ); } fprintf(summary_file, @@ -1446,7 +1444,7 @@ int main(int argc, char** argv) { } else if (!strcmp(opt, "--use_hyst_fetch")) { use_hyst_fetch = true; } else if (!strcmp(opt, "--rec_half_life")) { - rec_half_life = atof(argv[i++]); + config.rec_half_life = atof(argv[i++]); } else { usage(argv[0]); } diff --git a/client/work_fetch.h b/client/work_fetch.h index de4e6bd250..d41a7eea3f 100644 --- a/client/work_fetch.h +++ b/client/work_fetch.h @@ -25,7 +25,6 @@ extern bool use_rec; #define USE_REC -extern double rec_half_life; extern bool use_hyst_fetch;