Can be used to reserve worst case length using udebug_entry_append,
then setting the final length using udebug_entry_set_length
Signed-off-by: Felix Fietkau <nbd@nbd.name>
return ret;
}
+uint16_t udebug_entry_trim(struct udebug_buf *buf, uint16_t len)
+{
+ struct udebug_hdr *hdr = buf->hdr;
+ struct udebug_ptr *ptr = udebug_ring_ptr(hdr, hdr->head);
+
+ if (len)
+ ptr->len -= len;
+
+ return ptr->len;
+}
+
+void udebug_entry_set_length(struct udebug_buf *buf, uint16_t len)
+{
+ struct udebug_hdr *hdr = buf->hdr;
+ struct udebug_ptr *ptr = udebug_ring_ptr(hdr, hdr->head);
+
+ ptr->len = len;
+}
+
int udebug_entry_printf(struct udebug_buf *buf, const char *fmt, ...)
{
va_list ap;
__attribute__ ((format (printf, 2, 3)));
int udebug_entry_vprintf(struct udebug_buf *buf, const char *fmt, va_list ap)
__attribute__ ((format (printf, 2, 0)));
+uint16_t udebug_entry_trim(struct udebug_buf *buf, uint16_t len);
+void udebug_entry_set_length(struct udebug_buf *buf, uint16_t len);
void udebug_entry_add(struct udebug_buf *buf);
int udebug_buf_init(struct udebug_buf *buf, size_t entries, size_t size);