67 const char *
file,
int line);
212 #define osmo_use_count_get_put(USE_LIST, USE, CHANGE) \ 213 _osmo_use_count_get_put(USE_LIST, USE, CHANGE, __FILE__, __LINE__) 216 const char *
file,
int line);
227 size_t buf_n_entries);
Use counter state for one used object, managing N distinct named counters.
Definition: use_count.h:172
int32_t count
Current use count amount for only this use token string.
Definition: use_count.h:203
int32_t osmo_use_count_by(const struct osmo_use_count *uc, const char *use)
Return use count by a single use token.
Definition: use_count.c:90
struct osmo_use_count * use_count
Parent use count and backpointer to the talloc_object.
Definition: use_count.h:198
struct llist_head use_counts
List of use tokens.
Definition: use_count.h:179
write Write running configuration to or terminal n Write configuration to the file(same as write file)\n") ALIAS(config_write_file
int _osmo_use_count_get_put(struct osmo_use_count *uc, const char *use, int32_t change, const char *file, int line)
Implementation for osmo_use_count_get_put(), which can also be directly invoked to pass source file i...
Definition: use_count.c:208
Simple doubly linked list implementation.
void osmo_use_count_free(struct osmo_use_count_entry *use_count_entry)
Deallocate a use count entry.
Definition: use_count.c:195
const char * use
Use token string that was passed to osmo_use_count_get_put().
Definition: use_count.h:200
(double) linked list header structure
Definition: linuxlist.h:45
int32_t osmo_use_count_total(const struct osmo_use_count *uc)
Return the sum of all use counts, min- and max-clamped at INT32_MIN and INT32_MAX.
Definition: use_count.c:71
struct osmo_use_count_entry * osmo_use_count_find(const struct osmo_use_count *uc, const char *use)
Definition: use_count.c:139
One named counter in the list managed by osmo_use_count.
Definition: use_count.h:194
osmo_use_count_cb_t use_cb
If not NULL, this is invoked for each use count change.
Definition: use_count.h:177
const char * osmo_use_count_name_buf(char *buf, size_t buf_len, const struct osmo_use_count *uc)
Write a comprehensive listing of use counts to a string buffer.
Definition: use_count.c:108
void * talloc_object
Context to talloc-allocate use count entries from (if at all necessary); back-pointer to the owning o...
Definition: use_count.h:175
int(* osmo_use_count_cb_t)(struct osmo_use_count_entry *use_count_entry, int32_t old_use_count, const char *file, int line)
Invoked when a use count changes.
Definition: use_count.h:66
void osmo_use_count_make_static_entries(struct osmo_use_count *uc, struct osmo_use_count_entry *buf, size_t buf_n_entries)
Add N static use token entries to avoid dynamic allocation of use count tokens.
Definition: use_count.c:264