[PATCH] osmo-bsc[master]: rename helper functions in the acc ramp code to avoid confusion

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Wed Apr 11 19:03:25 UTC 2018


Hello Pau Espin Pedrol, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/7750

to look at the new patch set (#2).

rename helper functions in the acc ramp code to avoid confusion

The word 'enabled' was used in two contexts: Whether ACC ramp is
enabled as a feature, and whether a particular access control class
is permantly allowed/disallowed via VTY configuration.

Rename some helper functions to avoid the use of the word 'enabled'
in the latter context.

Change-Id: Ia67e84270cd50f4c55b8cf616ca38b00482f765c
Related: OS#2591
---
M src/libbsc/acc_ramp.c
1 file changed, 13 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/50/7750/2

diff --git a/src/libbsc/acc_ramp.c b/src/libbsc/acc_ramp.c
index 54626ad..6d9be59 100644
--- a/src/libbsc/acc_ramp.c
+++ b/src/libbsc/acc_ramp.c
@@ -32,12 +32,12 @@
  * Check if an ACC has been permanently barred for a BTS,
  * e.g. with the 'rach access-control-class' VTY command.
  */
-static bool acc_is_enabled(struct gsm_bts *bts, unsigned int acc)
+static bool acc_is_permanently_barred(struct gsm_bts *bts, unsigned int acc)
 {
 	OSMO_ASSERT(acc >= 0 && acc <= 9);
 	if (acc == 8 || acc == 9)
-		return (bts->si_common.rach_control.t2 & (1 << (acc - 8))) == 0;
-	return (bts->si_common.rach_control.t3 & (1 << (acc))) == 0;
+		return (bts->si_common.rach_control.t2 & (1 << (acc - 8)));
+	return (bts->si_common.rach_control.t3 & (1 << (acc)));
 }
 
 static void allow_one_acc(struct acc_ramp *acc_ramp, unsigned int acc)
@@ -56,20 +56,20 @@
 	acc_ramp->barred_accs |= (1 << acc);
 }
 
-static void barr_all_enabled_accs(struct acc_ramp *acc_ramp)
+static void barr_all_accs(struct acc_ramp *acc_ramp)
 {
 	unsigned int acc;
 	for (acc = 0; acc < 10; acc++) {
-		if (acc_is_enabled(acc_ramp->bts, acc))
+		if (!acc_is_permanently_barred(acc_ramp->bts, acc))
 			barr_one_acc(acc_ramp, acc);
 	}
 }
 
-static void allow_all_enabled_accs(struct acc_ramp *acc_ramp)
+static void allow_all_accs(struct acc_ramp *acc_ramp)
 {
 	unsigned int acc;
 	for (acc = 0; acc < 10; acc++) {
-		if (acc_is_enabled(acc_ramp->bts, acc))
+		if (!acc_is_permanently_barred(acc_ramp->bts, acc))
 			allow_one_acc(acc_ramp, acc);
 	}
 }
@@ -102,7 +102,7 @@
 
 	/* Shortcut in case we only do one ramping step. */
 	if (acc_ramp->step_size == ACC_RAMP_STEP_SIZE_MAX) {
-		allow_all_enabled_accs(acc_ramp);
+		allow_all_accs(acc_ramp);
 		gsm_bts_set_system_infos(acc_ramp->bts);
 		return;
 	}
@@ -113,14 +113,14 @@
 		if (idx > 0) {
 			/* One of ACC0-ACC7 is still bared. */
 			unsigned int acc = idx - 1;
-			if (acc_is_enabled(acc_ramp->bts, acc))
+			if (!acc_is_permanently_barred(acc_ramp->bts, acc))
 				allow_one_acc(acc_ramp, acc);
 		} else {
 			idx = ffs(acc_ramp_get_barred_t2(acc_ramp));
 			if (idx == 1 || idx == 2) {
 				/* ACC8 or ACC9 is still barred. */
 				unsigned int acc = idx - 1 + 8;
-				if (acc_is_enabled(acc_ramp->bts, acc))
+				if (!acc_is_permanently_barred(acc_ramp->bts, acc))
 					allow_one_acc(acc_ramp, acc);
 			} else {
 				/* All ACCs are now allowed. */
@@ -196,7 +196,7 @@
 	acc_ramp->step_size = ACC_RAMP_STEP_SIZE_DEFAULT;
 	acc_ramp->step_interval_sec = ACC_RAMP_STEP_INTERVAL_MIN;
 	acc_ramp->step_interval_is_fixed = false;
-	allow_all_enabled_accs(acc_ramp);
+	allow_all_accs(acc_ramp);
 	osmo_timer_setup(&acc_ramp->step_timer, do_acc_ramping_step, acc_ramp);
 	osmo_signal_register_handler(SS_NM, acc_ramp_nm_sig_cb, acc_ramp);
 }
@@ -262,7 +262,7 @@
 
 	if (acc_ramp_is_enabled(acc_ramp)) {
 		/* Set all available ACCs to barred and start ramping up. */
-		barr_all_enabled_accs(acc_ramp);
+		barr_all_accs(acc_ramp);
 		do_acc_ramping_step(acc_ramp);
 	}
 }
@@ -276,5 +276,5 @@
 	if (osmo_timer_pending(&acc_ramp->step_timer))
 		osmo_timer_del(&acc_ramp->step_timer);
 
-	allow_all_enabled_accs(acc_ramp);
+	allow_all_accs(acc_ramp);
 }

-- 
To view, visit https://gerrit.osmocom.org/7750
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia67e84270cd50f4c55b8cf616ca38b00482f765c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list