From a63856c5b75eee63d46b46f19c546f81f3f8ed2d Mon Sep 17 00:00:00 2001
From: Adam Wujek <adam.wujek@cern.ch>
Date: Thu, 26 Mar 2015 17:06:02 +0100
Subject: [PATCH] userspace/snmpd: split init_shm into init_shm_hal and
 init_shm_ppsi

No technical change.

Signed-off-by: Adam Wujek <adam.wujek@cern.ch>
---
 userspace/snmpd/snmp_shmem.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/userspace/snmpd/snmp_shmem.c b/userspace/snmpd/snmp_shmem.c
index 4a6cf2ba3..37bab3526 100644
--- a/userspace/snmpd/snmp_shmem.c
+++ b/userspace/snmpd/snmp_shmem.c
@@ -1,18 +1,20 @@
 #include "wrsSnmp.h"
 #include "snmp_shmem.h"
 
+/* HAL */
 struct wrs_shm_head *hal_head;
 struct hal_shmem_header *hal_shmem;
 struct hal_port_state *hal_ports;
 int hal_nports_local;
 
+/* PPSI */
 struct wrs_shm_head *ppsi_head;
 static struct pp_globals *ppg;
 struct wr_servo_state_t *ppsi_servo;
 
 
 
-void init_shm(void)
+static void init_shm_hal(void)
 {
 	hal_head = wrs_shm_get(wrs_shm_hal, "", WRS_SHM_READ);
 	if (!hal_head) {
@@ -44,14 +46,17 @@ void init_shm(void)
 			 " shmem");
 		exit(-1);
 	}
+}
 
+static void init_shm_ppsi(void)
+{
 	ppsi_head = wrs_shm_get(wrs_shm_ptp, "", WRS_SHM_READ);
 	if (!ppsi_head) {
 		snmp_log(LOG_ERR, "unable to open shm for PPSI!\n");
 		exit(-1);
 	}
 
-	/* check hal's shm version */
+	/* check ppsi's shm version */
 	if (ppsi_head->version != WRS_PPSI_SHMEM_VERSION) {
  		snmp_log(LOG_ERR, "unknown PPSI's shm version %i "
 			"(known is %i)\n",
@@ -67,3 +72,8 @@ void init_shm(void)
 	}
 
 }
+
+void init_shm(void){
+	init_shm_hal();
+	init_shm_ppsi();
+}
-- 
GitLab