Lines Matching refs:st_bp

5308 static int append_to_buffer(const char *ubp, OSST_buffer *st_bp, int do_count)  in append_to_buffer()  argument
5312 for (i=0, offset=st_bp->buffer_bytes; in append_to_buffer()
5313 i < st_bp->sg_segs && offset >= st_bp->sg[i].length; i++) in append_to_buffer()
5314 offset -= st_bp->sg[i].length; in append_to_buffer()
5315 if (i == st_bp->sg_segs) { /* Should never happen */ in append_to_buffer()
5319 for ( ; i < st_bp->sg_segs && do_count > 0; i++) { in append_to_buffer()
5320 cnt = st_bp->sg[i].length - offset < do_count ? in append_to_buffer()
5321 st_bp->sg[i].length - offset : do_count; in append_to_buffer()
5322 res = copy_from_user(st_bp->sg[i].address + offset, ubp, cnt); in append_to_buffer()
5326 st_bp->buffer_bytes += cnt; in append_to_buffer()
5341 static int from_buffer(OSST_buffer *st_bp, char *ubp, int do_count) in from_buffer() argument
5345 for (i=0, offset=st_bp->read_pointer; in from_buffer()
5346 i < st_bp->sg_segs && offset >= st_bp->sg[i].length; i++) in from_buffer()
5347 offset -= st_bp->sg[i].length; in from_buffer()
5348 if (i == st_bp->sg_segs) { /* Should never happen */ in from_buffer()
5352 for ( ; i < st_bp->sg_segs && do_count > 0; i++) { in from_buffer()
5353 cnt = st_bp->sg[i].length - offset < do_count ? in from_buffer()
5354 st_bp->sg[i].length - offset : do_count; in from_buffer()
5355 res = copy_to_user(ubp, st_bp->sg[i].address + offset, cnt); in from_buffer()
5359 st_bp->buffer_bytes -= cnt; in from_buffer()
5360 st_bp->read_pointer += cnt; in from_buffer()
5373 static int osst_zero_buffer_tail(OSST_buffer *st_bp) in osst_zero_buffer_tail() argument
5377 for (i = 0, offset = st_bp->buffer_bytes; in osst_zero_buffer_tail()
5378 i < st_bp->sg_segs && offset >= st_bp->sg[i].length; i++) in osst_zero_buffer_tail()
5379 offset -= st_bp->sg[i].length; in osst_zero_buffer_tail()
5380 if (i == st_bp->sg_segs) { /* Should never happen */ in osst_zero_buffer_tail()
5384 for (do_count = OS_DATA_SIZE - st_bp->buffer_bytes; in osst_zero_buffer_tail()
5385 i < st_bp->sg_segs && do_count > 0; i++) { in osst_zero_buffer_tail()
5386 cnt = st_bp->sg[i].length - offset < do_count ? in osst_zero_buffer_tail()
5387 st_bp->sg[i].length - offset : do_count ; in osst_zero_buffer_tail()
5388 memset(st_bp->sg[i].address + offset, 0, cnt); in osst_zero_buffer_tail()
5401 static int osst_copy_to_buffer(OSST_buffer *st_bp, unsigned char *ptr) in osst_copy_to_buffer() argument
5405 for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { in osst_copy_to_buffer()
5406 cnt = st_bp->sg[i].length < do_count ? in osst_copy_to_buffer()
5407 st_bp->sg[i].length : do_count ; in osst_copy_to_buffer()
5408 memcpy(st_bp->sg[i].address, ptr, cnt); in osst_copy_to_buffer()
5412 if (do_count || i != st_bp->sg_segs-1) { /* Should never happen */ in osst_copy_to_buffer()
5422 static int osst_copy_from_buffer(OSST_buffer *st_bp, unsigned char *ptr) in osst_copy_from_buffer() argument
5426 for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { in osst_copy_from_buffer()
5427 cnt = st_bp->sg[i].length < do_count ? in osst_copy_from_buffer()
5428 st_bp->sg[i].length : do_count ; in osst_copy_from_buffer()
5429 memcpy(ptr, st_bp->sg[i].address, cnt); in osst_copy_from_buffer()
5433 if (do_count || i != st_bp->sg_segs-1) { /* Should never happen */ in osst_copy_from_buffer()