[Skiboot] [PATCH 09/15] external/trace: Introduce structure for reading traces

Jordan Niethe jniethe5 at gmail.com
Mon Mar 25 11:14:19 AEDT 2019


The tracebuf struct includes members intended to be used be a reader.
The members are never used by a writer.  However if the tracebuf is
mmaped as read only, these members can not be used. Add a new structure
to be used by readers which contains these members instead.
---
 external/trace/trace.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/external/trace/trace.h b/external/trace/trace.h
index 4d2dbc796289..ef9b2a073973 100644
--- a/external/trace/trace.h
+++ b/external/trace/trace.h
@@ -13,8 +13,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#ifndef E_TRACE_H
+#define E_TRACE_H
+
+#include <stdbool.h>
+#include <types.h>
+#include <trace.h>
+#include <trace_types.h>
+
+struct trace_reader {
+	/* This is where the reader is up to. */
+	be64 rpos;
+	/* If the last one we read was a repeat, this shows how many. */
+	be32 last_repeat;
+	struct tracebuf *tb;
+};
+
 /* Is this tracebuf empty? */
 bool trace_empty(const struct tracebuf *tracebuf);
 
 /* Get the next trace from this buffer (false if empty). */
 bool trace_get(union trace *t, struct tracebuf *tb);
+
+#endif
-- 
2.20.1



More information about the Skiboot mailing list