patch-2.1.122 linux/fs/umsdos/ioctl.c

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

diff -u --recursive --new-file v2.1.121/linux/fs/umsdos/ioctl.c linux/fs/umsdos/ioctl.c
@@ -78,6 +78,9 @@
 	struct file new_filp;
 	struct umsdos_ioctl data;
 
+Printk(("UMSDOS_ioctl_dir: %s/%s, cmd=%d, data=%08lx\n",
+dentry->d_parent->d_name.name, dentry->d_name.name, cmd, data_ptr));
+
 	/* forward non-umsdos ioctls - this hopefully doesn't cause conflicts */
 	if (cmd != UMSDOS_GETVERSION
 	    && cmd != UMSDOS_READDIR_DOS
@@ -164,20 +167,19 @@
 		ret = PTR_ERR(demd);
 		if (IS_ERR(demd))
 			goto out;
+		ret = 0;
+		if (!demd->d_inode)
+			goto read_dput;
+
 		fill_new_filp(&new_filp, demd);
 		new_filp.f_pos = filp->f_pos;
-
-		while (1) {
+		while (new_filp.f_pos < demd->d_inode->i_size) {
 			off_t f_pos = new_filp.f_pos;
 			struct umsdos_dirent entry;
 			struct umsdos_info info;
 
-			ret = 0;
-			if (new_filp.f_pos >= demd->d_inode->i_size)
-				break;
-
 			ret = umsdos_emd_dir_readentry (&new_filp, &entry);
-			if (ret < 0)
+			if (ret)
 				break;
 			if (entry.name_len <= 0)
 				continue;
@@ -198,6 +200,7 @@
 		}
 		/* update the original f_pos */
 		filp->f_pos = new_filp.f_pos;
+	read_dput:
 		d_drop(demd);
 		dput(demd);
 		goto out;
@@ -217,6 +220,8 @@
 		extern struct inode_operations umsdos_rdir_inode_operations;
 
 		ret = umsdos_make_emd(dentry);
+Printk(("UMSDOS_ioctl_dir: INIT_EMD %s/%s, ret=%d\n",
+dentry->d_parent->d_name.name, dentry->d_name.name, ret));
 		dir->i_op = (ret == 0)
 		    ? &umsdos_dir_inode_operations
 		    : &umsdos_rdir_inode_operations;
@@ -262,13 +267,13 @@
 		 */
 		old_dentry = umsdos_lookup_dentry (dentry, 
 						data.dos_dirent.d_name,
-						data.dos_dirent.d_reclen);
+						data.dos_dirent.d_reclen ,1);
 		ret = PTR_ERR(old_dentry);
 		if (IS_ERR(old_dentry))
 			goto out;
 		new_dentry = umsdos_lookup_dentry (dentry,
 						data.umsdos_dirent.name,
-						data.umsdos_dirent.name_len);
+						data.umsdos_dirent.name_len, 1);
 		ret = PTR_ERR(new_dentry);
 		if (!IS_ERR(new_dentry)) {
 printk("umsdos_ioctl: renaming %s/%s to %s/%s\n",
@@ -314,7 +319,7 @@
 		 * Return 0 if success.
 		 */
 		temp = umsdos_lookup_dentry(dentry, data.dos_dirent.d_name,
-						    data.dos_dirent.d_reclen);
+						data.dos_dirent.d_reclen, 1);
 		ret = PTR_ERR(temp);
 		if (IS_ERR(temp))
 			goto out;
@@ -336,7 +341,7 @@
 		 * Return 0 if success.
 		 */
 		temp = umsdos_lookup_dentry(dentry, data.dos_dirent.d_name,
-						    data.dos_dirent.d_reclen);
+					    data.dos_dirent.d_reclen, 1);
 		ret = PTR_ERR(temp);
 		if (IS_ERR(temp))
 			goto out;
@@ -362,7 +367,7 @@
 		struct inode *inode;
 
 		dret = umsdos_lookup_dentry(dentry, data.dos_dirent.d_name,
-						    data.dos_dirent.d_reclen);
+					    data.dos_dirent.d_reclen, 1);
 		ret = PTR_ERR(dret);
 		if (IS_ERR(dret))
 			goto out;

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