vlib: introduce vlib_get_elog_main()

Type: improvement
Change-Id: I73383eb15186021cd6527d112da8443a0082f129
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlibmemory/memory_api.h b/src/vlibmemory/memory_api.h
index f658006..843bf89 100644
--- a/src/vlibmemory/memory_api.h
+++ b/src/vlibmemory/memory_api.h
@@ -67,17 +67,22 @@
   return ((restarts & VL_API_EPOCH_MASK) == epoch);
 }
 
-#define VL_MEM_API_LOG_Q_LEN(fmt,qlen)			\
-if (TRACE_VLIB_MEMORY_QUEUE)				\
-  do {							\
-      ELOG_TYPE_DECLARE (e) = {				\
-        .format = fmt,					\
-        .format_args = "i4",				\
-      };							\
-      struct { u32 len; } *ed;				\
-      ed = ELOG_DATA (&vm->elog_main, e);		\
-      ed->len = qlen;					\
-  } while (0)
+#define VL_MEM_API_LOG_Q_LEN(fmt, qlen)                                       \
+  if (TRACE_VLIB_MEMORY_QUEUE)                                                \
+    do                                                                        \
+      {                                                                       \
+	ELOG_TYPE_DECLARE (e) = {                                             \
+	  .format = fmt,                                                      \
+	  .format_args = "i4",                                                \
+	};                                                                    \
+	struct                                                                \
+	{                                                                     \
+	  u32 len;                                                            \
+	} * ed;                                                               \
+	ed = ELOG_DATA (&vlib_global_main.elog_main, e);                      \
+	ed->len = qlen;                                                       \
+      }                                                                       \
+  while (0)
 
 #endif /* SRC_VLIBMEMORY_MEMORY_API_H_ */