patch-2.1.60 linux/fs/hpfs/hpfs_fs.c

Next file: linux/fs/inode.c
Previous file: linux/fs/filesystems.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.59/linux/fs/hpfs/hpfs_fs.c linux/fs/hpfs/hpfs_fs.c
@@ -146,7 +146,7 @@
 
 /* file ops */
 
-static long hpfs_file_read(struct inode *, struct file *, char *, unsigned long);
+static ssize_t hpfs_file_read(struct file *, char *, size_t, loff_t *);
 static secno hpfs_bmap(struct inode *, unsigned);
 
 static const struct file_operations hpfs_file_ops =
@@ -187,8 +187,8 @@
 
 /* directory ops */
 
-static long hpfs_dir_read(struct inode *inode, struct file *filp,
-			  char *buf, unsigned long count);
+static ssize_t hpfs_dir_read(struct file *filp, char *buf, 
+			     size_t count, loff_t *ppos);
 static int hpfs_readdir(struct file *filp,
 			void *dirent, filldir_t filldir);
 static int hpfs_lookup(struct inode *, struct dentry *);
@@ -881,10 +881,11 @@
  * read.  Read the bytes, put them in buf, return the count.
  */
 
-static long hpfs_file_read(struct inode *inode, struct file *filp,
-			  char *buf, unsigned long count)
+static ssize_t hpfs_file_read(struct file *filp, char *buf,
+			      size_t count, loff_t *ppos)
 {
-	unsigned q, r, n, n0;
+	struct inode *inode = filp->f_dentry->d_inode;
+	size_t q, r, n, n0;
 	struct buffer_head *bh;
 	char *block;
 	char *start;
@@ -895,8 +896,8 @@
 	/*
 	 * truncate count at EOF
 	 */
-	if (count > inode->i_size - (off_t) filp->f_pos)
-		count = inode->i_size - filp->f_pos;
+	if (count > inode->i_size - (off_t) *ppos)
+		count = inode->i_size - *ppos;
 
 	start = buf;
 	while (count > 0) {
@@ -904,8 +905,8 @@
 		 * get file sector number, offset in sector, length to end of
 		 * sector
 		 */
-		q = filp->f_pos >> 9;
-		r = filp->f_pos & 511;
+		q = *ppos >> 9;
+		r = *ppos & 511;
 		n = 512 - r;
 
 		/*
@@ -941,8 +942,8 @@
 			 * squeeze out \r, output length varies
 			 */
 			n0 = convcpy_tofs(buf, block + r, n);
-			if (count > inode->i_size - (off_t) filp->f_pos - n + n0)
-				count = inode->i_size - filp->f_pos - n + n0;
+			if (count > inode->i_size - (off_t) *ppos - n + n0)
+				count = inode->i_size - *ppos - n + n0;
 		}
 
 		brelse(bh);
@@ -950,7 +951,7 @@
 		/*
 		 * advance input n bytes, output n0 bytes
 		 */
-		filp->f_pos += n;
+		*ppos += n;
 		buf += n0;
 		count -= n0;
 	}
@@ -1578,8 +1579,8 @@
 	return 0;
 }
 
-static long hpfs_dir_read(struct inode *inode, struct file *filp,
-			  char *buf, unsigned long count)
+static ssize_t hpfs_dir_read(struct file *filp, char *buf,
+			     size_t count, loff_t *ppos)
 {
 	return -EISDIR;
 }

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