patch-2.1.60 linux/fs/block_dev.c

Next file: linux/fs/dcache.c
Previous file: linux/fs/binfmt_elf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.59/linux/fs/block_dev.c linux/fs/block_dev.c
@@ -20,16 +20,17 @@
 #define MAX_BUF_PER_PAGE (PAGE_SIZE / 512)
 #define NBUF 64
 
-long block_write(struct inode * inode, struct file * filp,
-	const char * buf, unsigned long count)
+ssize_t block_write(struct file * filp, const char * buf,
+		    size_t count, loff_t *ppos)
 {
-	int blocksize, blocksize_bits, i, buffercount,write_error;
-	int block, blocks;
+	struct inode * inode = filp->f_dentry->d_inode;
+	ssize_t blocksize, blocksize_bits, i, buffercount, write_error;
+	ssize_t block, blocks;
 	loff_t offset;
-	int chars;
-	int written = 0;
+	ssize_t chars;
+	ssize_t written = 0;
 	struct buffer_head * bhlist[NBUF];
-	unsigned int size;
+	size_t size;
 	kdev_t dev;
 	struct buffer_head * bh, *bufferlist[NBUF];
 	register char * p;
@@ -49,8 +50,8 @@
 		i >>= 1;
 	}
 
-	block = filp->f_pos >> blocksize_bits;
-	offset = filp->f_pos & (blocksize-1);
+	block = *ppos >> blocksize_bits;
+	offset = *ppos & (blocksize-1);
 
 	if (blk_size[MAJOR(dev)])
 		size = ((loff_t) blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS) >> blocksize_bits;
@@ -105,7 +106,7 @@
 			return written ? written : -EIO;
 		p = offset + bh->b_data;
 		offset = 0;
-		filp->f_pos += chars;
+		*ppos += chars;
 		written += chars;
 		count -= chars;
 		copy_from_user(p,buf,chars);
@@ -145,14 +146,14 @@
 	return written;
 }
 
-long block_read(struct inode * inode, struct file * filp,
-	char * buf, unsigned long count)
+ssize_t block_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
 {
-	unsigned int block;
+	struct inode * inode = filp->f_dentry->d_inode;
+	size_t block;
 	loff_t offset;
-	int blocksize;
-	int blocksize_bits, i;
-	unsigned int blocks, rblocks, left;
+	ssize_t blocksize;
+	ssize_t blocksize_bits, i;
+	size_t blocks, rblocks, left;
 	int bhrequest, uptodate;
 	struct buffer_head ** bhb, ** bhe;
 	struct buffer_head * buflist[NBUF];
@@ -160,7 +161,7 @@
 	unsigned int chars;
 	loff_t size;
 	kdev_t dev;
-	int read;
+	ssize_t read;
 
 	dev = inode->i_rdev;
 	blocksize = BLOCK_SIZE;
@@ -173,7 +174,7 @@
 		i >>= 1;
 	}
 
-	offset = filp->f_pos;
+	offset = *ppos;
 	if (blk_size[MAJOR(dev)])
 		size = (loff_t) blk_size[MAJOR(dev)][MINOR(dev)] << BLOCK_SIZE_BITS;
 	else
@@ -258,7 +259,7 @@
 				chars = left;
 			else
 				chars = blocksize - offset;
-			filp->f_pos += chars;
+			*ppos += chars;
 			left -= chars;
 			read += chars;
 			if (*bhe) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov