Browse Source

[infiniband] Include hostname in node description, if available

tags/v1.0.0-rc1
Michael Brown 15 years ago
parent
commit
228ac9d018
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/net/infiniband/ib_sma.c

+ 7
- 1
src/net/infiniband/ib_sma.c View File

25
 #include <stdio.h>
25
 #include <stdio.h>
26
 #include <unistd.h>
26
 #include <unistd.h>
27
 #include <byteswap.h>
27
 #include <byteswap.h>
28
+#include <gpxe/settings.h>
28
 #include <gpxe/infiniband.h>
29
 #include <gpxe/infiniband.h>
29
 #include <gpxe/iobuf.h>
30
 #include <gpxe/iobuf.h>
30
 #include <gpxe/ib_mi.h>
31
 #include <gpxe/ib_mi.h>
88
 			       struct ib_address_vector *av ) {
89
 			       struct ib_address_vector *av ) {
89
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
90
 	struct ib_node_desc *node_desc = &mad->smp.smp_data.node_desc;
90
 	struct ib_gid_half guid;
91
 	struct ib_gid_half guid;
92
+	char hostname[ sizeof ( node_desc->node_string ) ];
93
+	int hostname_len;
91
 	int rc;
94
 	int rc;
92
 
95
 
93
 	/* Fill in information */
96
 	/* Fill in information */
94
 	memset ( node_desc, 0, sizeof ( *node_desc ) );
97
 	memset ( node_desc, 0, sizeof ( *node_desc ) );
95
 	ib_get_hca_info ( ibdev, &guid );
98
 	ib_get_hca_info ( ibdev, &guid );
99
+	hostname_len = fetch_string_setting ( NULL, &hostname_setting,
100
+					      hostname, sizeof ( hostname ) );
96
 	snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
101
 	snprintf ( node_desc->node_string, sizeof ( node_desc->node_string ),
97
-		   "gPXE %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
102
+		   "gPXE %s%s%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)",
103
+		   hostname, ( ( hostname_len >= 0 ) ? " " : "" ),
98
 		   guid.u.bytes[0], guid.u.bytes[1], guid.u.bytes[2],
104
 		   guid.u.bytes[0], guid.u.bytes[1], guid.u.bytes[2],
99
 		   guid.u.bytes[3], guid.u.bytes[4], guid.u.bytes[5],
105
 		   guid.u.bytes[3], guid.u.bytes[4], guid.u.bytes[5],
100
 		   guid.u.bytes[6], guid.u.bytes[7], ibdev->dev->name );
106
 		   guid.u.bytes[6], guid.u.bytes[7], ibdev->dev->name );

Loading…
Cancel
Save