Nothing too fancy in this patch. I wanted to output some debug stuff
into the log, and needed to get the p_log pointer passed into
osm_switch_recommend_path(). Adding it into osm_switch_t seemed the
easiest/best way. If you think we should get it into
osm_switch_recommend_path() a different way, PLMK.
Al
--
Albert Chu
[EMAIL PROTECTED]
925-422-5311
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
>From 3461b4c439582d1e3e378ad3a853ff792649b11a Mon Sep 17 00:00:00 2001
From: Albert L. Chu <[EMAIL PROTECTED]>
Date: Thu, 20 Mar 2008 16:22:44 -0700
Subject: [PATCH] add log pointer to osm_switch_t
Signed-off-by: Albert L. Chu <[EMAIL PROTECTED]>
---
opensm/include/opensm/osm_switch.h | 11 ++++++++++-
opensm/opensm/osm_sw_info_rcv.c | 2 +-
opensm/opensm/osm_switch.c | 8 ++++++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/opensm/include/opensm/osm_switch.h b/opensm/include/opensm/osm_switch.h
index 904a61d..2624d5f 100644
--- a/opensm/include/opensm/osm_switch.h
+++ b/opensm/include/opensm/osm_switch.h
@@ -56,6 +56,7 @@
#include <opensm/osm_fwd_tbl.h>
#include <opensm/osm_mcast_tbl.h>
#include <opensm/osm_port_profile.h>
+#include <opensm/osm_log.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -99,6 +100,7 @@ BEGIN_C_DECLS
*/
typedef struct _osm_switch {
cl_map_item_t map_item;
+ osm_log_t *p_log;
osm_node_t *p_node;
ib_switch_info_t switch_info;
uint16_t max_lid_ho;
@@ -114,9 +116,13 @@ typedef struct _osm_switch {
} osm_switch_t;
/*
* FIELDS
+*
* map_item
* Linkage structure for cl_qmap. MUST BE FIRST MEMBER!
*
+* p_log
+* Pointer to the log object.
+*
* p_node
* Pointer to the Node object for this switch.
*
@@ -218,10 +224,13 @@ void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw);
*
* SYNOPSIS
*/
-osm_switch_t *osm_switch_new(IN osm_node_t * const p_node,
+osm_switch_t *osm_switch_new(IN osm_log_t * p_log,
+ IN osm_node_t * const p_node,
IN const osm_madw_t * const p_madw);
/*
* PARAMETERS
+* p_log
+* [in] Pointer to a log object.
* p_node
* [in] Pointer to the node object of this switch
*
diff --git a/opensm/opensm/osm_sw_info_rcv.c b/opensm/opensm/osm_sw_info_rcv.c
index 6c9d2b6..b53951f 100644
--- a/opensm/opensm/osm_sw_info_rcv.c
+++ b/opensm/opensm/osm_sw_info_rcv.c
@@ -300,7 +300,7 @@ __osm_si_rcv_process_new(IN osm_sm_t * sm,
Allocate a new switch object for this switch,
and place it in the switch table.
*/
- p_sw = osm_switch_new(p_node, p_madw);
+ p_sw = osm_switch_new(sm->p_log, p_node, p_madw);
if (p_sw == NULL) {
OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3608: "
"Unable to allocate new switch object\n");
diff --git a/opensm/opensm/osm_switch.c b/opensm/opensm/osm_switch.c
index a8e4b72..f346b25 100644
--- a/opensm/opensm/osm_switch.c
+++ b/opensm/opensm/osm_switch.c
@@ -82,6 +82,7 @@ osm_switch_set_hops(IN osm_switch_t * const p_sw,
**********************************************************************/
static ib_api_status_t
osm_switch_init(IN osm_switch_t * const p_sw,
+ IN osm_log_t * p_log,
IN osm_node_t * const p_node,
IN const osm_madw_t * const p_madw)
{
@@ -97,6 +98,7 @@ osm_switch_init(IN osm_switch_t * const p_sw,
CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_SWITCH_INFO);
+ p_sw->p_log = p_log;
p_sw->p_node = p_node;
p_sw->switch_info = *p_si;
p_sw->num_ports = num_ports;
@@ -149,19 +151,21 @@ void osm_switch_delete(IN OUT osm_switch_t ** const pp_sw)
/**********************************************************************
**********************************************************************/
-osm_switch_t *osm_switch_new(IN osm_node_t * const p_node,
+osm_switch_t *osm_switch_new(IN osm_log_t * p_log,
+ IN osm_node_t * const p_node,
IN const osm_madw_t * const p_madw)
{
ib_api_status_t status;
osm_switch_t *p_sw;
+ CL_ASSERT(p_log);
CL_ASSERT(p_madw);
CL_ASSERT(p_node);
p_sw = (osm_switch_t *) malloc(sizeof(*p_sw));
if (p_sw) {
memset(p_sw, 0, sizeof(*p_sw));
- status = osm_switch_init(p_sw, p_node, p_madw);
+ status = osm_switch_init(p_sw, p_log, p_node, p_madw);
if (status != IB_SUCCESS)
osm_switch_delete(&p_sw);
}
--
1.5.1
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general