patch-2.1.90 linux/fs/hfs/file.c

Next file: linux/fs/hfs/file_cap.c
Previous file: linux/fs/hfs/dir_nat.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.89/linux/fs/hfs/file.c linux/fs/hfs/file.c
@@ -98,11 +98,10 @@
 		   to the file until we return, so it can't have moved.
 		*/
 	       if (tmp) {
-	               hfs_cat_mark_dirty(fork->entry);
-		       return getblk(dev, tmp, HFS_SECTOR_SIZE);
+		 hfs_cat_mark_dirty(fork->entry);
+		 return getblk(dev, tmp, HFS_SECTOR_SIZE);
 	       }
 	       return NULL;
-
 	} else {
 		/* If reading the block, then retry since the
 		   location on disk could have changed while
@@ -236,6 +235,7 @@
  */
 static void hfs_file_truncate(struct inode * inode)
 {
+ 	/*struct inode *inode = dentry->d_inode;*/
 	struct hfs_fork *fork = HFS_I(inode)->fork;
 
 	fork->lsize = inode->i_size;
@@ -268,7 +268,7 @@
  */
 static inline void xlate_from_user(char *data, const char *buf, int count)
 {
-	copy_from_user(data, buf, count);
+	count -= copy_from_user(data, buf, count);
 	while (count--) {
 		if (*data == '\n') {
 			*data = '\r';
@@ -398,16 +398,16 @@
 			} else {
 				chars = HFS_SECTOR_SIZE - offset;
 			}
-			count -= chars;
-			read += chars;
 			p = (*bhe)->b_data + offset;
 			if (convert) {
 				xlate_to_user(buf, p, chars);
 			} else {
-				copy_to_user(buf, p, chars);
+				chars -= copy_to_user(buf, p, chars);
 			}
 			brelse(*bhe);
+			count -= chars;
 			buf += chars;
+			read += chars;
 			offset = 0;
 			if (++bhe == &buflist[NBUF]) {
 				bhe = buflist;
@@ -479,7 +479,7 @@
 		if (convert) {
 			xlate_from_user(p, buf, c);
 		} else {
-			copy_from_user(p, buf, c);
+			c -= copy_from_user(p, buf, c);
 		}
 		update_vm_cache(inode,pos,p,c);
 		pos += c;

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