\doxysection{use\+\_\+count.\+h}
\label{use__count_8h_source}\index{include/osmocom/core/use\_count.h@{include/osmocom/core/use\_count.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{4 \textcolor{comment}{/*}}
\DoxyCodeLine{5 \textcolor{comment}{ * (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>}}
\DoxyCodeLine{6 \textcolor{comment}{ *}}
\DoxyCodeLine{7 \textcolor{comment}{ * All Rights Reserved}}
\DoxyCodeLine{8 \textcolor{comment}{ *}}
\DoxyCodeLine{9 \textcolor{comment}{ * Author: Neels Hofmeyr <neels@hofmeyr.de>}}
\DoxyCodeLine{10 \textcolor{comment}{ *}}
\DoxyCodeLine{11 \textcolor{comment}{ * SPDX-\/License-\/Identifier: GPL-\/2.0+}}
\DoxyCodeLine{12 \textcolor{comment}{ *}}
\DoxyCodeLine{13 \textcolor{comment}{ * This program is free software; you can redistribute it and/or modify}}
\DoxyCodeLine{14 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}}
\DoxyCodeLine{15 \textcolor{comment}{ * the Free Software Foundation; either version 2 of the License, or}}
\DoxyCodeLine{16 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{17 \textcolor{comment}{ *}}
\DoxyCodeLine{18 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{19 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{20 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{21 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{22 \textcolor{comment}{ */}}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{25 }
\DoxyCodeLine{26 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{27 \textcolor{preprocessor}{\#include <stdlib.h>}}
\DoxyCodeLine{28 }
\DoxyCodeLine{29 \textcolor{preprocessor}{\#include <osmocom/core/linuxlist.h>}}
\DoxyCodeLine{30 }
\DoxyCodeLine{36 \textcolor{keyword}{struct }osmo\_use\_count\_entry;}
\DoxyCodeLine{37 }
\DoxyCodeLine{62 \textcolor{keyword}{typedef} int (* osmo\_use\_count\_cb\_t )(\textcolor{keyword}{struct }osmo\_use\_count\_entry *use\_count\_entry, int32\_t old\_use\_count,}
\DoxyCodeLine{63                                      \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file, \textcolor{keywordtype}{int} line);}
\DoxyCodeLine{64 }
\DoxyCodeLine{168 \textcolor{keyword}{struct }osmo\_use\_count \{}
\DoxyCodeLine{171         \textcolor{keywordtype}{void} *talloc\_object;}
\DoxyCodeLine{173         osmo\_use\_count\_cb\_t use\_cb;}
\DoxyCodeLine{175         \textcolor{keyword}{struct }llist\_head use\_counts;}
\DoxyCodeLine{176 \};}
\DoxyCodeLine{177 }
\DoxyCodeLine{190 \textcolor{keyword}{struct }osmo\_use\_count\_entry \{}
\DoxyCodeLine{192         \textcolor{keyword}{struct }llist\_head entry;}
\DoxyCodeLine{194         \textcolor{keyword}{struct }osmo\_use\_count *use\_count;}
\DoxyCodeLine{196         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *use;}
\DoxyCodeLine{199         int32\_t count;}
\DoxyCodeLine{200 \};}
\DoxyCodeLine{201 }
\DoxyCodeLine{208 \textcolor{preprocessor}{\#define osmo\_use\_count\_get\_put(USE\_LIST, USE, CHANGE) \(\backslash\)}}
\DoxyCodeLine{209 \textcolor{preprocessor}{        \_osmo\_use\_count\_get\_put(USE\_LIST, USE, CHANGE, \_\_FILE\_\_, \_\_LINE\_\_)}}
\DoxyCodeLine{210 }
\DoxyCodeLine{211 \textcolor{keywordtype}{int} \_osmo\_use\_count\_get\_put(\textcolor{keyword}{struct} osmo\_use\_count *uc, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *use, int32\_t change,}
\DoxyCodeLine{212                             \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file, \textcolor{keywordtype}{int} line);}
\DoxyCodeLine{213 }
\DoxyCodeLine{214 \textcolor{keyword}{const} \textcolor{keywordtype}{char} *osmo\_use\_count\_name\_buf(\textcolor{keywordtype}{char} *buf, \textcolor{keywordtype}{size\_t} buf\_len, \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_use\_count *uc);}
\DoxyCodeLine{215 \textcolor{keywordtype}{int} osmo\_use\_count\_to\_str\_buf(\textcolor{keywordtype}{char} *buf, \textcolor{keywordtype}{size\_t} buf\_len, \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_use\_count *uc);}
\DoxyCodeLine{216 \textcolor{keywordtype}{char} *osmo\_use\_count\_to\_str\_c(\textcolor{keywordtype}{void} *ctx, \textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_use\_count *uc);}
\DoxyCodeLine{217 }
\DoxyCodeLine{218 int32\_t osmo\_use\_count\_total(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_use\_count *uc);}
\DoxyCodeLine{219 int32\_t osmo\_use\_count\_by(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_use\_count *uc, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *use);}
\DoxyCodeLine{220 }
\DoxyCodeLine{221 \textcolor{keyword}{struct }osmo\_use\_count\_entry *osmo\_use\_count\_find(\textcolor{keyword}{const} \textcolor{keyword}{struct} osmo\_use\_count *uc, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *use);}
\DoxyCodeLine{222 \textcolor{keywordtype}{void} osmo\_use\_count\_free(\textcolor{keyword}{struct} osmo\_use\_count\_entry *use\_count\_entry);}
\DoxyCodeLine{223 }
\DoxyCodeLine{224 \textcolor{keywordtype}{void} osmo\_use\_count\_make\_static\_entries(\textcolor{keyword}{struct} osmo\_use\_count *uc, \textcolor{keyword}{struct} osmo\_use\_count\_entry *buf,}
\DoxyCodeLine{225                                         \textcolor{keywordtype}{size\_t} buf\_n\_entries);}
\DoxyCodeLine{226 }

\end{DoxyCode}
