Lines Matching refs:data_ring

312 #define DATA_SIZE(data_ring)		_DATA_SIZE((data_ring)->size_bits)  argument
313 #define DATA_SIZE_MASK(data_ring) (DATA_SIZE(data_ring) - 1) argument
319 #define DATA_INDEX(data_ring, lpos) ((lpos) & DATA_SIZE_MASK(data_ring)) argument
325 #define DATA_WRAPS(data_ring, lpos) ((lpos) >> (data_ring)->size_bits) argument
333 #define DATA_THIS_WRAP_START_LPOS(data_ring, lpos) \ argument
334 ((lpos) & ~DATA_SIZE_MASK(data_ring))
373 static struct prb_data_block *to_block(struct prb_data_ring *data_ring, in to_block() argument
376 return (void *)&data_ring->data[DATA_INDEX(data_ring, begin_lpos)]; in to_block()
398 static bool data_check_size(struct prb_data_ring *data_ring, unsigned int size) in data_check_size() argument
411 if (size > DATA_SIZE(data_ring) - sizeof(db->id)) in data_check_size()
574 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_make_reusable() local
583 while ((lpos_end - lpos_begin) - 1 < DATA_SIZE(data_ring)) { in data_make_reusable()
584 blk = to_block(data_ring, lpos_begin); in data_make_reusable()
638 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_push_tail() local
665 tail_lpos = atomic_long_read(&data_ring->tail_lpos); /* LMM(data_push_tail:A) */ in data_push_tail()
674 while ((lpos - tail_lpos) - 1 < DATA_SIZE(data_ring)) { in data_push_tail()
737 tail_lpos_new = atomic_long_read(&data_ring->tail_lpos in data_push_tail()
754 if (atomic_long_try_cmpxchg(&data_ring->tail_lpos, &tail_lpos, in data_push_tail()
1006 static unsigned long get_next_lpos(struct prb_data_ring *data_ring, in get_next_lpos() argument
1016 if (DATA_WRAPS(data_ring, begin_lpos) == DATA_WRAPS(data_ring, next_lpos)) in get_next_lpos()
1020 return (DATA_THIS_WRAP_START_LPOS(data_ring, next_lpos) + size); in get_next_lpos()
1031 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_alloc() local
1049 begin_lpos = atomic_long_read(&data_ring->head_lpos); in data_alloc()
1052 next_lpos = get_next_lpos(data_ring, begin_lpos, size); in data_alloc()
1054 if (!data_push_tail(rb, next_lpos - DATA_SIZE(data_ring))) { in data_alloc()
1078 } while (!atomic_long_try_cmpxchg(&data_ring->head_lpos, &begin_lpos, in data_alloc()
1081 blk = to_block(data_ring, begin_lpos); in data_alloc()
1084 if (DATA_WRAPS(data_ring, begin_lpos) != DATA_WRAPS(data_ring, next_lpos)) { in data_alloc()
1086 blk = to_block(data_ring, 0); in data_alloc()
1116 struct prb_data_ring *data_ring = &rb->text_data_ring; in data_realloc() local
1123 head_lpos = atomic_long_read(&data_ring->head_lpos); in data_realloc()
1128 wrapped = (DATA_WRAPS(data_ring, blk_lpos->begin) != DATA_WRAPS(data_ring, blk_lpos->next)); in data_realloc()
1132 next_lpos = get_next_lpos(data_ring, blk_lpos->begin, size); in data_realloc()
1135 if (head_lpos - next_lpos < DATA_SIZE(data_ring)) { in data_realloc()
1137 blk = to_block(data_ring, 0); in data_realloc()
1139 blk = to_block(data_ring, blk_lpos->begin); in data_realloc()
1143 if (!data_push_tail(rb, next_lpos - DATA_SIZE(data_ring))) in data_realloc()
1147 if (!atomic_long_try_cmpxchg(&data_ring->head_lpos, &head_lpos, in data_realloc()
1152 blk = to_block(data_ring, blk_lpos->begin); in data_realloc()
1154 if (DATA_WRAPS(data_ring, blk_lpos->begin) != DATA_WRAPS(data_ring, next_lpos)) { in data_realloc()
1158 blk = to_block(data_ring, 0); in data_realloc()
1183 static unsigned int space_used(struct prb_data_ring *data_ring, in space_used() argument
1190 if (DATA_WRAPS(data_ring, blk_lpos->begin) == DATA_WRAPS(data_ring, blk_lpos->next)) { in space_used()
1192 return (DATA_INDEX(data_ring, blk_lpos->next) - in space_used()
1193 DATA_INDEX(data_ring, blk_lpos->begin)); in space_used()
1200 return (DATA_INDEX(data_ring, blk_lpos->next) + in space_used()
1201 DATA_SIZE(data_ring) - DATA_INDEX(data_ring, blk_lpos->begin)); in space_used()
1213 static const char *get_data(struct prb_data_ring *data_ring, in get_data() argument
1237 if (DATA_WRAPS(data_ring, blk_lpos->begin) == DATA_WRAPS(data_ring, blk_lpos->next) && in get_data()
1239 db = to_block(data_ring, blk_lpos->begin); in get_data()
1243 } else if (DATA_WRAPS(data_ring, blk_lpos->begin + DATA_SIZE(data_ring)) == in get_data()
1244 DATA_WRAPS(data_ring, blk_lpos->next)) { in get_data()
1245 db = to_block(data_ring, 0); in get_data()
1246 *data_size = DATA_INDEX(data_ring, blk_lpos->next); in get_data()
1816 static bool copy_data(struct prb_data_ring *data_ring, in copy_data() argument
1827 data = get_data(data_ring, blk_lpos, &data_size); in copy_data()