- }
-
- /* read */
-
- LIBCFS_ALLOC(ctrs, sizeof(*ctrs));
- if (ctrs == NULL)
- return -ENOMEM;
-
- LIBCFS_ALLOC(tmpstr, tmpsiz);
- if (tmpstr == NULL) {
- LIBCFS_FREE(ctrs, sizeof(*ctrs));
- return -ENOMEM;
- }
-
- lnet_counters_get(ctrs);
-
- len = snprintf(tmpstr, tmpsiz,
- "%u %u %u %u %u %u %u "LPU64" "LPU64" "
- LPU64" "LPU64,
- ctrs->msgs_alloc, ctrs->msgs_max,
- ctrs->errors,
- ctrs->send_count, ctrs->recv_count,
- ctrs->route_count, ctrs->drop_count,
- ctrs->send_length, ctrs->recv_length,
- ctrs->route_length, ctrs->drop_length);
-
- if (pos >= min_t(int, len, strlen(tmpstr)))
- rc = 0;
- else
- rc = cfs_trace_copyout_string(buffer, nob,
- tmpstr + pos, "\n");
-
- LIBCFS_FREE(tmpstr, tmpsiz);
- LIBCFS_FREE(ctrs, sizeof(*ctrs));
- return rc;
+ }
+
+ /* read */
+
+ LIBCFS_ALLOC(ctrs, sizeof(*ctrs));
+ if (ctrs == NULL)
+ return -ENOMEM;
+
+ rc = lnet_counters_get(ctrs);
+ if (rc)
+ goto out_no_ctrs;
+
+ common = ctrs->lct_common;
+
+ len = scnprintf(tmpstr, sizeof(tmpstr),
+ "%u %u %u %u %u %u %u %llu %llu "
+ "%llu %llu",
+ common.lcc_msgs_alloc, common.lcc_msgs_max,
+ common.lcc_errors,
+ common.lcc_send_count, common.lcc_recv_count,
+ common.lcc_route_count, common.lcc_drop_count,
+ common.lcc_send_length, common.lcc_recv_length,
+ common.lcc_route_length, common.lcc_drop_length);
+
+ if (pos >= len)
+ rc = 0;
+ else
+ rc = cfs_trace_copyout_string(buffer, nob,
+ tmpstr + pos, "\n");
+out_no_ctrs:
+ LIBCFS_FREE(ctrs, sizeof(*ctrs));
+ return rc;