From: David Schleef Date: Wed, 22 Aug 2001 23:58:09 +0000 (+0000) Subject: Removed buffer preloading from comedi_write_v22(). Apps must now X-Git-Tag: r0_7_61~161 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=20b0e80701ca5512f28fa35ed5689255fc9ba947;p=comedi.git Removed buffer preloading from comedi_write_v22(). Apps must now use start_src=TRIG_INT, issue the command, then cause an internal trigger. --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index 5310716d..b998b46e 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -1363,8 +1363,6 @@ static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes, int n,m,count=0,retval=0; DECLARE_WAITQUEUE(wait,current); int sample_size; - void *buf_ptr; - unsigned int buf_len; dev=comedi_get_device_by_minor(MINOR(RDEV_OF_FILE(file))); @@ -1388,24 +1386,11 @@ static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes, if(!nbytes)return 0; - if(!(s->subdev_flags&SDF_WRITEABLE)) - return -EIO; - - if(!s->busy){ - /* XXX this is going to change soon -- write cmds - * will require start_src=TRIG_FOLLOW */ - buf_ptr=async->prealloc_buf; - buf_len=async->prealloc_bufsz; - }else{ - if(s->busy != file) - return -EACCES; - - buf_ptr=async->data; - buf_len=async->data_len; - } + if(!s->busy) + return 0; - if(!buf_ptr) - return -EIO; + if(s->busy != file) + return -EACCES; add_wait_queue(&dev->write_wait,&wait); while(nbytes>0 && !retval){ @@ -1413,10 +1398,12 @@ static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes, n=nbytes; - m=buf_len-(async->buf_user_count-async->buf_int_count); - if(async->buf_user_ptr+m > buf_len){ - m=buf_len - async->buf_user_ptr; + 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(mbuf_user_ptr,buf,n); + m=copy_from_user(async->data+async->buf_user_ptr,buf,n); if(m) retval=-EFAULT; n-=m; @@ -1444,7 +1431,7 @@ static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes, async->buf_user_ptr+=n; async->buf_user_count+=n; - if(async->buf_user_ptr>=buf_len ){ + if(async->buf_user_ptr>=async->data_len ){ async->buf_user_ptr=0; }