Diff for /libelwix/inc/elwix/aring.h between versions 1.7.2.1 and 1.10

version 1.7.2.1, 2026/02/18 01:23:04 version 1.10, 2026/07/27 21:11:07
Line 51  SUCH DAMAGE. Line 51  SUCH DAMAGE.
 typedef struct {  typedef struct {
         E_ATOMIC_ALIGN  int             rb_head;          E_ATOMIC_ALIGN  int             rb_head;
         E_ATOMIC_ALIGN  int             rb_tail;          E_ATOMIC_ALIGN  int             rb_tail;
           E_ATOMIC_ALIGN  unsigned int    rb_full;
                         int             rb_bufnum;                          int             rb_bufnum;
                         struct iovec    *rb_buffer;                          struct iovec    *rb_buffer;
 } ringbuf_t;  } ringbuf_t;
Line 68  typedef struct { Line 69  typedef struct {
                                         _t = atomic_load_explicit((atomic_int*) &(x)->rb_tail, memory_order_acquire); \                                          _t = atomic_load_explicit((atomic_int*) &(x)->rb_tail, memory_order_acquire); \
                                         _h = atomic_load_explicit((atomic_int*) &(x)->rb_head, memory_order_relaxed); \                                          _h = atomic_load_explicit((atomic_int*) &(x)->rb_head, memory_order_relaxed); \
                                         if (_h == _t) \                                          if (_h == _t) \
                                                (r) = 0; \                                                (r) = atomic_load_explicit((atomic_int*) &(x)->rb_full, memory_order_acquire) ? \
                                                         (x)->rb_bufnum : 0; \
                                         else \                                          else \
                                                 (r) = (_h + (x)->rb_bufnum - _t) % (x)->rb_bufnum; \                                                  (r) = (_h + (x)->rb_bufnum - _t) % (x)->rb_bufnum; \
                                 } while (0)                                  } while (0)
Line 155  int rbuf_isfull(ringbuf_t *rbuf); Line 157  int rbuf_isfull(ringbuf_t *rbuf);
  * @rbuf = Ring buffer   * @rbuf = Ring buffer
  * @data = Data   * @data = Data
  * @len = Length   * @len = Length
    * @lost = Permit to lost data
  * return: -1 error, 1 can't add data, buffer is full or 0 ok   * return: -1 error, 1 can't add data, buffer is full or 0 ok
  */   */
int rbuf_enqueue(ringbuf_t *rbuf, void *data, size_t len);int rbuf_enqueue(ringbuf_t *rbuf, void *data, size_t len, int lost);
 /*  /*
  * rbuf_dequeue() - Dequeue data from buffer   * rbuf_dequeue() - Dequeue data from buffer
  *   *
  * @rbuf = Ring buffer   * @rbuf = Ring buffer
  * @out = Data, if =NULL, just dequeue data   * @out = Data, if =NULL, just dequeue data
    * @peek = Peek only data, keep the same tail position
  * return: -1 error, 1 buffer is empty or 0 ok   * return: -1 error, 1 buffer is empty or 0 ok
  */   */
int rbuf_dequeue(ringbuf_t *rbuf, struct iovec **out);int rbuf_dequeue(ringbuf_t *rbuf, struct iovec **out, int peek);
   
   
 /*  /*
Line 220  int lrb_enqueue(lrbuf_t *lrb, void *data, size_t len,  Line 224  int lrb_enqueue(lrbuf_t *lrb, void *data, size_t len, 
  * @lrb = Linear ring buffer   * @lrb = Linear ring buffer
  * @data = Data, if =NULL, just dequeue data   * @data = Data, if =NULL, just dequeue data
  * @len = Length of data   * @len = Length of data
    * @peek = Peek only data, keep the same tail position
  * return: -1 error, 0 buffer is empty or >0 stored data bytes   * return: -1 error, 0 buffer is empty or >0 stored data bytes
  */   */
int lrb_dequeue(lrbuf_t *lrb, void *data, size_t len);int lrb_dequeue(lrbuf_t *lrb, void *data, size_t len, int peek);
 /*  /*
  * lrb_getw() - Get address for write   * lrb_getw() - Get address for write
  *   *

Removed from v.1.7.2.1  
changed lines
  Added in v.1.10


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>