Lines Matching refs:data_ring

308 #define DATA_SIZE(data_ring)		_DATA_SIZE((data_ring)->size_bits)  argument
309 #define DATA_SIZE_MASK(data_ring) (DATA_SIZE(data_ring) - 1) argument
315 #define DATA_INDEX(data_ring, lpos) ((lpos) & DATA_SIZE_MASK(data_ring)) argument
321 #define DATA_WRAPS(data_ring, lpos) ((lpos) >> (data_ring)->size_bits) argument
329 #define DATA_THIS_WRAP_START_LPOS(data_ring, lpos) \ argument
330 ((lpos) & ~DATA_SIZE_MASK(data_ring))
369 static struct prb_data_block *to_block(struct prb_data_ring *data_ring, in to_block() argument
372 return (void *)&data_ring->data[DATA_INDEX(data_ring, begin_lpos)]; in to_block()
394 static bool data_check_size(struct prb_data_ring *data_ring, unsigned int size) in data_check_size() argument
407 if (size > DATA_SIZE(data_ring) - sizeof(db->id)) in data_check_size()
570 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_make_reusable() local
579 while ((lpos_end - lpos_begin) - 1 < DATA_SIZE(data_ring)) { in data_make_reusable()
580 blk = to_block(data_ring, lpos_begin); in data_make_reusable()
634 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_push_tail() local
661 tail_lpos = atomic_long_read(&data_ring->tail_lpos); /* LMM(data_push_tail:A) */ in data_push_tail()
670 while ((lpos - tail_lpos) - 1 < DATA_SIZE(data_ring)) { in data_push_tail()
733 tail_lpos_new = atomic_long_read(&data_ring->tail_lpos in data_push_tail()
750 if (atomic_long_try_cmpxchg(&data_ring->tail_lpos, &tail_lpos, in data_push_tail()
1002 static unsigned long get_next_lpos(struct prb_data_ring *data_ring, in get_next_lpos() argument
1012 if (DATA_WRAPS(data_ring, begin_lpos) == DATA_WRAPS(data_ring, next_lpos)) in get_next_lpos()
1016 return (DATA_THIS_WRAP_START_LPOS(data_ring, next_lpos) + size); in get_next_lpos()
1027 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_alloc() local
1041 begin_lpos = atomic_long_read(&data_ring->head_lpos); in data_alloc()
1044 next_lpos = get_next_lpos(data_ring, begin_lpos, size); in data_alloc()
1046 if (!data_push_tail(rb, next_lpos - DATA_SIZE(data_ring))) { in data_alloc()
1070 } while (!atomic_long_try_cmpxchg(&data_ring->head_lpos, &begin_lpos, in data_alloc()
1073 blk = to_block(data_ring, begin_lpos); in data_alloc()
1076 if (DATA_WRAPS(data_ring, begin_lpos) != DATA_WRAPS(data_ring, next_lpos)) { in data_alloc()
1078 blk = to_block(data_ring, 0); in data_alloc()
1108 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_realloc() local
1115 head_lpos = atomic_long_read(&data_ring->head_lpos); in data_realloc()
1120 wrapped = (DATA_WRAPS(data_ring, blk_lpos->begin) != DATA_WRAPS(data_ring, blk_lpos->next)); in data_realloc()
1124 next_lpos = get_next_lpos(data_ring, blk_lpos->begin, size); in data_realloc()
1127 if (head_lpos - next_lpos < DATA_SIZE(data_ring)) { in data_realloc()
1129 blk = to_block(data_ring, 0); in data_realloc()
1131 blk = to_block(data_ring, blk_lpos->begin); in data_realloc()
1135 if (!data_push_tail(rb, next_lpos - DATA_SIZE(data_ring))) in data_realloc()
1139 if (!atomic_long_try_cmpxchg(&data_ring->head_lpos, &head_lpos, in data_realloc()
1144 blk = to_block(data_ring, blk_lpos->begin); in data_realloc()
1146 if (DATA_WRAPS(data_ring, blk_lpos->begin) != DATA_WRAPS(data_ring, next_lpos)) { in data_realloc()
1150 blk = to_block(data_ring, 0); in data_realloc()
1175 static unsigned int space_used(struct prb_data_ring *data_ring, in space_used() argument
1182 if (DATA_WRAPS(data_ring, blk_lpos->begin) == DATA_WRAPS(data_ring, blk_lpos->next)) { in space_used()
1184 return (DATA_INDEX(data_ring, blk_lpos->next) - in space_used()
1185 DATA_INDEX(data_ring, blk_lpos->begin)); in space_used()
1192 return (DATA_INDEX(data_ring, blk_lpos->next) + in space_used()
1193 DATA_SIZE(data_ring) - DATA_INDEX(data_ring, blk_lpos->begin)); in space_used()
1205 static const char *get_data(struct prb_data_ring *data_ring, in get_data() argument
1221 if (DATA_WRAPS(data_ring, blk_lpos->begin) == DATA_WRAPS(data_ring, blk_lpos->next) && in get_data()
1223 db = to_block(data_ring, blk_lpos->begin); in get_data()
1227 } else if (DATA_WRAPS(data_ring, blk_lpos->begin + DATA_SIZE(data_ring)) == in get_data()
1228 DATA_WRAPS(data_ring, blk_lpos->next)) { in get_data()
1229 db = to_block(data_ring, 0); in get_data()
1230 *data_size = DATA_INDEX(data_ring, blk_lpos->next); in get_data()
1705 static bool copy_data(struct prb_data_ring *data_ring, in copy_data() argument
1716 data = get_data(data_ring, blk_lpos, &data_size); in copy_data()