File size: 1,209 Bytes
96dc096 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /**
* ring_buffer.h
* Ring Buffer Public API
*
* Author: Ahmad Ali Parr
* License: Sovereign Source
*/
#ifndef ASOS_RING_BUFFER_H
#define ASOS_RING_BUFFER_H
#include <linux/types.h>
#include "intent_schema.h"
/* Forward declaration */
struct IntentRing;
struct vm_area_struct;
/* Ring buffer lifecycle */
struct IntentRing *ring_buffer_create(size_t capacity);
void ring_buffer_destroy(struct IntentRing *ring);
/* Producer operations (user space) */
int ring_buffer_submit(struct IntentRing *ring,
const struct SystemIntent __user *user_intent);
/* Consumer operations (kernel) */
int ring_buffer_consume(struct IntentRing *ring,
struct SystemIntent *intent_out);
int ring_buffer_complete(struct IntentRing *ring,
const struct IntentResult *result);
/* Status */
int ring_buffer_stats(struct IntentRing *ring,
unsigned int *head_out,
unsigned int *tail_out,
unsigned int *active_out);
/* Memory mapping */
int ring_buffer_mmap(struct IntentRing *ring, struct vm_area_struct *vma);
#endif /* ASOS_RING_BUFFER_H */
|