n=nbytes;
- m=async->data_len+async->buf_int_count-async->buf_user_count;
-
- if(async->buf_user_ptr+m > async->data_len){
- m=async->data_len - async->buf_user_ptr;
- }
+ if( async->buf_user_ptr < async->buf_int_ptr)
+ m = async->buf_int_ptr - async->buf_user_ptr;
+ else
+ m = async->data_len - async->buf_user_count;
if(m<n)n=m;
n=nbytes;
- m=async->buf_int_count-async->buf_user_count;
+ if(async->buf_int_ptr >= async->buf_user_ptr)
+ m = async->buf_int_ptr - async->buf_user_ptr;
+ else
+ m = async->data_len - async->buf_user_ptr;
- if(async->buf_user_ptr+m > async->data_len){
- m=async->data_len - async->buf_user_ptr;
#if 0
printk("m is %d\n",m);
#endif
- }
if(m<n)n=m;
if(n==0){