userlibandfileserver/fileserver/sfile/sf_drv.cpp
branchRCL_3
changeset 249 a179b74831c9
parent 248 0ffb4e86fcc9
child 256 c1f20ce4abcf
equal deleted inserted replaced
248:0ffb4e86fcc9 249:a179b74831c9
    87 void ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask)
    87 void ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask)
    88 //
    88 //
    89 // Do not allow the entry type to be changed
    89 // Do not allow the entry type to be changed
    90 //
    90 //
    91 	{
    91 	{
    92 	const TUint KReadOnlySetAtts = KEntryAttVolume | 
    92 	const TUint KReadOnlyAtts = KEntryAttVolume	| 
    93 								   KEntryAttDir    | 
    93 								KEntryAttDir	| 
    94 								   KEntryAttRemote;
    94 								KEntryAttRemote	|
    95 
    95 								KEntryAttModified;
    96 	const TUint KReadOnlyClrAtts = KEntryAttVolume | 
    96 
    97 								   KEntryAttDir    | 
    97 	aSetAttMask   &= ~KReadOnlyAtts;
    98 								   KEntryAttRemote | 
    98 	aClearAttMask &= ~KReadOnlyAtts;
    99 								   KEntryAttModified;
       
   100 
       
   101 	aSetAttMask   &= ~KReadOnlySetAtts;
       
   102 	aClearAttMask &= ~KReadOnlyClrAtts;
       
   103 	}
    99 	}
   104 
   100 
   105 void CheckForLeaveAfterOpenL(TInt leaveError, CFsRequest* aRequest, TInt aHandle)
   101 void CheckForLeaveAfterOpenL(TInt leaveError, CFsRequest* aRequest, TInt aHandle)
   106 //
   102 //
   107 // Tidy up in the event of a leave after opening a file or directory
   103 // Tidy up in the event of a leave after opening a file or directory
   545 
   541 
   546 	TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2);
   542 	TRACE4(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2, EF32TraceUidFileSys, DriveNumber(), aOperation, aParam1, aParam2);
   547 	TRAP(r,CurrentMount().FinaliseMountL(aOperation, aParam1, aParam2));
   543 	TRAP(r,CurrentMount().FinaliseMountL(aOperation, aParam1, aParam2));
   548 	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2Ret, EF32TraceUidFileSys, r);
   544 	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBFinaliseMount2Ret, EF32TraceUidFileSys, r);
   549 	
   545 	
       
   546 	// Pass FinaliseDrive notification down to media driver
       
   547 	TInt driveNumber = DriveNumber();
       
   548 	if (LocalDrives::IsValidDriveMapping(driveNumber) && !LocalDrives::IsProxyDrive(driveNumber))
       
   549 		{
       
   550 		TBusLocalDrive& drv = LocalDrives::GetLocalDrive(driveNumber);
       
   551 
       
   552 		TLocalDriveFinaliseInfoBuf finaliseBuf;
       
   553 		finaliseBuf().iMode = aOperation;
       
   554 
       
   555 		// notify local drive, ignore the error
       
   556 		drv.QueryDevice(RLocalDrive::EQueryFinaliseDrive, finaliseBuf);	
       
   557 		}
       
   558 
   550     return r;
   559     return r;
   551 	}
   560 	}
   552 
   561 
   553 //----------------------------------------------------------------------------
   562 //----------------------------------------------------------------------------
   554 /** old implementation */
   563 /** old implementation */
  1233 
  1242 
  1234 	TRACEMULT6(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryL, EF32TraceUidFileSys, 
  1243 	TRACEMULT6(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryL, EF32TraceUidFileSys, 
  1235 		DriveNumber(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSetAttMask, aClearAttMask);
  1244 		DriveNumber(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aSetAttMask, aClearAttMask);
  1236 	TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask))
  1245 	TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask))
  1237 	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryLRet, EF32TraceUidFileSys, r);
  1246 	TRACERET1(UTF::EBorder, UTraceModuleFileSys::ECMountCBSetEntryLRet, EF32TraceUidFileSys, r);
       
  1247 	// If the file is already open then write the file attributes directly to the file
       
  1248 	TFileName foldedName;
       
  1249 	TUint32 nameHash=0;
       
  1250 	foldedName.CopyF(aName);
       
  1251 	nameHash=CalcNameHash(foldedName);
       
  1252 
       
  1253 	__CHECK_DRIVETHREAD(iDriveNumber);
       
  1254 	TDblQueIter<CFileCB> q(CurrentMount().iMountQ);
       
  1255 	CMountCB* currentMount = &CurrentMount();
       
  1256 	CFileCB* file;
       
  1257 	while ((file=q++)!=NULL)
       
  1258 		{
       
  1259 		if ((&file->Drive()==this) && 
       
  1260 			&file->Mount() == currentMount &&
       
  1261 			nameHash == file->NameHash() && 
       
  1262 			file->FileNameF().Match(foldedName)==KErrNone)
       
  1263 			{
       
  1264 			TUint att = file->Att();
       
  1265 			att |= aSetAttMask;
       
  1266 			att &= ~aClearAttMask;
       
  1267 			file->SetAtt(att | KEntryAttModified);
       
  1268 			file->SetModified(aTime);
       
  1269 			break;
       
  1270 			}
       
  1271 		}
  1238 
  1272 
  1239 	return(r);
  1273 	return(r);
  1240 	}
  1274 	}
  1241 
  1275 
  1242 TInt TDrive::FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode)
  1276 TInt TDrive::FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode)