--- /dev/null
+#ifndef _XEN_COV_PRIV_H
+#define _XEN_COV_PRIV_H
+
+#include <xen/types.h>
+
+struct cov_sysctl_ops {
+ uint32_t (*get_size)(void);
+ void (*reset_counters)(void);
+ int (*dump)(XEN_GUEST_HANDLE_PARAM(char), uint32_t *);
+};
+
+#endif
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
#include <public/sysctl.h>
+#include "coverage.h"
#include "gcov.h"
/**
return ret;
}
+static const struct cov_sysctl_ops cov_ops = {
+ .get_size = gcov_get_size,
+ .reset_counters = gcov_reset_all_counters,
+ .dump = gcov_dump_all,
+};
+
int sysctl_cov_op(struct xen_sysctl_coverage_op *op)
{
int ret;
switch ( op->cmd )
{
case XEN_SYSCTL_COVERAGE_get_size:
- op->size = gcov_get_size();
+ op->size = cov_ops.get_size();
ret = 0;
break;
buf = guest_handle_cast(op->buffer, char);
- ret = gcov_dump_all(buf, &size);
+ ret = cov_ops.dump(buf, &size);
op->size = size;
break;
}
case XEN_SYSCTL_COVERAGE_reset:
- gcov_reset_all_counters();
+ cov_ops.reset_counters();
ret = 0;
break;