[ofw] RE: PATCH[2/6] Windows port of libibmad - dump.c

Sean Hefty sean.hefty at intel.com
Thu Dec 18 16:19:37 PST 2008


>-void
>+MAD_EXPORT void
> mad_dump_hex(char *buf, int bufsz, void *val, int valsz)
> {
> 	switch (valsz) {
>@@ -115,13 +151,13 @@
> 		snprintf(buf, bufsz, "0x%08x", *(uint32_t *)val);
> 		break;
> 	case 5:
>-		snprintf(buf, bufsz, "0x%010" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffllu);
>+		snprintf(buf, bufsz, "0x%010" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffULL);
> 		break;
> 	case 6:
>-		snprintf(buf, bufsz, "0x%012" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffllu);
>+		snprintf(buf, bufsz, "0x%012" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffULL);
> 		break;
> 	case 7:
>-		snprintf(buf, bufsz, "0x%014" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffffllu);
>+		snprintf(buf, bufsz, "0x%014" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffffULL);
> 		break;
> 	case 8:
> 		snprintf(buf, bufsz, "0x%016" PRIx64, *(uint64_t *)val);
>@@ -132,7 +168,7 @@
> 	}
> }
>
>-void
>+MAD_EXPORT void
> mad_dump_rhex(char *buf, int bufsz, void *val, int valsz)
> {
> 	switch (valsz) {
>@@ -149,13 +185,13 @@
> 		snprintf(buf, bufsz, "%08x", *(uint32_t *)val);
> 		break;
> 	case 5:
>-		snprintf(buf, bufsz, "%010" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffllu);
>+		snprintf(buf, bufsz, "%010" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffULL);
> 		break;
> 	case 6:
>-		snprintf(buf, bufsz, "%012" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffllu);
>+		snprintf(buf, bufsz, "%012" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffULL);
> 		break;
> 	case 7:
>-		snprintf(buf, bufsz, "%014" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffffllu);
>+		snprintf(buf, bufsz, "%014" PRIx64, *(uint64_t *)val &
(uint64_t)
>0xffffffffffffffULL);
> 		break;
> 	case 8:
> 		snprintf(buf, bufsz, "%016" PRIx64, *(uint64_t *)val);
>@@ -166,7 +202,7 @@
> 	}
> }

I know this isn't part of this patch, but how about having mad_dump_hex call
mad_dump_rhex?

>-void
>+MAD_EXPORT void
> mad_dump_node_type(char *buf, int bufsz, void *val, int valsz)
> {
> 	int nodetype = *(int*)val;
>@@ -603,7 +639,7 @@
> 		uint8_t res_vl;
> 		uint8_t weight;
> 	} vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];
>-} __attribute__((packed)) ib_vl_arb_table_t;
>+} ib_vl_arb_table_t;

Packing doesn't look needed here, but complib provides an OS independent method
for structure packing.

- Sean




More information about the ofw mailing list