patch-2.4.27 linux-2.4.27/drivers/pnp/isapnp_proc.c
Next file: linux-2.4.27/drivers/s390/block/dasd.c
Previous file: linux-2.4.27/drivers/pcmcia/yenta.c
Back to the patch index
Back to the overall index
- Lines: 82
- Date:
2004-08-07 16:26:05.249371226 -0700
- Orig file:
linux-2.4.26/drivers/pnp/isapnp_proc.c
- Orig date:
2002-11-28 15:53:14.000000000 -0800
diff -urN linux-2.4.26/drivers/pnp/isapnp_proc.c linux-2.4.27/drivers/pnp/isapnp_proc.c
@@ -102,6 +102,7 @@
size_t count, loff_t * offset)
{
isapnp_info_buffer_t *buf;
+ loff_t pos = *offset;
long size = 0, size1;
int mode;
@@ -111,15 +112,15 @@
buf = (isapnp_info_buffer_t *) file->private_data;
if (!buf)
return -EIO;
- if (file->f_pos >= buf->size)
+ if (pos != (unsigned) pos || pos >= buf->size)
return 0;
size = buf->size < count ? buf->size : count;
- size1 = buf->size - file->f_pos;
+ size1 = buf->size - pos;
if (size1 < size)
size = size1;
- if (copy_to_user(buffer, buf->buffer + file->f_pos, size))
+ if (copy_to_user(buffer, buf->buffer + pos, size))
return -EFAULT;
- file->f_pos += size;
+ *offset = pos + size;
return size;
}
@@ -128,6 +129,7 @@
{
isapnp_info_buffer_t *buf;
long size = 0, size1;
+ loff_t pos = *offset;
int mode;
mode = file->f_flags & O_ACCMODE;
@@ -136,19 +138,19 @@
buf = (isapnp_info_buffer_t *) file->private_data;
if (!buf)
return -EIO;
- if (file->f_pos < 0)
+ if (pos < 0)
return -EINVAL;
- if (file->f_pos >= buf->len)
+ if (pos >= buf->len)
return -ENOMEM;
size = buf->len < count ? buf->len : count;
- size1 = buf->len - file->f_pos;
+ size1 = buf->len - pos;
if (size1 < size)
size = size1;
- if (copy_from_user(buf->buffer + file->f_pos, buffer, size))
+ if (copy_from_user(buf->buffer + pos, buffer, size))
return -EFAULT;
- if (buf->size < file->f_pos + size)
- buf->size = file->f_pos + size;
- file->f_pos += size;
+ if (buf->size < pos + size)
+ buf->size = pos + size;
+ *offset = pos + size;
return size;
}
@@ -240,14 +242,15 @@
struct inode *ino = file->f_dentry->d_inode;
struct proc_dir_entry *dp = ino->u.generic_ip;
struct pci_dev *dev = dp->data;
- int pos = *ppos;
+ loff_t n = *ppos;
+ unsigned pos = n;
int cnt, size = 256;
- if (pos >= size)
+ if (pos != n || pos >= size)
return 0;
if (nbytes >= size)
nbytes = size;
- if (pos + nbytes > size)
+ if (nbytes > size - pos)
nbytes = size - pos;
cnt = nbytes;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)