Lines Matching refs:st_bp

3591 static int append_to_buffer(const char *ubp, ST_buffer * st_bp, int do_count)  in append_to_buffer()  argument
3595 for (i = 0, offset = st_bp->buffer_bytes; in append_to_buffer()
3596 i < st_bp->sg_segs && offset >= st_bp->sg_lengths[i]; i++) in append_to_buffer()
3597 offset -= st_bp->sg_lengths[i]; in append_to_buffer()
3598 if (i == st_bp->sg_segs) { /* Should never happen */ in append_to_buffer()
3602 for (; i < st_bp->sg_segs && do_count > 0; i++) { in append_to_buffer()
3603 cnt = st_bp->sg_lengths[i] - offset < do_count ? in append_to_buffer()
3604 st_bp->sg_lengths[i] - offset : do_count; in append_to_buffer()
3605 res = copy_from_user(st_bp->sg[i].address + offset, ubp, cnt); in append_to_buffer()
3609 st_bp->buffer_bytes += cnt; in append_to_buffer()
3624 static int from_buffer(ST_buffer * st_bp, char *ubp, int do_count) in from_buffer() argument
3628 for (i = 0, offset = st_bp->read_pointer; in from_buffer()
3629 i < st_bp->sg_segs && offset >= st_bp->sg_lengths[i]; i++) in from_buffer()
3630 offset -= st_bp->sg_lengths[i]; in from_buffer()
3631 if (i == st_bp->sg_segs) { /* Should never happen */ in from_buffer()
3635 for (; i < st_bp->sg_segs && do_count > 0; i++) { in from_buffer()
3636 cnt = st_bp->sg_lengths[i] - offset < do_count ? in from_buffer()
3637 st_bp->sg_lengths[i] - offset : do_count; in from_buffer()
3638 res = copy_to_user(ubp, st_bp->sg[i].address + offset, cnt); in from_buffer()
3642 st_bp->buffer_bytes -= cnt; in from_buffer()
3643 st_bp->read_pointer += cnt; in from_buffer()
3657 static void move_buffer_data(ST_buffer * st_bp, int offset) in move_buffer_data() argument
3665 total=st_bp->buffer_bytes - offset; in move_buffer_data()
3666 for (src_seg=0; src_seg < st_bp->sg_segs; src_seg++) { in move_buffer_data()
3668 if (src_offset < st_bp->sg_lengths[src_seg]) in move_buffer_data()
3670 offset -= st_bp->sg_lengths[src_seg]; in move_buffer_data()
3672 if (src_seg == st_bp->sg_segs) { /* Should never happen */ in move_buffer_data()
3677 st_bp->buffer_bytes = st_bp->read_pointer = total; in move_buffer_data()
3679 count = min(st_bp->sg_lengths[dst_seg] - dst_offset, in move_buffer_data()
3680 st_bp->sg_lengths[src_seg] - src_offset); in move_buffer_data()
3681 memmove(st_bp->sg[dst_seg].address + dst_offset, in move_buffer_data()
3682 st_bp->sg[src_seg].address + src_offset, count); in move_buffer_data()
3686 if (src_offset >= st_bp->sg_lengths[src_seg]) { in move_buffer_data()
3691 if (dst_offset >= st_bp->sg_lengths[dst_seg]) { in move_buffer_data()
3702 static int set_sg_lengths(ST_buffer *st_bp, unsigned int length) in set_sg_lengths() argument
3706 for (i=0; i < st_bp->sg_segs; i++) { in set_sg_lengths()
3707 if (length > st_bp->sg_lengths[i]) in set_sg_lengths()
3708 st_bp->sg[i].length = st_bp->sg_lengths[i]; in set_sg_lengths()
3710 st_bp->sg[i].length = length; in set_sg_lengths()
3713 length -= st_bp->sg_lengths[i]; in set_sg_lengths()