userlibandfileserver/fileserver/sfile/sf_drv.cpp
changeset 259 57b9594f5772
parent 247 d8d70de2bd36
child 286 48e57fb1237e
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
    88 void ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask)
    88 void ValidateAtts(TUint& aSetAttMask,TUint& aClearAttMask)
    89 //
    89 //
    90 // Do not allow the entry type to be changed
    90 // Do not allow the entry type to be changed
    91 //
    91 //
    92 	{
    92 	{
    93 	const TUint KReadOnlySetAtts = KEntryAttVolume | 
    93 	const TUint KReadOnlyAtts = KEntryAttVolume	| 
    94 								   KEntryAttDir    | 
    94 								KEntryAttDir	| 
    95 								   KEntryAttRemote;
    95 								KEntryAttRemote	|
    96 
    96 								KEntryAttModified;
    97 	const TUint KReadOnlyClrAtts = KEntryAttVolume | 
    97 
    98 								   KEntryAttDir    | 
    98 	aSetAttMask   &= ~KReadOnlyAtts;
    99 								   KEntryAttRemote | 
    99 	aClearAttMask &= ~KReadOnlyAtts;
   100 								   KEntryAttModified;
       
   101 
       
   102 	aSetAttMask   &= ~KReadOnlySetAtts;
       
   103 	aClearAttMask &= ~KReadOnlyClrAtts;
       
   104 	}
   100 	}
   105 
   101 
   106 void CheckForLeaveAfterOpenL(TInt leaveError, CFsRequest* aRequest, TInt aHandle)
   102 void CheckForLeaveAfterOpenL(TInt leaveError, CFsRequest* aRequest, TInt aHandle)
   107 //
   103 //
   108 // Tidy up in the event of a leave after opening a file or directory
   104 // Tidy up in the event of a leave after opening a file or directory
  1233 		aSetAttMask|=KEntryAttModified;
  1229 		aSetAttMask|=KEntryAttModified;
  1234 	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL, "drive %d aTime %x:%x  aSetAttMask %x aClearAttMask %x", (TUint) DriveNumber(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()), (TUint) aSetAttMask, (TUint) aClearAttMask);
  1230 	OstTraceExt5(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL, "drive %d aTime %x:%x  aSetAttMask %x aClearAttMask %x", (TUint) DriveNumber(), (TUint) I64HIGH(aTime.Int64()), (TUint) I64LOW(aTime.Int64()), (TUint) aSetAttMask, (TUint) aClearAttMask);
  1235 	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
  1231 	OstTraceData(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYL_EFILEPATH, "FilePath %S", aName.Ptr(), aName.Length()<<1);
  1236 	TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask))
  1232 	TRAP(r,CurrentMount().SetEntryL(entryName,aTime,aSetAttMask,aClearAttMask))
  1237 	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYLRET, "r %d", r);
  1233 	OstTrace1(TRACE_FILESYSTEM, FSYS_ECMOUNTCBSETENTRYLRET, "r %d", r);
       
  1234 
       
  1235 	// If the file is already open then write the file attributes directly to the file
       
  1236 	TFileName foldedName;
       
  1237 	TUint32 nameHash=0;
       
  1238 	foldedName.CopyF(aName);
       
  1239 	nameHash=CalcNameHash(foldedName);
       
  1240 
       
  1241 	__CHECK_DRIVETHREAD(iDriveNumber);
       
  1242 	TDblQueIter<CFileCB> q(CurrentMount().iMountQ);
       
  1243 	CMountCB* currentMount = &CurrentMount();
       
  1244 	CFileCB* file;
       
  1245 	while ((file=q++)!=NULL)
       
  1246 		{
       
  1247 		if ((&file->Drive()==this) && 
       
  1248 			&file->Mount() == currentMount &&
       
  1249 			nameHash == file->NameHash() && 
       
  1250 			file->FileNameF().Match(foldedName)==KErrNone)
       
  1251 			{
       
  1252 			TUint att = file->Att();
       
  1253 			att |= aSetAttMask;
       
  1254 			att &= ~aClearAttMask;
       
  1255 			file->SetAtt(att | KEntryAttModified);
       
  1256 			file->SetModified(aTime);
       
  1257 			break;
       
  1258 			}
       
  1259 		}
       
  1260 
  1238 	return(r);
  1261 	return(r);
  1239 	}
  1262 	}
  1240 
  1263 
  1241 TInt TDrive::FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode)
  1264 TInt TDrive::FileTemp(CFsRequest* aRequest,TInt& aHandle,const TDesC& aPath,TDes& aName,TUint aMode)
  1242 //
  1265 //