patch-2.4.0-test7 linux/fs/smbfs/dir.c

Next file: linux/fs/smbfs/getopt.c
Previous file: linux/fs/smbfs/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/fs/smbfs/dir.c linux/fs/smbfs/dir.c
@@ -14,6 +14,7 @@
 #include <linux/ctype.h>
 
 #include <linux/smb_fs.h>
+#include <linux/smb_mount.h>
 #include <linux/smbno.h>
 
 #include "smb_debug.h"
@@ -66,12 +67,12 @@
 	switch ((unsigned int) filp->f_pos)
 	{
 	case 0:
-		if (filldir(dirent, ".", 1, 0, dir->i_ino) < 0)
+		if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0)
 			goto out;
 		filp->f_pos = 1;
 	case 1:
 		if (filldir(dirent, "..", 2, 1,
-				dentry->d_parent->d_inode->i_ino) < 0)
+				dentry->d_parent->d_inode->i_ino, DT_DIR) < 0)
 			goto out;
 		filp->f_pos = 2;
 	}
@@ -127,7 +128,7 @@
 		}
 
 		if (filldir(dirent, entry->name, entry->len, 
-				    filp->f_pos, entry->ino) < 0)
+				    filp->f_pos, entry->ino, DT_UNKNOWN) < 0)
 			break;
 		filp->f_pos += 1;
 	}
@@ -142,7 +143,7 @@
 }
 
 /*
- * Note: in order to allow the smbclient process to open the
+ * Note: in order to allow the smbmount process to open the
  * mount point, we don't revalidate if conn_pid is NULL.
  */
 static int
@@ -190,6 +191,13 @@
 	d_delete:	smb_delete_dentry,
 };
 
+static struct dentry_operations smbfs_dentry_operations_case =
+{
+	d_revalidate:	smb_lookup_validate,
+	d_delete:	smb_delete_dentry,
+};
+
+
 /*
  * This is the callback when the dcache has a lookup hit.
  */
@@ -249,8 +257,7 @@
 
 	if (a->len != b->len)
 		goto out;
-	for (i=0; i < a->len; i++)
-	{
+	for (i=0; i < a->len; i++) {
 		if (tolower(a->name[i]) != tolower(b->name[i]))
 			goto out;
 	}
@@ -300,6 +307,7 @@
 	struct smb_fattr finfo;
 	struct inode *inode;
 	int error;
+	struct smb_sb_info *server;
 
 	error = -ENAMETOOLONG;
 	if (dentry->d_name.len > SMB_MAXNAMELEN)
@@ -315,15 +323,18 @@
 	inode = NULL;
 	if (error == -ENOENT)
 		goto add_entry;
-	if (!error)
-	{
+	if (!error) {
 		error = -EACCES;
 		finfo.f_ino = smb_invent_inos(1);
 		inode = smb_iget(dir->i_sb, &finfo);
-		if (inode)
-		{
+		if (inode) {
 	add_entry:
-			dentry->d_op = &smbfs_dentry_operations;
+			server = server_from_dentry(dentry);
+			if (server->mnt->flags & SMB_MOUNT_CASE)
+				dentry->d_op = &smbfs_dentry_operations_case;
+			else
+				dentry->d_op = &smbfs_dentry_operations;
+
 			d_add(dentry, inode);
 			smb_renew_times(dentry);
 			error = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)