osmo-bsc[master]: separate reporting of RSL link status and OML link status

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Apr 24 14:24:43 UTC 2018


Patch Set 3: Code-Review-1

(5 comments)

sorry to again convolute the patch with criticism of prior API state ... but here goes. What do you think?

https://gerrit.osmocom.org/#/c/7574/3/src/libbsc/bts_ipaccess_nanobts.c
File src/libbsc/bts_ipaccess_nanobts.c:

Line 53: static char *_get_rsl_status(const struct gsm_bts *bts, bool is_oml_status)
Cosmetically, I'd prefer a _get_rsl_status() without 'is_oml_status'. Then get_oml_status() uses the clean _get_rsl_status() and itself decides whether to return "connected" or "degraded".


Line 67: 	return all_trx_rsl_connected_unlocked(bts) ? "connected" : "degraded";
The proper way to do this would be to define an enum of possible replies for get_oml_status() in gsm_data.h, accompanied by a value_string[] to convert to string.

In case you decide to stay with strings, then instead of repeating the string, I'd prefer const definitions. That also guarantees that it's possible to do something like:

  /* static? */
  const char *RSL_STR_UP = "connected";

  ...
    if (_get_rsl_status(...) == RSL_STR_UP)
      return OML_STR_UP;
    return OML_STR_DEGRADED;

(i.e. no need to strcmp() for string constants, comparing the addresses is enough. Would also work now, but only if you don't have typos anywhere.)

And in case you decide to stay with strings, should return 'const char*' everywhere, not 'char*'. (and fix the API definition of oml_get_status() too; returning char* was a mistake from the start).


Line 70: static char *get_rsl_status(const struct gsm_bts *bts)
return const char * (or enum value)


Line 75: static char *get_oml_status(const struct gsm_bts *bts)
so we need to change this to const char*, too.


Line 90: 	.rsl_status = &get_rsl_status,
and change the gsm_bts_model API. I'd do that, because it lives in osmo-bsc only anyway, and passing const char* around as char* is mad.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4bd0821503fc4407dbee8cb489675c19384de5cb
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de>
Gerrit-HasComments: Yes



More information about the gerrit-log mailing list