osmo-pcu[master]: Initialize logging before initializing rate_ctr

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Oct 25 14:36:58 UTC 2017


Patch Set 3:

(3 comments)

There are numerous ways to solve chicken/eggs like this... ideas:

Wrap m_ratectrs in a getter function, which allocates the rate counters the first time the getter is called (only if m_ratectrs == NULL), instead of doing so directly in the constructor.

or

Make the global singleton BTS dynamically allocated (a pointer instead of an instance) and call the constructor after the logging init; also move the call to bts_main_data() further down in pcu_main.c.

In this patch, I wonder why the extensive move / separate files are needed. Is that a cosmetic choice or a compilation requirement?

https://gerrit.osmocom.org/#/c/4411/3/src/bts.h
File src/bts.h:

Line 220: 	struct rate_ctr_group *ctrs;
curious, any reason to place it squarely in the middle between lots of unrelated uints?


https://gerrit.osmocom.org/#/c/4411/3/src/pcu_ctr.c
File src/pcu_ctr.c:

Line 5:  * Author: Max Suraev <msuraev at sysmocom.de>
"sysmocom" not capitalized, also Harald says to add a dash, which I wasn't aware of until recently. I usually also add a mail address...

  by sysmocom - s.f.m.c. GmbH <info at sysmocom.de>


Line 32: 	const struct rate_ctr_desc bts_ctr_description[] = {
I assume these structs aren't copied by the rate_ctr_init(?), in which case they must be static.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibf557d21552d9ff1d6b595b0594f2c7b18db4692
Gerrit-PatchSet: 3
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-HasComments: Yes


More information about the gerrit-log mailing list