os/kernelhwsrv/userlibandfileserver/fileserver/sfile/Sf_plugin_util.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // f32\sfile\sf_plugin_util.cpp
    15 // 
    16 //
    17 
    18 #include "sf_std.h"
    19 
    20 /**
    21 Utility function to obtain the file name from a file share object
    22 
    23 @param	aFileShare		A pointer to the file share
    24 @param	aName			A reference to the descriptor to contain the file name
    25 */
    26 LOCAL_C void NameFromShare(CFileShare* aFileShare, TDes& aName)
    27 	{
    28 	if(aFileShare)
    29 		{
    30 		CFileCB& theFile = aFileShare->File();
    31 		aName = _L("?:");
    32 		aName[0] = TText('A' + theFile.Drive().DriveNumber());
    33 		aName.Append(theFile.FileName());
    34 		}
    35 	}
    36 
    37 /**
    38 Utility function for obtaining info on file duplicate or adopt requests.
    39 
    40 @param	aRequest		File access request
    41 @param	aDriveNumber	The drive number
    42 @param	aHandle			sub-session handle
    43 @param	aAtt			File attributes
    44 @param	aSize			FileSize
    45 @param	aName			Name of the file
    46 @return File modification time in format of TTime
    47 */
    48 LOCAL_C TInt FileDuplicateAdoptVars(CFsRequest* aRequest, TInt& aDriveNumber, TInt& aHandle, TInt& aAtt, TInt& aSize, TDes& aName, TTime& aTime)
    49 	{
    50 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileDuplicate || aRequest->Operation()->Function()==EFsFileAdopt,Fault(EBaseRequestMessage));
    51 
    52 	aDriveNumber = aRequest->DriveNumber();
    53 	aHandle = aRequest->Message().Int0();
    54 
    55 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
    56 	if(share == NULL)
    57 		return(KErrBadHandle);
    58 
    59 	NameFromShare(share, aName);
    60 
    61 	CFileCB& theFile = share->File();
    62 	aAtt  = theFile.Att();
    63 	aSize = theFile.Size();
    64 	aTime = theFile.Modified();
    65 
    66 	return(KErrNone);
    67 	}
    68 
    69 /**
    70 Utility function for obtaining info on file open requests.  
    71 
    72 @param	aRequest	File open request
    73 @param	aMode		File Open Mode
    74 @param	aHandle		File handle
    75 @param	aName		File's name
    76 */
    77 LOCAL_C TInt FileOpenVar(CFsRequest* aRequest, TUint32& aMode, TInt& aHandle, TDes& aName)
    78 	{
    79 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileOpen,Fault(EBaseRequestMessage));
    80 	
    81 	aMode = aRequest->Message().Int1();
    82 	TPtr8 handle((TUint8*)&aHandle,sizeof(TInt));
    83 	TRAPD(err,aRequest->ReadL(KMsgPtr3,handle));
    84 	if(err != KErrNone)
    85 		{
    86  		handle=0;
    87 		return(err);
    88 		}
    89 
    90 	aName = aRequest->Src().FullName();
    91 
    92 	return(KErrNone);
    93 	}
    94 
    95 /**
    96 Utility function for obtaining info on file Create/Replace requests.
    97 
    98 @param	aRequest	File Create/Replace request
    99 @param	aMode		File Create/Replace Mode
   100 @param	aName		File's name
   101 */
   102 LOCAL_C TInt FileCreateReplaceVar(CFsRequest* aRequest, TUint32& aMode, TDes& aName)
   103 	{
   104 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileCreate || aRequest->Operation()->Function()==EFsFileReplace,Fault(EBaseRequestMessage));
   105 	
   106 	aMode = aRequest->Message().Int1();
   107 	aName = aRequest->Src().FullName();
   108 
   109 	return(KErrNone);
   110 	}
   111 
   112 /**
   113 Utility function for obtaining info on file temp requests.  
   114 
   115 @param	aRequest	File temp request
   116 @param	aMode		File Mode
   117 @param	aName		File's name
   118 @param  aPath		File's path
   119 */
   120 LOCAL_C TInt FileTempVar(CFsRequest* aRequest, TUint32& aMode, TDes& aName,TDes& aPath)
   121 	{
   122 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileTemp,Fault(EBaseRequestMessage));
   123 	
   124 	aMode = aRequest->Message().Int1();
   125 	aPath = aRequest->Src().FullName();
   126 
   127 	TInt nameLen = aRequest->GetDesLength(KMsgPtr2);
   128 	if(nameLen < 0 || nameLen > KMaxFileName)
   129 		{
   130 	    return KErrBadName;
   131 		}
   132 
   133 	TRAPD(err, aRequest->ReadL(KMsgPtr2, aName));
   134 	return(err);
   135 	}
   136 
   137 /**
   138 Utility function for obtaining info on file read/write requests.  
   139 
   140 @param	aRequest	File access request
   141 @param	aLen		The length of file for access
   142 @param	aPos		Position of first byte to be accessed
   143 @param	aName		File name
   144 @return Client's buffer 
   145 */
   146 LOCAL_C TInt FileAccessVars(CFsRequest* aRequest, TInt& aLen, TInt& aPos, TDes& aName, const TAny*& aPtr)
   147 	{
   148 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileRead || aRequest->Operation()->Function()==EFsFileWrite,Fault(EBaseRequestMessage));
   149 
   150 	TMsgOperation& currentOperation = ((CFsMessageRequest*) aRequest)->CurrentOperation();
   151 	aLen = currentOperation.iReadWriteArgs.iLength;
   152 	aPos = (TInt) currentOperation.iReadWriteArgs.iPos;
   153 
   154 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   155 	if(share == NULL)
   156 		return(KErrBadHandle);
   157 	
   158 	NameFromShare(share, aName);
   159 	if (aPos == KCurrentPosition64)
   160 		{
   161 		aPos = (TInt)share->iPos;
   162 		}
   163 	
   164 	aPtr = (TAny*)aRequest->Message().Ptr0();
   165 	
   166 	return(KErrNone);
   167 	}
   168 
   169 /**
   170 Utility function for obtaining info on file lock/unlcok requests.  
   171 
   172 @param	aRequest	File lock request
   173 @param	aLen		The length of file 
   174 @param	aPos		Position of first byte 
   175 @param	aName		File name
   176 */
   177 LOCAL_C TInt FileLockVars(CFsRequest* aRequest, TInt& aLen, TInt& aPos, TDes& aName)
   178 	{
   179 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileLock || aRequest->Operation()->Function()==EFsFileUnLock,Fault(EBaseRequestMessage));
   180 
   181 	aLen = aRequest->Message().Int0();
   182 	aPos = aRequest->Message().Int1();
   183 
   184 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   185 	if(share == NULL)
   186 		return(KErrBadHandle);
   187 
   188 	NameFromShare(share, aName);
   189 
   190 	return(KErrNone);
   191 	}
   192 
   193 /**
   194 Utility function for obtaining info on file seek requests.  
   195 
   196 @param	aRequest	File seek request
   197 @param	aPos		The position within the file 
   198 @param	aName		File name
   199 @return Seek mode in format of TSeek 
   200 */
   201 LOCAL_C TInt FileSeekVars(CFsRequest* aRequest, TInt& aPos, TDes& aName, const TAny*& aPtr)
   202 	{
   203 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileSeek,Fault(EBaseRequestMessage));
   204 	
   205 	aPos = aRequest->Message().Int0();
   206 	
   207 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   208 	if(share == NULL)
   209 		return(KErrBadHandle);
   210 	
   211 	NameFromShare(share, aName);
   212 
   213 	aPtr = aRequest->Message().Ptr1();
   214 	
   215 	return(KErrNone);
   216 	}
   217 
   218 /**
   219 Utility function for obtaining info on file flush requests.  
   220 
   221 @param	aRequest	File flush request
   222 @param	aName		File name
   223 */
   224 LOCAL_C TInt FileFlushVars(CFsRequest* aRequest, TDes& aName)
   225 	{
   226 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileFlush,Fault(EBaseRequestMessage));
   227 	
   228 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   229 	if(share == NULL)
   230 		return(KErrBadHandle);
   231 	
   232 	NameFromShare(share, aName);
   233 	
   234 	return(KErrNone);
   235 	}
   236 
   237 /**
   238 Utility function for obtaining info on file size/SetSize requests.  
   239 
   240 @param	aRequest	File Size/SetSize request
   241 @param	aSize		In case of Size() it is client's buffer, otherwise it is the desired size for SetSize
   242 @param	aName		File name
   243 */
   244 LOCAL_C TInt FileSizeVars(CFsRequest* aRequest,TInt& aSize, TDes& aName)
   245 	{
   246 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileSize || aRequest->Operation()->Function()==EFsFileSetSize,Fault(EBaseRequestMessage));
   247 	
   248 	aSize = aRequest->Message().Int0();
   249 
   250 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   251 	if(share == NULL)
   252 		return(KErrBadHandle);
   253 	
   254 	NameFromShare(share, aName);
   255 	
   256 	return(KErrNone);
   257 	}
   258 
   259 /**
   260 Utility function for obtaining info on file Att requests.  
   261 
   262 @param	aRequest	File Att request
   263 @param	aAtt		Attribute of the file in question. 
   264 @param	aName		File name
   265 */
   266 LOCAL_C TInt FileAttVars(CFsRequest* aRequest,TInt& aAtt, TDes& aName)
   267 	{
   268 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileAtt,Fault(EBaseRequestMessage));
   269 
   270 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   271 	if(share == NULL)
   272 		return(KErrBadHandle);
   273 
   274 	aAtt = (TInt)share->File().Att();
   275 	NameFromShare(share, aName);
   276 
   277 	return(KErrNone);
   278 	}
   279 
   280 /**
   281 Utility function for obtaining info on file SetAtt requests.  
   282 
   283 @param	aRequest		File SetAtt request
   284 @param	aAtt			Current Attribute of the file 
   285 @param	aName			File name
   286 @param	aSetAttMask		The attribute mask to be set
   287 @param  aClearAttMask	The attribute mask to be cleared
   288 */
   289 LOCAL_C TInt FileSetAttVars(CFsRequest* aRequest,TInt& aAtt, TDes& aName, TUint& aSetAttMask,TUint& aClearAttMask)
   290 	{
   291 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileSetAtt,Fault(EBaseRequestMessage));
   292 
   293 	CFileShare* share=(CFileShare*)aRequest->ScratchValue();
   294 	if(share == NULL)
   295 		return(KErrBadHandle);
   296 	
   297 	aAtt = (TInt)share->File().Att();
   298 	NameFromShare(share, aName);
   299 
   300 	aSetAttMask   = aRequest->Message().Int0(); 
   301 	aClearAttMask = aRequest->Message().Int1();
   302 	
   303 	return(KErrNone);
   304 	}
   305 
   306 /**
   307 Utility function for obtaining info on file modification requests.  
   308 
   309 @param	aRequest		File Modified/SetModified request
   310 @param	aAtt			Current Attribute of the file 
   311 @param	aSize			Current size of the file
   312 @param	aName			File name
   313 @param  Moidfied		Last modified time of the file
   314 @return if request is Modified, returns clients buffer
   315 		if request is SetModified returns the desired last modification time
   316 */
   317 LOCAL_C TInt FileModificationVars(CFsRequest* aRequest,TInt& aAtt, TInt& aSize, TDes& aName, TTime& aModified, TTime& aOldTime)
   318 	{
   319 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileModified || aRequest->Operation()->Function()==EFsFileSetModified,Fault(EBaseRequestMessage));
   320 	
   321 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   322 	if(share == NULL)
   323 		return(KErrBadHandle);
   324 	
   325 	NameFromShare(share, aName);
   326 	
   327 	CFileCB& file = share->File();
   328 	aAtt  = file.Att();
   329 	aSize = file.Size();
   330 	aOldTime = file.Modified();
   331 
   332 	TPtr8 timePkg((TUint8*)&aModified, sizeof(TTime));
   333 	TRAPD(err, aRequest->ReadL(KMsgPtr0, timePkg));
   334 	
   335 	return(err);
   336 	}
   337 
   338 /**
   339 Utility function for obtaining info on file Set requests.  
   340 
   341 @param	aRequest			File Set request
   342 @param	aName				File name
   343 @param	aCurrentAtt			Current Attribute of the file 
   344 @param	aNewSetAtt			The new attribute to be set
   345 @param	aNewClearAtt		The attribute to be cleared
   346 @param  aCurrentModified	Last modified time of the file
   347 @param  aNewModified		New last modified time of the file
   348 */
   349 LOCAL_C TInt FileSetVars(CFsRequest* aRequest, TDes& aName, TInt& aCurrentAtt,TInt& aNewSetAtt, TInt& aNewClearAtt, TTime& aCurrentModified, TTime& aNewModified)
   350 	{
   351 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileSet,Fault(EBaseRequestMessage));
   352 	
   353 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   354 	if(share == NULL)
   355 		return(KErrBadHandle);
   356 
   357 	NameFromShare(share, aName);
   358 
   359 	CFileCB& file = share->File();
   360 	aCurrentAtt= file.Att();
   361 	aCurrentModified = file.Modified();
   362 
   363 	aNewSetAtt   = aRequest->Message().Int1();
   364 	aNewClearAtt = aRequest->Message().Int2();
   365 
   366 	TPtr8 timePkg((TUint8*)&aNewModified, sizeof(TTime));
   367 	TRAPD(err, aRequest->ReadL(KMsgPtr0, timePkg));
   368 	return(err);
   369 	}
   370 
   371 /**
   372 Utility function for obtaining info on file ChangeMode requests.  
   373 
   374 @param	aRequest			File Set request
   375 @param	aName				File name
   376 @param	aCurrentMode		Current mode of the file 
   377 @param	aNewMode			The new mode of file (switch between EFileShareExclusive and EFileShareReadersOnly
   378 @param  aModified			Last modified time of the file
   379 */
   380 LOCAL_C TInt FileChangeModeVars(CFsRequest* aRequest, TDes& aName, TInt& aCurrentMode,TInt& aNewMode, TTime& aModified)
   381 	{
   382 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileChangeMode,Fault(EBaseRequestMessage));
   383 	
   384 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   385 	if(share == NULL)
   386 		return(KErrBadHandle);
   387 
   388 	NameFromShare(share, aName);
   389 	aCurrentMode = share->iMode & KFileShareMask;
   390 	aModified = share->File().Modified();
   391 
   392 	aNewMode = aRequest->Message().Int0();
   393 
   394 	return(KErrNone);
   395 	}
   396 
   397 /**
   398 Utility function for obtaining info on file Rename requests.  
   399 
   400 @param	aRequest			File Rename request
   401 @param	aCurrentName		File's current name
   402 @param	aCurrentDrive		File's current drive
   403 @param	aNewName			the new name
   404 @return KErrNone on successful read of info from CFsRequest or a system wide error 
   405 */
   406 LOCAL_C TInt FileRenameVars(CFsRequest* aRequest, TDes& aCurrentName, TDriveUnit& aCurrentDrive, TDes& aNewName)
   407 	{
   408 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileRename,Fault(EBaseRequestMessage));
   409 	
   410 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   411 	if(share == NULL)
   412 		return(KErrBadHandle);
   413 
   414 	NameFromShare(share, aCurrentName);
   415 	aCurrentDrive = share->File().Mount().Drive().DriveNumber();
   416 
   417 	aNewName =	aRequest->Dest().FullName();
   418 
   419 	return(KErrNone);
   420 	}
   421 
   422 /**
   423 Utility function for obtaining info on file Drive/Name requests.  
   424 
   425 @param	aRequest			File Rename request
   426 @param	aFileName			File's current name
   427 @param	aCurrentDrive		File's current drive
   428 @param	aDriveInfo			File's drive information
   429 */
   430 LOCAL_C TInt FileDriveNameVars(CFsRequest* aRequest, TDes& aFileName, TDriveUnit& aCurrentDrive,TDriveInfo& aDriveInfo)
   431 	{
   432 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileDrive || aRequest->Operation()->Function()==EFsFileName,Fault(EBaseRequestMessage));
   433 	
   434 	CFileShare* share = (CFileShare*)aRequest->ScratchValue();
   435 	if(share == NULL)
   436 		return(KErrBadHandle);
   437 
   438 	NameFromShare(share, aFileName);
   439 	aCurrentDrive = share->File().Mount().Drive().DriveNumber();
   440 	share->File().Mount().Drive().DriveInfo(aDriveInfo);
   441 
   442 	return(KErrNone);
   443 	}
   444 
   445 /**
   446 Utility function for obtaining info on file delete requests.  
   447 
   448 @param	aRequest			Dir read request
   449 @param	aFileName			The name of the file
   450 */
   451 LOCAL_C TInt FileDelVars(CFsRequest* aRequest, TDes& aFileName)
   452 	{
   453 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsDelete,Fault(EBaseRequestMessage));
   454 
   455 	aFileName = aRequest->Src().FullName();
   456 
   457 	return(KErrNone);
   458 	}
   459 
   460 /**
   461 Utility function for obtaining info on file rename/replace requests.  
   462 
   463 @param	aRequest			File rename/replace request
   464 @param	aOldFileName		The old name of the file
   465 @param	aNewFileName		The new name of the file
   466 */
   467 LOCAL_C TInt FileRenameReplaceVars(CFsRequest* aRequest, TDes& aOldFileName,TDes& aNewFileName)
   468 	{
   469 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsRename || aRequest->Operation()->Function()==EFsReplace,Fault(EBaseRequestMessage));
   470 
   471 	aOldFileName = aRequest->Src().FullName();
   472 	aNewFileName = aRequest->Dest().FullName();
   473 
   474 	return(KErrNone);
   475 	}
   476 
   477 /**
   478 Utility function for obtaining info on file close requests.  
   479 
   480 @param	aRequest			File close request
   481 @param	aPath				The path of the file
   482 @return	KErrNone
   483 */
   484 LOCAL_C TInt FileCloseVars(CFsRequest* aRequest, TDes& aFileName)
   485 	{
   486 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsFileSubClose,Fault(EBaseRequestMessage));
   487 	
   488 	const TDes* fileName=(TDes*) I64HIGH(aRequest->ScratchValue64());
   489 	if(fileName == NULL)
   490 		return(KErrBadName);
   491 
   492 	aFileName = _L("?:");
   493 	aFileName[0] = TText('A' + aRequest->DriveNumber());
   494 	aFileName.Append(*fileName);
   495 	
   496 	return(KErrNone);
   497 	}
   498 
   499 /**
   500 Dir Operations
   501 */
   502 
   503 /**
   504 Utility function for obtaining info on dir Open requests.  
   505 
   506 @param	aRequest			Dir Open request
   507 @param	aDirName			Name of Dir
   508 @param	aAtt				Attribute
   509 @param	aUidType			Uid Type
   510 */
   511 LOCAL_C TInt DirOpenVars(CFsRequest* aRequest, TDes& aDirName, TInt& aAtt,TInt& aUidType)
   512 	{
   513 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsDirOpen,Fault(EBaseRequestMessage));
   514 
   515 	aDirName = aRequest->Src().FullName();
   516 
   517 	aAtt = aRequest->Message().Int1();
   518 	aUidType = aRequest->Message().Int2();
   519 
   520 	return(KErrNone);
   521 	}
   522 
   523 
   524 /**
   525 Utility function for obtaining info on dir Make requests. 
   526 
   527 @param	aRequest			MkDir/MkDirAll request
   528 @param	aMkDirAll			if MkDirAll it will be 1
   529 @param	aPath				The path name specifiying the directory or directories to create.
   530 */
   531 LOCAL_C TInt DirMakeVars(CFsRequest* aRequest, TInt& aMkDirAll, TDes& aPath)
   532 	{
   533 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsMkDir,Fault(EBaseRequestMessage));
   534 	
   535 	aMkDirAll = aRequest->Message().Int1();
   536 	aPath = aRequest->Src().FullName();
   537 
   538 	return(KErrNone);
   539 	}
   540 
   541 /**
   542 Utility function for obtaining info on dir remove requests.
   543 
   544 @param	aRequest			RmDir request
   545 @param	aPath				The path name specifiying the directory to be removed.
   546 */
   547 LOCAL_C TInt DirRemoveVars(CFsRequest* aRequest, TDes& aPath)
   548 	{
   549 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsRmDir,Fault(EBaseRequestMessage));
   550 
   551 	aPath = aRequest->Src().FullName();
   552 
   553 	return(KErrNone);
   554 	}
   555 
   556 /**
   557 Utility function for obtaining info on file entry requests.
   558 
   559 @param	aRequest	File entry request
   560 @param	aName		Entry name
   561 */
   562 LOCAL_C TInt FileEntryVars(CFsRequest* aRequest, TDes& aName)
   563 	{
   564 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsEntry ||
   565                     aRequest->Operation()->Function()==EFsSetEntry,
   566                     Fault(EBaseRequestMessage));
   567 
   568 	aName = aRequest->Src().FullName();
   569 
   570 	return(KErrNone);
   571 	}
   572 
   573 /**
   574 Utility function for obtaining info on file read file section requests.  
   575 
   576 @param	aRequest	Read file section request
   577 @param	aLen		The length of file for access
   578 @param	aPos		Position of first byte to be accessed
   579 @param	aName		File name
   580 @return KErrNone successful (aLen aPos and aName updated)
   581 */
   582 LOCAL_C TInt FileSectionVars(CFsRequest* aRequest, TInt& aLen, TInt& aPos, TDes& aName)
   583 	{
   584 	__ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsReadFileSection,Fault(EBaseRequestMessage));
   585 	
   586 	aPos = aRequest->Message().Int2();
   587 	aLen = aRequest->Message().Int3();
   588 	
   589 	aName = aRequest->Src().FullName();
   590 	
   591 	return(KErrNone);
   592 	}
   593 
   594 /**
   595 @internalTechnology
   596 
   597 Utility function for obtaining the name of the file/dir from the client request 
   598 Supported requests are:
   599 
   600 	EFsFileDuplicate
   601 	EFsFileAdopt
   602 	EFsFileOpen
   603 	EFsFileCreate
   604 	EFsFileReplace
   605 	EFsFileTemp
   606 	EFsFileRead
   607 	EFsFileWrite
   608 	EFsFileLock
   609 	EFsFileUnLock	
   610 	EFsFileSeek
   611 	EFsFileFlush
   612 	EFsFileSize
   613 	EFsFileSetSize
   614 	EFsFileAtt
   615 	EFsFileSetAtt
   616 	EFsFileModified
   617 	EFsFileSetModified
   618 	EFsFileSet
   619 	EFsFileChangeMode
   620 	EFsFileRename
   621 	EFsFileDrive
   622 	EFsFileName
   623 	EFsDelete
   624 	EFsRename
   625 	EFsReplace
   626 	EFsDirOpen
   627 	EFsFileSubClose
   628 	EFsEntry
   629 	EFsReadFileSection
   630 	EFsFileWriteDirty
   631 	
   632 @param	aRequest	The client request
   633 @param	aName		Name of the file/folder
   634 @return KErrNone on successful completion, KErrNotSupported if the request is not supported 
   635 */
   636 EXPORT_C TInt GetName(TFsPluginRequest* aRequest, TDes& aName)
   637 	{
   638 	TInt driveNumber;
   639 	TInt handle;
   640 	TInt att;
   641 	TInt size;
   642 	TUint32 mode;
   643 	TPath path;
   644 	TFileName newName;
   645 	TInt pos;
   646 	TInt len;
   647 	TUint attMask;
   648 	TTime modified;
   649 	TInt fmode;
   650 	TDriveUnit drive;
   651 	TDriveInfo info;
   652 	TInt uidType;
   653 	const TAny* ptr;
   654 	TInt err = KErrNone;
   655 	switch(aRequest->Function())
   656 		{
   657 		case EFsFileDuplicate:
   658 		case EFsFileAdopt:
   659 			err = FileDuplicateAdoptVars(aRequest->Request(), driveNumber, handle, att, size, aName, modified);
   660 			break;
   661 		case EFsFileOpen: 
   662 			err = FileOpenVar(aRequest->Request(), mode, handle, aName);
   663 			break;
   664 		case EFsFileCreate:
   665 		case EFsFileReplace:
   666 			err = FileCreateReplaceVar(aRequest->Request(), mode, aName);
   667 			break;
   668 		case EFsFileTemp: 
   669 			err = FileTempVar(aRequest->Request(), mode, aName, path);
   670 			break;
   671 		case EFsFileRead:
   672 		case EFsFileWrite:
   673 			err = FileAccessVars(aRequest->Request(), len, pos, aName, ptr);
   674 			break;
   675 		case EFsFileLock:
   676 		case EFsFileUnLock:	
   677 			err = FileLockVars(aRequest->Request(), len, pos, aName);
   678 			break;
   679 		case EFsFileSeek:
   680 			err = FileSeekVars(aRequest->Request(),  pos, aName, ptr);
   681 			break;
   682 		case EFsFileFlush: 
   683 			err = FileFlushVars(aRequest->Request(), aName);
   684 			break;
   685 		case EFsFileSize:
   686 		case EFsFileSetSize:
   687 			err = FileSizeVars(aRequest->Request(),size, aName);
   688 			break;
   689 		case EFsFileAtt:
   690 			err = FileAttVars(aRequest->Request(),att, aName);
   691 			break;
   692 		case EFsFileSetAtt:
   693 			err = FileSetAttVars(aRequest->Request(),att, aName, attMask, attMask);
   694 			break;
   695 		case EFsFileModified:
   696 		case EFsFileSetModified:
   697 			err = FileModificationVars(aRequest->Request(),att, size, aName, modified, modified);
   698 			break;
   699 		case EFsFileSet:
   700 			err = FileSetVars(aRequest->Request(), aName, att,att, att, modified, modified);
   701 			break;
   702 		case EFsFileChangeMode:
   703 			err = FileChangeModeVars(aRequest->Request(), aName, fmode,fmode, modified);
   704 			break;
   705 		case EFsFileRename:
   706 			err = FileRenameVars(aRequest->Request(), aName, drive, (TDes&)newName);
   707 			break;
   708 		case EFsFileDrive:
   709 		case EFsFileName:
   710 			err = FileDriveNameVars(aRequest->Request(), aName, drive, info);
   711 			break;
   712 		case EFsDelete:
   713 			err = FileDelVars(aRequest->Request(), aName);
   714 			break;
   715 		case EFsRename:
   716 		case EFsReplace:
   717 			err = FileRenameReplaceVars(aRequest->Request(), aName, (TDes&)newName);
   718 			break;
   719 		case EFsDirOpen:
   720 			err = DirOpenVars(aRequest->Request(), aName, att,uidType);
   721 			break;
   722 		case EFsFileSubClose:
   723 			err = FileCloseVars(aRequest->Request(), aName);
   724 			break;
   725 		case EFsEntry:
   726 		case EFsSetEntry:
   727 			err = FileEntryVars(aRequest->Request(), aName);
   728 			break;
   729 		case EFsReadFileSection:
   730 			err = FileSectionVars(aRequest->Request(), len, pos, (TDes&)aName);
   731 			break;
   732 		default:
   733 			err = KErrNotSupported;
   734 		}
   735 
   736 	return(err);
   737 	}
   738 
   739 /**
   740 @internalTechnology
   741 
   742 Utility function for obtaining the proposed new name of the file/dir from the client rename/replace request 
   743 Supported requests are: 
   744 
   745 	EFsFileRename
   746 	EFsRename
   747 	EFsReplace
   748 	
   749 @param	aRequest	The client request
   750 @param	aName		New name of the file/folder
   751 @return KErrNone on successful completion, KErrNotSupported if the request is not supported 
   752 */
   753 EXPORT_C TInt GetNewName(TFsPluginRequest* aRequest, TDes& aNewName)
   754 	{
   755 	TFileName name;
   756 	TDriveUnit drive;
   757 	TInt err = KErrNone;
   758 
   759 	switch(aRequest->Function())
   760 		{
   761 		case EFsFileRename:
   762 			err = FileRenameVars(aRequest->Request(), (TDes&)name, drive, aNewName);
   763 			break;
   764 		case EFsRename:
   765 		case EFsReplace:
   766 			err = FileRenameReplaceVars(aRequest->Request(), name, aNewName);
   767 			break;
   768 		default:
   769 			err = KErrNotSupported;
   770 		}
   771 
   772 	return(err);
   773 	}
   774 
   775 
   776 /**
   777 @internalTechnology
   778 
   779 Utility function for obtaining the path from the client request 
   780 Supported requests currently are: 
   781 	
   782 	EFsFileTemp
   783 	EFsMkDir
   784 	EFsRmDir
   785 
   786 @param	aRequest	The client request
   787 @param	aPath		The path
   788 @return KErrNone on successful completion, KErrNotSupported if the request is not supported 
   789 */
   790 EXPORT_C TInt GetPath(TFsPluginRequest* aRequest, TDes& aPath)
   791 	{
   792 	TFileName name;
   793 	TUint32 mode;
   794 	TInt fmode;
   795 	TInt err = KErrNone;
   796 
   797 	switch(aRequest->Function())
   798 		{
   799 		case EFsFileTemp: 
   800 			err = FileTempVar(aRequest->Request(), mode, (TDes&)name, aPath);
   801 			break;
   802 		case EFsMkDir: 
   803 			err = DirMakeVars(aRequest->Request(), fmode, aPath);
   804 			break;
   805 		case EFsRmDir:
   806 			err = DirRemoveVars(aRequest->Request(), aPath);
   807 			break;
   808 		default:
   809 			err = KErrNotSupported;
   810 		}
   811 
   812 	return(err);
   813 	}
   814 
   815 /**
   816 @internalTechnology
   817 
   818 Utility function for obtaining the attribute of the file/folder from the client request 
   819 Supported requests currently are: 
   820 	
   821 	EFsFileDuplicate
   822 	EFsFileAdopt
   823 	EFsFileAtt
   824 	EFsFileSetAtt
   825 	EFsFileModified
   826 	EFsFileSetModified
   827 	EFsFileSet
   828 	EFsDirOpen
   829 
   830 @param	aRequest	The client request
   831 @param	aAtt		The attribute
   832 @return KErrNone on successful completion, KErrNotSupported if the request is not supported 
   833 */
   834 EXPORT_C TInt GetAtt(TFsPluginRequest* aRequest, TInt& aAtt)
   835 	{
   836 	TInt size;
   837 	TFileName name;
   838 	TInt handle;
   839 	TInt driveNumber;
   840 	TUint attMask;
   841 	TTime modified;
   842 	TInt att;
   843 	TInt uidType;
   844 	TInt err = KErrNone;
   845 
   846 	switch(aRequest->Function())
   847 		{
   848 		case EFsFileDuplicate:
   849 		case EFsFileAdopt:
   850 			err = FileDuplicateAdoptVars(aRequest->Request(), driveNumber, handle, aAtt, size,(TDes&)name, modified);
   851 			break;
   852 		case EFsFileAtt:
   853 			err = FileAttVars(aRequest->Request(),aAtt, (TDes&)name);
   854 			break;
   855 		case EFsFileSetAtt:
   856 			err = FileSetAttVars(aRequest->Request(),aAtt, (TDes&)name, attMask, attMask);
   857 			break;
   858 		case EFsFileModified:
   859 		case EFsFileSetModified:
   860 			err = FileModificationVars(aRequest->Request(),aAtt, size,(TDes&)name, modified, modified);
   861 			break;
   862 		case EFsFileSet:
   863 			err = FileSetVars(aRequest->Request(), (TDes&)name, aAtt, att, att, modified, modified);
   864 			break;
   865 		case EFsDirOpen:
   866 			err = DirOpenVars(aRequest->Request(), (TDes&)name, aAtt, uidType);
   867 			break;
   868 		default:
   869 			err = KErrNotSupported;
   870 		}
   871 
   872 	return(err);
   873 	}
   874 
   875 
   876 /**
   877 @internalTechnology
   878 
   879 Utility function for obtaining the last modified time of a file from the client request 
   880 Supported requests currently are: 
   881 	
   882 	EFsFileDuplicate
   883 	EFsFileAdopt
   884 	EFsFileModified
   885 	EFsFileSetModified
   886 	EFsFileSet
   887 	EFsFileChangeMode
   888 
   889 @param	aRequest	The client request
   890 @param	aModified	The last modified time
   891 @param	aCurrent	If true it returns the current last modified time, otherwise it will return 
   892 					the requested last modified time 
   893 @return KErrNone on successful completion, KErrNotSupported if the request is not supported 
   894 */
   895 EXPORT_C TInt GetModifiedTime(TFsPluginRequest* aRequest, TTime*& aModified, TBool aCurrent)
   896 	{
   897 	TFileName name;
   898 	TInt handle;
   899 	TInt att;
   900 	TInt size;
   901 	TInt driveNumber;
   902 	TTime modified;
   903 	TInt fmode;
   904 	
   905 	TTime& _aModified = aModified ? *aModified : modified;
   906 
   907 	TInt err = KErrNone;
   908 
   909 	switch(aRequest->Function())
   910 		{
   911 		case EFsFileDuplicate:
   912 		case EFsFileAdopt:
   913 			err = FileDuplicateAdoptVars(aRequest->Request(), driveNumber, handle, att, size, (TDes&)name, _aModified);
   914 			break;
   915 		case EFsFileModified:
   916 			err = FileModificationVars(aRequest->Request(), att, size, (TDes&)name, _aModified, modified);
   917 			break;
   918 		case EFsFileSetModified:
   919 			if(aCurrent)
   920 				err = FileModificationVars(aRequest->Request(), att, size, (TDes&)name, _aModified, modified);
   921 			else
   922 				err = FileModificationVars(aRequest->Request(), att, size, (TDes&)name, modified, _aModified);
   923 			break;
   924 		case EFsFileSet:
   925 			if(aCurrent)
   926 				err = FileSetVars(aRequest->Request(), (TDes&)name, att, att, att, _aModified, modified);
   927 			else
   928 				err = FileSetVars(aRequest->Request(), (TDes&)name, att, att, att, modified, _aModified);
   929 			break;
   930 		case EFsFileChangeMode:
   931 			err = FileChangeModeVars(aRequest->Request(), (TDes&)name, fmode, fmode, _aModified);
   932 			break;
   933 		default:
   934 			err = KErrNotSupported;
   935 		}
   936 
   937 	return(err);
   938 	}
   939 
   940 /**
   941 @internalTechnology
   942 
   943 Utility function for obtaining the file access  information from the client request 
   944 Supported requests currently are: 
   945 	
   946 	EFsFileRead
   947 	EFsFileWrite
   948 	EFsFileLock
   949 	EFsFileUnLock
   950 	EFsFileSeek
   951 	EFsReadFileSection
   952 
   953 @param	aRequest	The client request
   954 @param	aLength		Length of access
   955 @param	aPos		Position of access 
   956 @return KErrNone on successful completion, KErrNotSupported if the request is not supported 
   957 */
   958 EXPORT_C TInt GetFileAccessInfo(TFsPluginRequest* aRequest, TInt& aLength, TInt& aPos)
   959 	{
   960 	TFileName name;
   961 	const TAny* ptr;
   962 	TInt err = KErrNone;
   963 
   964 	switch(aRequest->Function())
   965 		{
   966 	
   967 		case EFsFileRead:
   968 		case EFsFileWrite:
   969 			err = FileAccessVars(aRequest->Request(), aLength, aPos, (TDes&)name, ptr);
   970 			break;
   971 		case EFsFileLock:
   972 		case EFsFileUnLock:	
   973 			err = FileLockVars(aRequest->Request(), aLength, aPos, (TDes&)name);
   974 			break;
   975 		case EFsFileSeek:			
   976 			err = FileSeekVars(aRequest->Request(),  aPos, (TDes&)name, ptr);
   977 			aLength=0;
   978 			break;
   979 		case EFsReadFileSection:
   980 			err = FileSectionVars(aRequest->Request(), aLength, aPos, (TDes&)name);
   981 			break;
   982 		default:
   983 			err = KErrNotSupported;
   984 		}
   985 	
   986 	return(err);
   987 	}