stats: Add osmo_ name prefix to identifiers

Since the the stat_item and stats functions and data types are meant
to be exported, they get an osmo_ prefix.

Sponsored-by: On-Waves ehf

[hfreyther: Prepended the enum values too. This was requested by
Jacob]
diff --git a/src/vty/stats_vty.c b/src/vty/stats_vty.c
index 839dc82..f072b1b 100644
--- a/src/vty/stats_vty.c
+++ b/src/vty/stats_vty.c
@@ -45,7 +45,7 @@
 	1
 };
 
-static struct stats_reporter *osmo_stats_vty2srep(struct vty *vty)
+static struct osmo_stats_reporter *osmo_stats_vty2srep(struct vty *vty)
 {
 	if (vty->node == CFG_STATS_NODE)
 		return vty->index;
@@ -54,11 +54,11 @@
 }
 
 static int set_srep_parameter_str(struct vty *vty,
-	int (*fun)(struct stats_reporter *, const char *),
+	int (*fun)(struct osmo_stats_reporter *, const char *),
 	const char *val, const char *param_name)
 {
 	int rc;
-	struct stats_reporter *srep = osmo_stats_vty2srep(vty);
+	struct osmo_stats_reporter *srep = osmo_stats_vty2srep(vty);
 	OSMO_ASSERT(srep);
 
 	rc = fun(srep, val);
@@ -72,12 +72,12 @@
 }
 
 static int set_srep_parameter_int(struct vty *vty,
-	int (*fun)(struct stats_reporter *, int),
+	int (*fun)(struct osmo_stats_reporter *, int),
 	const char *val, const char *param_name)
 {
 	int rc;
 	int int_val;
-	struct stats_reporter *srep = osmo_stats_vty2srep(vty);
+	struct osmo_stats_reporter *srep = osmo_stats_vty2srep(vty);
 	OSMO_ASSERT(srep);
 
 	int_val = atoi(val);
@@ -97,7 +97,7 @@
 	"Set the IP address to which we bind locally\n"
 	"IP Address\n")
 {
-	return set_srep_parameter_str(vty, stats_reporter_set_local_addr,
+	return set_srep_parameter_str(vty, osmo_stats_reporter_set_local_addr,
 		argv[0], "local address");
 }
 
@@ -106,7 +106,7 @@
 	NO_STR
 	"Set the IP address to which we bind locally\n")
 {
-	return set_srep_parameter_str(vty, stats_reporter_set_local_addr,
+	return set_srep_parameter_str(vty, osmo_stats_reporter_set_local_addr,
 		NULL, "local address");
 }
 
@@ -115,7 +115,7 @@
 	"Set the remote IP address to which we connect\n"
 	"IP Address\n")
 {
-	return set_srep_parameter_str(vty, stats_reporter_set_remote_addr,
+	return set_srep_parameter_str(vty, osmo_stats_reporter_set_remote_addr,
 		argv[0], "remote address");
 }
 
@@ -124,7 +124,7 @@
 	"Set the remote port to which we connect\n"
 	"Remote port number\n")
 {
-	return set_srep_parameter_int(vty, stats_reporter_set_remote_port,
+	return set_srep_parameter_int(vty, osmo_stats_reporter_set_remote_port,
 		argv[0], "remote port");
 }
 
@@ -133,7 +133,7 @@
 	"Set the maximum packet size\n"
 	"Size in byte\n")
 {
-	return set_srep_parameter_int(vty, stats_reporter_set_mtu,
+	return set_srep_parameter_int(vty, osmo_stats_reporter_set_mtu,
 		argv[0], "mtu");
 }
 
@@ -141,7 +141,7 @@
 	"no mtu",
 	NO_STR "Set the maximum packet size\n")
 {
-	return set_srep_parameter_int(vty, stats_reporter_set_mtu,
+	return set_srep_parameter_int(vty, osmo_stats_reporter_set_mtu,
 		0, "mtu");
 }
 
@@ -150,7 +150,7 @@
 	"Set the item name prefix\n"
 	"The prefix string\n")
 {
-	return set_srep_parameter_str(vty, stats_reporter_set_name_prefix,
+	return set_srep_parameter_str(vty, osmo_stats_reporter_set_name_prefix,
 		argv[0], "prefix string");
 }
 
@@ -159,7 +159,7 @@
 	NO_STR
 	"Set the item name prefix\n")
 {
-	return set_srep_parameter_str(vty, stats_reporter_set_name_prefix,
+	return set_srep_parameter_str(vty, osmo_stats_reporter_set_name_prefix,
 		"", "prefix string");
 }
 
@@ -168,10 +168,10 @@
 	"Enable the reporter\n")
 {
 	int rc;
-	struct stats_reporter *srep = osmo_stats_vty2srep(vty);
+	struct osmo_stats_reporter *srep = osmo_stats_vty2srep(vty);
 	OSMO_ASSERT(srep);
 
-	rc = stats_reporter_enable(srep);
+	rc = osmo_stats_reporter_enable(srep);
 	if (rc < 0) {
 		vty_out(vty, "%% Unable to enable the reporter: %s%s",
 			strerror(-rc), VTY_NEWLINE);
@@ -186,10 +186,10 @@
 	"Disable the reporter\n")
 {
 	int rc;
-	struct stats_reporter *srep = osmo_stats_vty2srep(vty);
+	struct osmo_stats_reporter *srep = osmo_stats_vty2srep(vty);
 	OSMO_ASSERT(srep);
 
-	rc = stats_reporter_disable(srep);
+	rc = osmo_stats_reporter_disable(srep);
 	if (rc < 0) {
 		vty_out(vty, "%% Unable to disable the reporter: %s%s",
 			strerror(-rc), VTY_NEWLINE);
@@ -203,17 +203,17 @@
 	"stats reporter statsd",
 	CFG_STATS_STR CFG_REPORTER_STR "Report to a STATSD server\n")
 {
-	struct stats_reporter *srep;
+	struct osmo_stats_reporter *srep;
 
-	srep = stats_reporter_find(STATS_REPORTER_STATSD, NULL);
+	srep = osmo_stats_reporter_find(OSMO_STATS_REPORTER_STATSD, NULL);
 	if (!srep) {
-		srep = stats_reporter_create_statsd(NULL);
+		srep = osmo_stats_reporter_create_statsd(NULL);
 		if (!srep) {
 			vty_out(vty, "%% Unable to create statsd reporter%s",
 				VTY_NEWLINE);
 			return CMD_WARNING;
 		}
-		/* TODO: if needed, add stats_add_reporter(srep); */
+		/* TODO: if needed, add osmo_stats_add_reporter(srep); */
 	}
 
 	vty->index = srep;
@@ -229,7 +229,7 @@
 {
 	int rc;
 	int interval = atoi(argv[0]);
-	rc = stats_set_interval(interval);
+	rc = osmo_stats_set_interval(interval);
 	if (rc < 0) {
 		vty_out(vty, "%% Unable to set interval: %s%s",
 			strerror(-rc), VTY_NEWLINE);
@@ -244,16 +244,16 @@
 	"no stats reporter statsd",
 	NO_STR CFG_STATS_STR CFG_REPORTER_STR "Report to a STATSD server\n")
 {
-	struct stats_reporter *srep;
+	struct osmo_stats_reporter *srep;
 
-	srep = stats_reporter_find(STATS_REPORTER_STATSD, NULL);
+	srep = osmo_stats_reporter_find(OSMO_STATS_REPORTER_STATSD, NULL);
 	if (!srep) {
 		vty_out(vty, "%% No statsd logging active%s",
 			VTY_NEWLINE);
 		return CMD_WARNING;
 	}
 
-	stats_reporter_free(srep);
+	osmo_stats_reporter_free(srep);
 
 	return CMD_SUCCESS;
 }
@@ -262,17 +262,17 @@
 	"stats reporter log",
 	CFG_STATS_STR CFG_REPORTER_STR "Report to the logger\n")
 {
-	struct stats_reporter *srep;
+	struct osmo_stats_reporter *srep;
 
-	srep = stats_reporter_find(STATS_REPORTER_LOG, NULL);
+	srep = osmo_stats_reporter_find(OSMO_STATS_REPORTER_LOG, NULL);
 	if (!srep) {
-		srep = stats_reporter_create_log(NULL);
+		srep = osmo_stats_reporter_create_log(NULL);
 		if (!srep) {
 			vty_out(vty, "%% Unable to create log reporter%s",
 				VTY_NEWLINE);
 			return CMD_WARNING;
 		}
-		/* TODO: if needed, add stats_add_reporter(srep); */
+		/* TODO: if needed, add osmo_stats_add_reporter(srep); */
 	}
 
 	vty->index = srep;
@@ -285,16 +285,16 @@
 	"no stats reporter log",
 	NO_STR CFG_STATS_STR CFG_REPORTER_STR "Report to the logger\n")
 {
-	struct stats_reporter *srep;
+	struct osmo_stats_reporter *srep;
 
-	srep = stats_reporter_find(STATS_REPORTER_LOG, NULL);
+	srep = osmo_stats_reporter_find(OSMO_STATS_REPORTER_LOG, NULL);
 	if (!srep) {
 		vty_out(vty, "%% No log reporting active%s",
 			VTY_NEWLINE);
 		return CMD_WARNING;
 	}
 
-	stats_reporter_free(srep);
+	osmo_stats_reporter_free(srep);
 
 	return CMD_SUCCESS;
 }
@@ -309,16 +309,16 @@
 	return CMD_SUCCESS;
 }
 
-static int config_write_stats_reporter(struct vty *vty, struct stats_reporter *srep)
+static int config_write_stats_reporter(struct vty *vty, struct osmo_stats_reporter *srep)
 {
 	if (srep == NULL)
 		return 0;
 
 	switch (srep->type) {
-	case STATS_REPORTER_STATSD:
+	case OSMO_STATS_REPORTER_STATSD:
 		vty_out(vty, "stats reporter statsd%s", VTY_NEWLINE);
 		break;
-	case STATS_REPORTER_LOG:
+	case OSMO_STATS_REPORTER_LOG:
 		vty_out(vty, "stats reporter log%s", VTY_NEWLINE);
 		break;
 	}
@@ -354,20 +354,20 @@
 
 static int config_write_stats(struct vty *vty)
 {
-	struct stats_reporter *srep;
+	struct osmo_stats_reporter *srep;
 
 	/* TODO: loop through all reporters */
-	srep = stats_reporter_find(STATS_REPORTER_STATSD, NULL);
+	srep = osmo_stats_reporter_find(OSMO_STATS_REPORTER_STATSD, NULL);
 	config_write_stats_reporter(vty, srep);
-	srep = stats_reporter_find(STATS_REPORTER_LOG, NULL);
+	srep = osmo_stats_reporter_find(OSMO_STATS_REPORTER_LOG, NULL);
 	config_write_stats_reporter(vty, srep);
 
-	vty_out(vty, "stats interval %d%s", stats_config->interval, VTY_NEWLINE);
+	vty_out(vty, "stats interval %d%s", osmo_stats_config->interval, VTY_NEWLINE);
 
 	return 1;
 }
 
-void stats_vty_add_cmds()
+void osmo_stats_vty_add_cmds()
 {
 	install_element_ve(&show_stats_cmd);