summaryrefslogtreecommitdiff
path: root/lib/librte_ivshmem
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2014-05-02 16:42:56 -0700
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-05-16 16:02:55 +0200
commit591a9d7985c1230652d9f7ea1f9221e8c66ec188 (patch)
treeb040ceef0f3aa5905d814d7cf249af415a53891e /lib/librte_ivshmem
parentc738c6a644e5a07fa98ede668775c08ec5321273 (diff)
downloaddpdk-591a9d7985c1230652d9f7ea1f9221e8c66ec188.zip
dpdk-591a9d7985c1230652d9f7ea1f9221e8c66ec188.tar.gz
dpdk-591a9d7985c1230652d9f7ea1f9221e8c66ec188.tar.xz
add FILE argument to debug functions
The DPDK dump functions are useful for remote debugging of an applications. But when application runs as a daemon, stdout is typically routed to /dev/null. Instead change all these functions to take a stdio FILE * handle instead. An application can then use open_memstream() to capture the output. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> [Thomas: fix quota_watermark example] Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Diffstat (limited to 'lib/librte_ivshmem')
-rw-r--r--lib/librte_ivshmem/rte_ivshmem.c9
-rw-r--r--lib/librte_ivshmem/rte_ivshmem.h4
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/librte_ivshmem/rte_ivshmem.c b/lib/librte_ivshmem/rte_ivshmem.c
index d62d016..675c383 100644
--- a/lib/librte_ivshmem/rte_ivshmem.c
+++ b/lib/librte_ivshmem/rte_ivshmem.c
@@ -821,9 +821,8 @@ rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
return 0;
}
-
void
-rte_ivshmem_metadata_dump(const char *name)
+rte_ivshmem_metadata_dump(FILE *f, const char *name)
{
unsigned i = 0;
struct ivshmem_config * config;
@@ -850,7 +849,7 @@ rte_ivshmem_metadata_dump(const char *name)
while (entry->mz.addr != NULL && i < RTE_DIM(config->metadata->entry)) {
- printf("Entry %u: name:<%-20s>, phys:0x%-15lx, len:0x%-15lx, "
+ fprintf(f, "Entry %u: name:<%-20s>, phys:0x%-15lx, len:0x%-15lx, "
"virt:%-15p, off:0x%-15lx\n",
i,
entry->mz.name,
@@ -861,7 +860,7 @@ rte_ivshmem_metadata_dump(const char *name)
i++;
#ifdef RTE_LIBRTE_IVSHMEM_DEBUG
- printf("\tHugepage files:\n");
+ fprintf(f, "\tHugepage files:\n");
hugepage_sz = entry->mz.hugepage_sz;
addr = RTE_ALIGN_FLOOR(entry->mz.addr_64, hugepage_sz);
@@ -873,7 +872,7 @@ rte_ivshmem_metadata_dump(const char *name)
get_hugefile_by_virt_addr(addr, &e);
- printf("\t0x%"PRIx64 "-0x%" PRIx64 " offset: 0x%" PRIx64 " %s\n",
+ fprintf(f, "\t0x%"PRIx64 "-0x%" PRIx64 " offset: 0x%" PRIx64 " %s\n",
addr, addr + hugepage_sz, e.offset, e.filepath);
}
#endif
diff --git a/lib/librte_ivshmem/rte_ivshmem.h b/lib/librte_ivshmem/rte_ivshmem.h
index 9ff54bb..0eda545 100644
--- a/lib/librte_ivshmem/rte_ivshmem.h
+++ b/lib/librte_ivshmem/rte_ivshmem.h
@@ -150,10 +150,12 @@ int rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size,
/**
* Dump all metadata entries from a given metadata file to the console.
*
+ * @param f
+ * A pointer to a file for output
* @name
* Name of the metadata file to be dumped to console.
*/
-void rte_ivshmem_metadata_dump(const char *name);
+void rte_ivshmem_metadata_dump(FILE *f, const char *name);
#ifdef __cplusplus