userlibandfileserver/fileserver/sfile/sf_drv.cpp
branchRCL_3
changeset 41 0ffb4e86fcc9
parent 8 538db54a451d
child 42 a179b74831c9
--- a/userlibandfileserver/fileserver/sfile/sf_drv.cpp	Mon Jun 21 17:12:14 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/sf_drv.cpp	Thu Jul 15 20:11:42 2010 +0300
@@ -84,7 +84,7 @@
 	return(KErrNone);
 	}
 
-void ValidateAtts(TUint /*anEntryAtts*/,TUint& aSetAttMask,TUint& aClearAttMask)
+void ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask)
 //
 // Do not allow the entry type to be changed
 //
@@ -233,7 +233,7 @@
 
 	if (iReason==KErrNone && CurrentMount().LockStatus() > 0)
 	    {
-    	//-- this meand that the mount has drive access objetcs opened (RFormat or RRawDisk)
+    	//-- this means that the mount has drive access objects opened (RFormat or RRawDisk)
         __PRINT1(_L("TDrive::CheckMount() Mount is locked! LockStaus:%d"), CurrentMount().LockStatus());
         return KErrInUse;
 	    }	
@@ -1165,10 +1165,34 @@
 // Get entry details
 //
 	{
-	FlushCachedFileInfoL();
-
 	TRACEMULT2(UTF::EBorder, UTraceModuleFileSys::ECMountCBEntryL, EF32TraceUidFileSys, DriveNumber(), aName);
 	CurrentMount().EntryL(aName,anEntry);
+
+	// If the file is already open then read the file attributes directly from the file
+	TFileName foldedName;
+	TUint32 nameHash=0;
+	foldedName.CopyF(aName);
+	nameHash=CalcNameHash(foldedName);
+
+	__CHECK_DRIVETHREAD(iDriveNumber);
+	TDblQueIter<CFileCB> q(CurrentMount().iMountQ);
+	CMountCB* currentMount = &CurrentMount();
+	CFileCB* file;
+	while ((file=q++)!=NULL)
+		{
+		if ((&file->Drive()==this) && 
+			&file->Mount() == currentMount &&
+			nameHash == file->NameHash() && 
+			file->FileNameF().Match(foldedName)==KErrNone)
+			{
+			anEntry.iAtt = file->Att() & ~KEntryAttModified;
+			anEntry.SetFileSize(file->CachedSize64());
+			anEntry.iModified = file->Modified();
+			break;
+			}
+		}
+
+
 	TRACE5(UTF::EBorder, UTraceModuleFileSys::ECMountCBEntryLRet, EF32TraceUidFileSys, 
 		KErrNone, anEntry.iAtt, 
 		I64LOW(anEntry.iModified.Int64()), I64HIGH(anEntry.iModified.Int64()), 
@@ -1176,17 +1200,12 @@
 
 	}
 
-TInt TDrive::CheckAttributes(const TDesC& aName,TUint& aSetAttMask,TUint& aClearAttMask)
+TInt TDrive::CheckAttributes(TUint& aSetAttMask,TUint& aClearAttMask)
 //
 // Validate the changes against the current entry attributes
 //
 	{
-
-	TEntry entry;
-	TRAPD(r,DoEntryL(aName,entry));
-	if (r!=KErrNone)
-		return(r);
-	ValidateAtts(entry.iAtt,aSetAttMask,aClearAttMask);
+	ValidateAtts(aSetAttMask,aClearAttMask);
 	return(KErrNone);
 	}
 
@@ -1203,7 +1222,7 @@
 	CFileCB* pF=LocateFile(entryName);
 	if (pF!=NULL)
 		return(KErrInUse);
-	r=CheckAttributes(entryName,aSetAttMask,aClearAttMask);
+	r=CheckAttributes(aSetAttMask,aClearAttMask);
 	if (r!=KErrNone)
 		return(r);
 	if (IsWriteProtected())