patch-2.4.27 linux-2.4.27/drivers/char/istallion.c
Next file: linux-2.4.27/drivers/char/mem.c
Previous file: linux-2.4.27/drivers/char/i8k.c
Back to the patch index
Back to the overall index
- Lines: 81
- Date:
2004-08-07 16:26:04.705348873 -0700
- Orig file:
linux-2.4.26/drivers/char/istallion.c
- Orig date:
2002-08-02 17:39:43.000000000 -0700
diff -urN linux-2.4.26/drivers/char/istallion.c linux-2.4.27/drivers/char/istallion.c
@@ -4854,6 +4854,7 @@
void *memptr;
stlibrd_t *brdp;
int brdnr, size, n;
+ loff_t pos = *offp;
#if DEBUG
printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n",
@@ -4868,25 +4869,26 @@
return(-ENODEV);
if (brdp->state == 0)
return(-ENODEV);
- if (fp->f_pos >= brdp->memsize)
+ if (pos != (unsigned)pos || pos >= brdp->memsize)
return(0);
- size = MIN(count, (brdp->memsize - fp->f_pos));
+ size = MIN(count, (brdp->memsize - pos));
save_flags(flags);
cli();
EBRDENABLE(brdp);
while (size > 0) {
- memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos);
- n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize)));
+ memptr = (void *) EBRDGETMEMPTR(brdp, pos);
+ n = MIN(size, (brdp->pagesize - (((unsigned long) pos) % brdp->pagesize)));
if (copy_to_user(buf, memptr, n)) {
count = -EFAULT;
goto out;
}
- fp->f_pos += n;
+ pos += n;
buf += n;
size -= n;
}
+ *offp = pos;
out:
EBRDDISABLE(brdp);
restore_flags(flags);
@@ -4909,6 +4911,7 @@
stlibrd_t *brdp;
char *chbuf;
int brdnr, size, n;
+ loff_t pos = *offp;
#if DEBUG
printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n",
@@ -4923,26 +4926,27 @@
return(-ENODEV);
if (brdp->state == 0)
return(-ENODEV);
- if (fp->f_pos >= brdp->memsize)
+ if (pos != (unsigned)pos || pos >= brdp->memsize)
return(0);
chbuf = (char *) buf;
- size = MIN(count, (brdp->memsize - fp->f_pos));
+ size = MIN(count, (brdp->memsize - pos));
save_flags(flags);
cli();
EBRDENABLE(brdp);
while (size > 0) {
- memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos);
- n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize)));
+ memptr = (void *) EBRDGETMEMPTR(brdp, pos);
+ n = MIN(size, (brdp->pagesize - (((unsigned long) pos) % brdp->pagesize)));
if (copy_from_user(memptr, chbuf, n)) {
count = -EFAULT;
goto out;
}
- fp->f_pos += n;
+ pos += n;
chbuf += n;
size -= n;
}
+ *offp = pos;
out:
EBRDDISABLE(brdp);
restore_flags(flags);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)