17197465 ibnetdiscover reveals internal paths s11-update
authorBoris Chiu <boris.chiu@oracle.com>
Mon, 23 Dec 2013 14:14:12 -0800
branchs11-update
changeset 2867 573013b5a562
parent 2865 b1ed533f4c5a
child 2868 7d6a27aef8cf
17197465 ibnetdiscover reveals internal paths
components/open-fabrics/infiniband-diags/patches/base.patch
--- a/components/open-fabrics/infiniband-diags/patches/base.patch	Sun Dec 22 18:16:38 2013 -0800
+++ b/components/open-fabrics/infiniband-diags/patches/base.patch	Mon Dec 23 14:14:12 2013 -0800
@@ -792,6 +792,66 @@
  
  	memset(umad, 0, sizeof(umad));
  
+diff -r -u /tmp/infiniband-diags-1.5.8/libibnetdisc/src/internal.h infiniband-diags-1.5.8/libibnetdisc/src/internal.h
+--- /tmp/infiniband-diags-1.5.8/libibnetdisc/src/internal.h	Wed Feb 16 02:13:21 2011
++++ infiniband-diags-1.5.8/libibnetdisc/src/internal.h	Tue Sep 17 13:12:20 2013
[email protected]@ -41,12 +41,56 @@
+ #include <infiniband/ibnetdisc.h>
+ #include <complib/cl_qmap.h>
+ 
++#if defined(__SVR4) && defined(__sun)
++#include <sys/varargs.h>
++
++static inline void
++ibnd_msg_internal(FILE *fd, const char *format, va_list alist)
++{
++	const char	*filename;
++	char		*filename_p;
++	char		*format_p = format;
++
++	/*
++	 * The filename returned by va_arg() has the full path. Skip "%s"
++	 * from format="%s:%u; " and truncate full pathname of src file to
++	 * start with infiniband-diags.
++	 */
++	filename = va_arg(alist, const char *);
++	format_p += 2;
++	if ((filename_p = strstr(filename, "infiniband-diags-")) != NULL) {
++		(void) fprintf(fd, "%s", filename_p);
++		(void) vfprintf(fd, format_p, alist);
++	} else {
++		(void) fprintf(fd, "%s", filename);
++		(void) vfprintf(fd, format_p, alist);
++	}
++}
++
++static inline void
++ibnd_msg(FILE *fd, const char *format, ...)
++{
++	va_list alist;
++
++	va_start(alist, format);
++	ibnd_msg_internal(fd, format, alist);
++	va_end(alist);
++}
++
+ #define	IBND_DEBUG(fmt, ...) \
+ 	if (ibdebug) { \
++		ibnd_msg(stdout, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
++	}
++#define	IBND_ERROR(fmt, ...) \
++		ibnd_msg(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
++#else
++#define	IBND_DEBUG(fmt, ...) \
++	if (ibdebug) { \
+ 		printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
+ 	}
+ #define	IBND_ERROR(fmt, ...) \
+ 		fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
++#endif
+ 
+ /* HASH table defines */
+ #define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103)))
 diff -r -u /tmp/infiniband-diags-1.5.8/man/ibstat.8 infiniband-diags-1.5.8/man/ibstat.8
 --- /tmp/infiniband-diags-1.5.8/man/ibstat.8	Wed Feb 16 02:13:21 2011
 +++ infiniband-diags-1.5.8/man/ibstat.8	Thu Feb 24 11:26:48 2011