os/kernelhwsrv/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,3881 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// f32\sfsrv\cl_cli.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include "cl_std.h"
    1.22 +#include <f32fsys.h>
    1.23 +
    1.24 +
    1.25 +
    1.26 +
    1.27 +
    1.28 +
    1.29 +
    1.30 +EFSRV_EXPORT_C TBool RFs::IsValidDrive(TInt aDrive)
    1.31 +/**
    1.32 +Tests whether the specified drive number is valid.
    1.33 +
    1.34 +A valid drive number is any number between 0 and (KMaxDrives-1) inclusive,
    1.35 +or the specific value KDefaultDrive (implying the session default drive).
    1.36 +
    1.37 +@param aDrive The drive number.
    1.38 +			
    1.39 +@return True if the drive is valid; false if not.				
    1.40 +
    1.41 +@see TDriveNumber 				
    1.42 +*/
    1.43 +	{
    1.44 +
    1.45 +	return((aDrive>=0 && aDrive<KMaxDrives) || aDrive==KDefaultDrive);
    1.46 +	}
    1.47 +
    1.48 +
    1.49 +
    1.50 +
    1.51 +EFSRV_EXPORT_C TInt RFs::CharToDrive(TChar aChar,TInt& aDrive)
    1.52 +/**
    1.53 +Maps a drive character to a drive number.
    1.54 +
    1.55 +The drive character must be in the range A to Z or a to z. For example, drive A (or a)
    1.56 +corresponds to zero, drive B (or b) corresponds to 1 etc. For the drive number
    1.57 +enumeration, see TDriveNumber.
    1.58 +
    1.59 +@param aChar  The drive character.
    1.60 +@param aDrive On return, contains the drive number.
    1.61 +
    1.62 +@return KErrNone, if successful;
    1.63 +        KErrArgument, if the drive character is not in the range A to Z or a to z.
    1.64 +        
    1.65 +@see TDriveNumber        
    1.66 +*/
    1.67 +	{
    1.68 +
    1.69 +	aChar.UpperCase();
    1.70 +	if (aChar>='A' && aChar<='Z')
    1.71 +		{
    1.72 +		aDrive=(TInt)aChar-'A';
    1.73 +		return(KErrNone);
    1.74 +		}
    1.75 +	return(KErrArgument);
    1.76 +	}
    1.77 +
    1.78 +
    1.79 +
    1.80 +
    1.81 +EFSRV_EXPORT_C TInt RFs::DriveToChar(TInt aDrive,TChar& aChar)
    1.82 +/**
    1.83 +Maps a drive number to the corresponding character.
    1.84 +
    1.85 +The drive number must be in the range 0 to (KMaxDrives-1). For example, drive
    1.86 +number zero (EDriveA) corresponds to drive A, one (EDriveB)
    1.87 +corresponds to drive B. For the drive number enumeration, see TDriveNumber.
    1.88 +
    1.89 +The drive number can also be KDefaultDrive, implying the default drive. In this
    1.90 +case the current drive is taken and converted.
    1.91 +
    1.92 +@param aDrive The drive number.
    1.93 +@param aChar  On return, contains the drive character.
    1.94 +
    1.95 +@return KErrNone, if successful;
    1.96 +        KErrArgument, if the drive number is invalid;
    1.97 +        otherwise one of the other system-wide error codes.
    1.98 +*/
    1.99 +	{
   1.100 +
   1.101 +	if (aDrive==KDefaultDrive)
   1.102 +		{
   1.103 +		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveToChar, MODULEUID, aDrive);
   1.104 +		RFs fs;
   1.105 +		TFileName path;
   1.106 +		TInt r=fs.Connect();
   1.107 +		if (r!=KErrNone)
   1.108 +			return(r);
   1.109 +		r=fs.SessionPath(path);
   1.110 +		fs.Close();
   1.111 +		if (r!=KErrNone)
   1.112 +			return(r);
   1.113 +		aChar=path[0];
   1.114 +		TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDriveToCharReturn, MODULEUID, KErrNone, aChar);
   1.115 +		return(KErrNone);
   1.116 +		}
   1.117 +	if (!IsValidDrive(aDrive))
   1.118 +		return(KErrArgument);
   1.119 +	aChar=aDrive+'A';
   1.120 +	return(KErrNone);
   1.121 +	}
   1.122 +
   1.123 +
   1.124 +
   1.125 +
   1.126 +EFSRV_EXPORT_C TBool RFs::IsRomAddress(TAny *aPtr)
   1.127 +/**
   1.128 +Tests whether the specified address is in ROM.
   1.129 +
   1.130 +@param aPtr The address.
   1.131 +
   1.132 +@return True, if the address is in ROM; false, if not.
   1.133 +*/
   1.134 +	{
   1.135 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsRomAddress, MODULEUID, aPtr);
   1.136 +
   1.137 +	TBool res;
   1.138 +	TInt r=User::IsRomAddress(res,aPtr); // Only returns error on WINS
   1.139 +	if (r!=KErrNone)
   1.140 +		res=EFalse;
   1.141 +
   1.142 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsIsRomAddressReturn, MODULEUID, res);
   1.143 +	return(res);
   1.144 +	}
   1.145 +
   1.146 +
   1.147 +
   1.148 +/** 
   1.149 +Obtain the system drive number.
   1.150 + 
   1.151 +The System Drive is a defined drive on the device which is:
   1.152 + - Read/Writeable
   1.153 + - Internal: Always available and not removable from the device
   1.154 + - Non-Volatile (e.g. Flash memory, battery-backed RAM)
   1.155 + - Only Accessible via Rfs (e.g. not available via USB mass storage)
   1.156 +     
   1.157 +The System drive is utilised as:
   1.158 + - Storage for Persistent settings from system and application software
   1.159 + - Storage for Localisation resources
   1.160 + - A Default Drive for user data
   1.161 + - A Target Drive for Software installations
   1.162 +
   1.163 +It the system drive is not set previously (see RFs::SetSystemDrive) EDriveC is returned by default.
   1.164 + 
   1.165 +@see RFs::GetSystemDriveChar
   1.166 +@see RFs::SetSystemDrive   
   1.167 +@see TDriveNumber
   1.168 +@return TDriveNumber contains the drive number of the system drive.
   1.169 + */
   1.170 +EFSRV_EXPORT_C TDriveNumber RFs::GetSystemDrive()
   1.171 +    {
   1.172 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDrive, MODULEUID);
   1.173 +    TInt drive;
   1.174 +	TInt err = RProperty::Get(TSecureId(KFileServerUidValue), KSystemDriveKey, drive);
   1.175 +    if(err==KErrNone)
   1.176 +        {
   1.177 +        if((drive>=EDriveA) && (drive<=EDriveZ))
   1.178 +            {
   1.179 +			TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveReturn, MODULEUID, drive);
   1.180 +            return static_cast<TDriveNumber>(drive);
   1.181 +            }
   1.182 +        }
   1.183 +
   1.184 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveReturn, MODULEUID, EDriveC);
   1.185 +    return EDriveC;
   1.186 +	}
   1.187 +    
   1.188 +
   1.189 +
   1.190 +/**
   1.191 +This is a wrapper around GetSystemDrive() function. It returns the character corresponding to the system drive.
   1.192 +
   1.193 +@parameter aDriveChar On return, contains the system drive character
   1.194 +@return KErrNone if successful, otherwise one of the other system-wide error codes
   1.195 +@see RFs::GetSystemDrive
   1.196 +*/
   1.197 +EFSRV_EXPORT_C TChar RFs::GetSystemDriveChar()
   1.198 +	{
   1.199 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveChar, MODULEUID);
   1.200 +
   1.201 +	TInt r = 'A' + GetSystemDrive();
   1.202 +
   1.203 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetSystemDriveCharReturn, MODULEUID, r);
   1.204 +	return r;
   1.205 +	}
   1.206 +
   1.207 +
   1.208 +
   1.209 +/**
   1.210 +Set a specified drive as a "System Drive", see RFs::GetSystemDrive().
   1.211 +The "System Drive" can be set only once, any subsequent calls will result in the error 'KErrAlreadyExists'.
   1.212 +
   1.213 +The media type for the system drive shall be one of the: EMediaHardDisk, EMediaFlash, EMediaNANDFlash, EMediaRam
   1.214 +Required drive attributes: KDriveAttLocal, KDriveAttInternal
   1.215 +Prohibited drive attributes: KDriveAttRom,KDriveAttRedirected,KDriveAttSubsted,KDriveAttRemovable
   1.216 +
   1.217 +@param  aSystemDrive specifies the drive number to be set as System Drive
   1.218 +@return KErrNone if successful, otherwise one of the other system-wide error codes
   1.219 +@capability TCB
   1.220 +*/
   1.221 +EFSRV_EXPORT_C TInt RFs::SetSystemDrive(TDriveNumber aSystemDrive)
   1.222 +	{
   1.223 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSystemDrive, MODULEUID, Handle(), aSystemDrive);
   1.224 +    TInt r = SendReceive(EFsSetSystemDrive, TIpcArgs(aSystemDrive));
   1.225 +
   1.226 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSystemDriveReturn, MODULEUID, r);
   1.227 +	return r;
   1.228 +	}
   1.229 +
   1.230 +    
   1.231 +
   1.232 +EFSRV_EXPORT_C TInt RFs::Connect(TInt aMessageSlots)
   1.233 +/**
   1.234 +Connects a client to the file server.
   1.235 +
   1.236 +To end the file server session, use Close().
   1.237 +
   1.238 +@param aMessageSlots The number of message slots required. The default value of
   1.239 +				     KFileServerDefaultMessageSlots indicates that message
   1.240 +				     slots will be acquired dynamically from the system
   1.241 +				     wide pool. Override this value with a fixed number, if
   1.242 +				     a fixed number of slots are to be allocated to the session.
   1.243 +				     If overriding, note that the number of message slots
   1.244 +				     represents the number of operations, such as reads
   1.245 +				     and writes, that can be outstanding at once;
   1.246 +				     always remember to provide a spare slot for
   1.247 +				     the cancel operation.
   1.248 +
   1.249 +@return KErrNone, if successful, otherwise one of the other system-wide
   1.250 +        error codes.
   1.251 +*/
   1.252 +	{
   1.253 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsConnect, MODULEUID, aMessageSlots);
   1.254 +	_LIT(KFileServerName,"!FileServer");
   1.255 +	TInt r = CreateSession(KFileServerName,Version(),aMessageSlots);
   1.256 +
   1.257 +	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsConnectReturn, MODULEUID, r, Handle());
   1.258 +	return r;
   1.259 +	}
   1.260 +
   1.261 +
   1.262 +
   1.263 +
   1.264 +EFSRV_EXPORT_C TInt RFs::SetSessionToPrivate(TInt aDrive)
   1.265 +/**
   1.266 +Sets the session path to point to the private path on the specified drive.
   1.267 +
   1.268 +The private directory does not need to exist at this point.
   1.269 +
   1.270 +The private path for a process has the form: \\Private\\13579BDF\\
   1.271 +where 13579BDF is the identity of the process.
   1.272 +
   1.273 +@param aDrive The drive for which information is requested.
   1.274 +              Specify a drive in the range EDriveA to EDriveZ for drives
   1.275 +			  A to Z respectively.
   1.276 +
   1.277 +@return KErrNone, if successful, otherwise one of the other system-wide
   1.278 +        error codes.
   1.279 +*/
   1.280 +	{	
   1.281 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionToPrivate, MODULEUID, Handle(), aDrive);
   1.282 +	TInt r = SendReceive(EFsSessionToPrivate,TIpcArgs(aDrive));
   1.283 +
   1.284 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionToPrivateReturn, MODULEUID, r);
   1.285 +	return r;
   1.286 +	}
   1.287 +
   1.288 +
   1.289 +
   1.290 +EFSRV_EXPORT_C TInt RFs::PrivatePath(TDes& aPath)
   1.291 +/**
   1.292 +Creates the text defining the private path for a process.
   1.293 +
   1.294 +The private path for a process has the form: \\Private\\13579BDF\\
   1.295 +where 13579BDF is the identity of the process.
   1.296 +
   1.297 +@param aPath On successful return, contains the private path for a process.
   1.298 +*/
   1.299 +	{
   1.300 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsPrivatePath, MODULEUID, Handle());
   1.301 +	TInt r = SendReceive(EFsPrivatePath,TIpcArgs(&aPath));
   1.302 +
   1.303 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsPrivatePathReturn, MODULEUID, r, aPath);
   1.304 +	return r;
   1.305 +	}
   1.306 +
   1.307 +
   1.308 +
   1.309 +EFSRV_EXPORT_C TInt RFs::CreatePrivatePath(TInt aDrive)
   1.310 +/**
   1.311 +Creates the private path for a process on the specified drive.
   1.312 +
   1.313 +The private path for a process has the form: \\Private\\13579BDF\\
   1.314 +where 13579BDF is the identity of the process.
   1.315 +
   1.316 +@param aDrive The drive for which the private path is to be created.
   1.317 +              Specify a drive in the range EDriveA to EDriveZ for drives
   1.318 +			  A to Z respectively.
   1.319 +
   1.320 +@return KErrNone, if successful, otherwise one of the other system-wide
   1.321 +        error codes.
   1.322 +*/
   1.323 +	{
   1.324 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsCreatePrivatePath, MODULEUID, Handle(), aDrive);
   1.325 +	TInt r = SendReceive(EFsCreatePrivatePath,TIpcArgs(aDrive));
   1.326 +
   1.327 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCreatePrivatePathReturn, MODULEUID, r);
   1.328 +	return r;
   1.329 +	}	
   1.330 +
   1.331 +
   1.332 +
   1.333 +
   1.334 +EFSRV_EXPORT_C TVersion RFs::Version() const
   1.335 +/**
   1.336 +Gets the client side version number.
   1.337 +
   1.338 +@return The client side version number.
   1.339 +*/
   1.340 +	{
   1.341 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsVersion, MODULEUID, Handle());
   1.342 +
   1.343 +	TVersion r = TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber);
   1.344 +
   1.345 +	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFsVersionReturn, MODULEUID, r.iMajor, r.iMinor, r.iBuild);
   1.346 +	return r;
   1.347 +	}
   1.348 +
   1.349 +
   1.350 +
   1.351 +
   1.352 +EFSRV_EXPORT_C TInt RFs::AddFileSystem(const TDesC& aFileName) const
   1.353 +/**
   1.354 +Adds a file system to the file server.
   1.355 +
   1.356 +After calling this function, use MountFileSystem() to mount the file system
   1.357 +on a drive.
   1.358 +
   1.359 +@param aFileName The name of the file system .FSY to install. Its full path can
   1.360 +				 be specified.
   1.361 +
   1.362 +@return KErrNone, if successful, otherwise one of the other system-wide
   1.363 +        error codes.
   1.364 +
   1.365 +@capability DiskAdmin
   1.366 +        
   1.367 +@see RFs::MountFileSystem        
   1.368 +*/
   1.369 +	{
   1.370 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddFileSystem, MODULEUID, Handle(), aFileName);
   1.371 +	RLoader loader;
   1.372 +	TInt r = loader.Connect();
   1.373 +	if (r==KErrNone)
   1.374 +		{
   1.375 +		r = loader.SendReceive(ELoadFileSystem, TIpcArgs(0, &aFileName, 0));
   1.376 +		loader.Close();
   1.377 +		}
   1.378 +
   1.379 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddFileSystemReturn, MODULEUID, r);
   1.380 +	return r;
   1.381 +	}
   1.382 +
   1.383 +
   1.384 +
   1.385 +
   1.386 +EFSRV_EXPORT_C TInt RFs::RemoveFileSystem(const TDesC& aFileSystemName) const
   1.387 +/**
   1.388 +Removes the specified file system.
   1.389 +
   1.390 +@param aFileSystemName The fullname of the file system, as returned from
   1.391 +                       a call to FileSystemName(), to be removed.
   1.392 +
   1.393 +@return KErrNone, if successful;
   1.394 +        KErrNotFound, if aFileSystemName is not found;
   1.395 +        otrherwise one of the other system-wide error codes.
   1.396 +
   1.397 +@capability DiskAdmin
   1.398 +
   1.399 +*/
   1.400 +	{
   1.401 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveFileSystem, MODULEUID, Handle(), aFileSystemName);
   1.402 +	TInt r = SendReceive(EFsRemoveFileSystem,TIpcArgs(&aFileSystemName));
   1.403 +
   1.404 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveFileSystemReturn, MODULEUID, r);
   1.405 +	return r;
   1.406 +	}
   1.407 +
   1.408 +
   1.409 +
   1.410 +
   1.411 +EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const
   1.412 +/**
   1.413 +Mounts a file system on a drive.
   1.414 +
   1.415 +The file system must first have been added to the file server using AddFileSystem().
   1.416 +The drive is mounted as asynchronous, i.e operations on it don't block the file server and other drives;
   1.417 +
   1.418 +@param aFileSystemName The fullname of the file system, as returned from  a call to FileSystemName().
   1.419 +@param aDrive          The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber.
   1.420 +
   1.421 +@return KErrNone if successful, otherwise one of the other system-wide error codes.
   1.422 +
   1.423 +@capability DiskAdmin
   1.424 +
   1.425 +@see RFs::AddFileSystem
   1.426 +@see RFs::FileSystemName
   1.427 +*/
   1.428 +	{
   1.429 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem1, MODULEUID, Handle(), aFileSystemName, aDrive);
   1.430 +	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,NULL,EFalse));
   1.431 +
   1.432 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem1Return, MODULEUID, r);
   1.433 +	return r;
   1.434 +	}
   1.435 +
   1.436 +
   1.437 +
   1.438 +
   1.439 +
   1.440 +EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const
   1.441 +/**
   1.442 +Mounts a file system on a specified drive.
   1.443 +
   1.444 +The file system must first have been added to the file server using AddFileSystem().
   1.445 +Depending on the aIsSync parameter, the drive can be mounted as synchronous or asynchronous.
   1.446 +
   1.447 +Asynchronous drive has its own processing thread, i.e operations on it don't block the file server and other drives;
   1.448 +Synchronous drives' requests are being processed by the main file server thread and there is a possibility to block it along with
   1.449 +all operations on other drives. Mounting a drive as synch. makes a sense if the operations on such drive are very fast e.g. this is an
   1.450 +internal RAM or ROFS drive.
   1.451 +
   1.452 +@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName().
   1.453 +@param aDrive          The drive number on which the file system is to be mounted; this can be one of the values defined by TDriveNumber.
   1.454 +
   1.455 +@param aIsSync         if ETrue  the drive will be mounted as synchronous one;
   1.456 +                       if EFalse the drive will be mounted as Asynchronous.
   1.457 +
   1.458 +@return KErrNone if successful, otherwise one of the other system-wide error codes.
   1.459 +@capability DiskAdmin
   1.460 +
   1.461 +@see RFs::AddFileSystem
   1.462 +@see RFs::FileSystemName
   1.463 +*/
   1.464 +	{
   1.465 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem2, MODULEUID, Handle(), aFileSystemName, aDrive, aIsSync);
   1.466 +
   1.467 +	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,NULL,aIsSync));
   1.468 +
   1.469 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem2Return, MODULEUID, r);
   1.470 +	return r;
   1.471 +	}
   1.472 +
   1.473 +
   1.474 +
   1.475 +
   1.476 +EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive)
   1.477 +/**
   1.478 +Mounts a file system on a drive, and the specified extension.
   1.479 +
   1.480 +The file system must first have been added to the file server using AddFileSystem().
   1.481 +The drive is mounted as asynchronous, i.e operations on it don't block the file server and other drives;
   1.482 +
   1.483 +@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName().
   1.484 +@param aExtensionName  The filename of the extension.
   1.485 +@param aDrive          The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber.
   1.486 +
   1.487 +@return KErrNone if successful, otherwise one of the other system-wide error codes.
   1.488 +
   1.489 +@capability DiskAdmin
   1.490 +
   1.491 +@see RFs::AddFileSystem
   1.492 +@see RFs::FileSystemName
   1.493 +*/
   1.494 +	{
   1.495 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem3, MODULEUID, Handle(), aFileSystemName, aExtensionName, aDrive);
   1.496 +
   1.497 +	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,EFalse));
   1.498 +
   1.499 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem3Return, MODULEUID, r);
   1.500 +	return r;
   1.501 +	}
   1.502 +
   1.503 +
   1.504 +
   1.505 +
   1.506 +EFSRV_EXPORT_C TInt RFs::MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync)
   1.507 +/**
   1.508 +Mounts a file system on a drive, and the specified extension.
   1.509 +
   1.510 +The file system must first have been added to the file server using AddFileSystem().
   1.511 +
   1.512 +Depending on the aIsSync parameter, the drive can be mounted as synchronous or asynchronous.
   1.513 +
   1.514 +Asynchronous drive has its own processing thread, i.e operations on it don't block the file server and other drives;
   1.515 +Synchronous drives' requests are being processed by the main file server thread and there is a possibility to block it along with
   1.516 +all operations on other drives. Mounting a drive as synch. makes  sense if the operations on such drive are very fast e.g. this is an
   1.517 +internal RAM or ROFS drive.
   1.518 +
   1.519 +@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName().
   1.520 +@param aExtensionName  The filename of the extension.
   1.521 +@param aDrive          The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber.
   1.522 +
   1.523 +@param aIsSync         if ETrue  the drive will be mounted as synchronous one;
   1.524 +                       if EFalse the drive will be mounted as Asynchronous.
   1.525 +
   1.526 +@return KErrNone if successful, otherwise one of the other system-wide error codes.
   1.527 +
   1.528 +@capability DiskAdmin
   1.529 +
   1.530 +@see RFs::AddFileSystem
   1.531 +@see RFs::FileSystemName
   1.532 +*/
   1.533 +	{
   1.534 +	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem4, MODULEUID, Handle(), aFileSystemName, aExtensionName, aDrive, aIsSync);
   1.535 +	TInt r = SendReceive(EFsMountFileSystem,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,aIsSync));
   1.536 +
   1.537 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystem4Return, MODULEUID, r);
   1.538 +	return r;
   1.539 +	}
   1.540 +
   1.541 +
   1.542 +
   1.543 +
   1.544 +EFSRV_EXPORT_C TInt RFs::MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const
   1.545 +/**
   1.546 +Mounts a file system on a drive, and performs a scan on that drive.
   1.547 +The file system must first have been added to the file server using AddFileSystem().
   1.548 +
   1.549 +Note that the scan is done only if the mount is successful.
   1.550 +
   1.551 +The drive is mounted as asynchronous, i.e operations on it don't block the file server and other drives;
   1.552 +
   1.553 +@param aFileSystemName The fullname of the file system, as returned from a call to FileSystemName().
   1.554 +@param aDrive          The drive on which the file system is to be mounted; this can be one of the values defined by TDriveNumber.
   1.555 +@param aIsMountSuccess On return, set to: ETrue, if the  if the mount is successful, set to EFalse otherwise.
   1.556 +
   1.557 +@return KErrNone if successful, otherwise one of the other system-wide error codes, reflecting the failure of the mount operation. 
   1.558 +
   1.559 +@capability DiskAdmin
   1.560 +
   1.561 +@see RFs::TDriveNumber
   1.562 +@see RFs::AddFileSystem
   1.563 +@see RFs::FileSystemName
   1.564 +*/
   1.565 +	{
   1.566 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan1, MODULEUID, Handle(), aFileSystemName, aDrive);
   1.567 +	aIsMountSuccess=EFalse;
   1.568 +	TPckg<TInt> pckg(aIsMountSuccess);
   1.569 +	TInt r = SendReceive(EFsMountFileSystemScan,TIpcArgs(&aFileSystemName,aDrive,NULL,&pckg));
   1.570 +
   1.571 +	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan1Return, MODULEUID, r, aIsMountSuccess);
   1.572 +	return r;
   1.573 +	}
   1.574 +
   1.575 +EFSRV_EXPORT_C TInt RFs::MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const
   1.576 +/**
   1.577 +Mounts a file system on a drive, and the specified extension and performs a scan on that drive.
   1.578 +
   1.579 +The file system must first have been added to the file server,
   1.580 +using AddFileSystem().
   1.581 +
   1.582 +Note that the scan is done only if the mount is successful.
   1.583 +
   1.584 +The operation is asynchronous, i.e other concurrent file server operations can continue.
   1.585 +
   1.586 +@param aFileSystemName The fullname of the file system, as returned from
   1.587 +                       a call to FileSystemName().
   1.588 +@param aExtensionName  The filename of the extension.
   1.589 +@param aDrive          The drive on which the file system is to be mounted;
   1.590 +                       this can be one of the values defined by TDriveNumber.
   1.591 +@param aIsMountSuccess On return, set to: ETrue, if the  if the mount
   1.592 +                       is successful, set to EFalse otherwise.
   1.593 +
   1.594 +@return KErrNone if successful, otherwise one of the other system-wide
   1.595 +        error codes, reflecting the failure of the mount operation. 
   1.596 +
   1.597 +@capability DiskAdmin
   1.598 +
   1.599 +@see RFs::TDriveNumber
   1.600 +@see RFs::AddFileSystem
   1.601 +@see RFs::FileSystemName
   1.602 +*/
   1.603 +	{
   1.604 +	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan2, MODULEUID, 
   1.605 +		Handle(), aFileSystemName, aExtensionName, aDrive, aIsMountSuccess);
   1.606 +
   1.607 +	aIsMountSuccess=EFalse;
   1.608 +	TPckg<TInt> pckg(aIsMountSuccess);
   1.609 +	TInt r = SendReceive(EFsMountFileSystemScan,TIpcArgs(&aFileSystemName,aDrive,&aExtensionName,&pckg));
   1.610 +
   1.611 +	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsMountFileSystemAndScan2Return, MODULEUID, r, aIsMountSuccess);
   1.612 +	return r;
   1.613 +	}
   1.614 +
   1.615 +EFSRV_EXPORT_C TInt RFs::DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const
   1.616 +/**
   1.617 +Dismounts the file system from the specified drive.
   1.618 +
   1.619 +@param aFileSystemName The fullname of the file system, as returned from
   1.620 +                       a call to FileSystemName().
   1.621 +@param aDrive          The drive from which the file system is to be dismounted.
   1.622 +
   1.623 +@return KErrNone, if successful;
   1.624 +        KErrNotFound, if aFileSystemName is not found;
   1.625 +        KErrNotReady, if the drive does not have a file	system mounted on it;
   1.626 +        KErrInUse, if the drive has a resource open	on it;
   1.627 +        KErrAccessDenied, if there is an attempt to dismount a ROM file system,
   1.628 +        a substituted drive, or the drive which is the default drive;
   1.629 + 		KErrArgument, if the specified drive value is outsdide of the valid range.
   1.630 + 		KErrPermissionDenied, if the client does not have the necessary capabilities 
   1.631 + 		to dismount the file system. 		
   1.632 +
   1.633 +@capability DiskAdmin
   1.634 + 		
   1.635 +@see RFs::FileSystemName 		
   1.636 +*/
   1.637 +	{
   1.638 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountFileSystem, MODULEUID, Handle(), aFileSystemName, aDrive);
   1.639 +	TInt r = SendReceive(EFsDismountFileSystem,TIpcArgs(&aFileSystemName,aDrive));
   1.640 +
   1.641 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountFileSystemReturn, MODULEUID, r);
   1.642 +	return r;
   1.643 +	}
   1.644 +
   1.645 +
   1.646 +
   1.647 +
   1.648 +/**
   1.649 +    Gets the name of the file system mounted on the specified drive.
   1.650 +    The function can be called before calling DismountFileSystem().
   1.651 +			     
   1.652 +    @param aName  On successful return, contains the name of the file system.
   1.653 +    @param aDrive The drive for which the file system name is required.
   1.654 +
   1.655 +    Note that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. 
   1.656 +    "fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF())
   1.657 +    shall be used to deal with the names.
   1.658 +
   1.659 +    @return KErrNone, if successful;
   1.660 +            KErrNotFound if aFileSystemName is not found, or the drive does not have a file	system mounted on it;
   1.661 +            KErrArgument, if the drive value is outside the valid range, i.e. zero to KMaxDrives-1 inclusive.
   1.662 +
   1.663 +    @see RFs::DismountFileSystem				
   1.664 +*/
   1.665 +EFSRV_EXPORT_C TInt RFs::FileSystemName(TDes& aName,TInt aDrive) const
   1.666 +	{
   1.667 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemName, MODULEUID, Handle(), aDrive);
   1.668 +
   1.669 +	//-- ipc argument "-1" here is to indicate legacy FileSystemName() API
   1.670 +    TInt r = SendReceive(EFsFileSystemName,TIpcArgs(&aName, aDrive, -1)); 
   1.671 +
   1.672 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemNameReturn, MODULEUID, r, aName);
   1.673 +	return r;
   1.674 +	}
   1.675 +
   1.676 +
   1.677 +/**
   1.678 +    Get one of the supported file system names on a specified drive. This API can be used for enumerating 
   1.679 +    file systems that can be recognised and mounted automatically, without user's interaction. 
   1.680 +    If the automatic recognition and mountng some known file systems is supported on the specified drive, there 
   1.681 +    shall be at least 2 names in the list. For example "FAT" and "exFAT". 
   1.682 +    If "automatic file system recognising" feature is not supported, the list will consist of just one name, and 
   1.683 +    this will be the name returned by RFs::FileSystemName() API.
   1.684 +
   1.685 +    Note that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. 
   1.686 +    "fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF())
   1.687 +    shall be used to deal with the names.
   1.688 +
   1.689 +    @param  aName           On successful return, contains the name of the file system that correspond to the aFsEnumerator value.
   1.690 +    m@param aDrive          The drive number 
   1.691 +    @param  aFsEnumerator   The supported file system enumerator. can be:
   1.692 +                            KRootFileSystem a special value; in this case the returned name will be the same as obtained by FileSystemName()
   1.693 +                            0,1,2... integer values specifying the sequential number of supported filesystem. See the return error code.
   1.694 +    
   1.695 +    @return KErrNone        success, aName contains a valid name for the supported file system number "aFsEnumerator" on this drive.
   1.696 +            KErrNotFound    the end of the supported file names list; "aFsEnumerator-1" was the last correct value
   1.697 +            KErrArgument    incorrect arguments
   1.698 +            
   1.699 +    
   1.700 +    @see FileSystemName()
   1.701 +    @see KRootFileSystem   
   1.702 +*/
   1.703 +EFSRV_EXPORT_C TInt RFs::SupportedFileSystemName(TDes& aName, TInt aDrive, TInt aFsEnumerator) const
   1.704 +    {
   1.705 +	if(aFsEnumerator < 0)
   1.706 +        return KErrArgument; //-- see RFs::FileSystemName(). "-1" is a reserved value
   1.707 +
   1.708 +    TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemName, MODULEUID, Handle(), aDrive);
   1.709 +    
   1.710 +    TInt r = SendReceive(EFsFileSystemName,TIpcArgs(&aName, aDrive, aFsEnumerator));
   1.711 +
   1.712 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemNameReturn, MODULEUID, r, aName);
   1.713 +	return r;
   1.714 +    }
   1.715 +
   1.716 +
   1.717 +
   1.718 +
   1.719 +
   1.720 +EFSRV_EXPORT_C TInt RFs::AddExtension(const TDesC& aFileName)
   1.721 +/**
   1.722 +Loads the specified extension.
   1.723 +
   1.724 +@param aFileName The file name of the extension
   1.725 +
   1.726 +@return KErrNone, if successful; otherwise one of the other system wide error codes.
   1.727 +*/
   1.728 +	{
   1.729 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddExtension, MODULEUID, Handle(), aFileName);
   1.730 +	RLoader loader;
   1.731 +	TInt r = loader.Connect();
   1.732 +	if (r==KErrNone)
   1.733 +		{
   1.734 +		r = loader.SendReceive(ELoadFSExtension, TIpcArgs(0, &aFileName, 0));
   1.735 +		loader.Close();
   1.736 +		}
   1.737 +
   1.738 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddExtensionReturn, MODULEUID, r);
   1.739 +	return r;
   1.740 +	}
   1.741 +
   1.742 +
   1.743 +
   1.744 +
   1.745 +EFSRV_EXPORT_C TInt RFs::MountExtension(const TDesC& aExtensionName,TInt aDrive)
   1.746 +/**
   1.747 +Mounts the the specified extension.
   1.748 +
   1.749 +The extension must first have been loaded using AddExtension().
   1.750 +
   1.751 +@param aExtensionName  The fullname of the extension, as returned from
   1.752 +                       a call to ExtensionName().
   1.753 +@param aDrive          The drive on which the extension is to be mounted;
   1.754 +
   1.755 +@return KErrNone if successful;
   1.756 +        KErrNotFound, if the extension cannot be found;
   1.757 +        otherwise one of the other system-wide error codes.
   1.758 +
   1.759 +@see RFs::ExtensionName
   1.760 +*/
   1.761 +	{
   1.762 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountExtension, MODULEUID, Handle(), aExtensionName, aDrive);
   1.763 +	TInt r = SendReceive(EFsMountExtension,TIpcArgs(&aExtensionName,aDrive));
   1.764 +
   1.765 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountExtensionReturn, MODULEUID, r);
   1.766 +	return r;
   1.767 +	}
   1.768 +
   1.769 +
   1.770 +
   1.771 +
   1.772 +/**
   1.773 +Dismounts the specified extension.
   1.774 +
   1.775 +@param aExtensionName  The fullname of the extension, as returned from a call to ExtensionName().
   1.776 +@param aDrive          The drive this extension is to be dismounted from.
   1.777 +
   1.778 +@return KErrNone if successful;
   1.779 +        KErrNotFound    if the extension cannot be found;
   1.780 +        otherwise one of the other system-wide error codes.
   1.781 +        
   1.782 +@see RFs::ExtensionName
   1.783 +*/
   1.784 +EFSRV_EXPORT_C TInt RFs::DismountExtension(const TDesC& aExtensionName,TInt aDrive)
   1.785 +	{
   1.786 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountExtension, MODULEUID, Handle(), aExtensionName, aDrive);
   1.787 +	TInt r = SendReceive(EFsDismountExtension,TIpcArgs(&aExtensionName,aDrive));
   1.788 +
   1.789 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountExtensionReturn, MODULEUID, r);
   1.790 +	return r;
   1.791 +	}
   1.792 +
   1.793 +
   1.794 +EFSRV_EXPORT_C TInt RFs::RemoveExtension(const TDesC& aExtensionName)
   1.795 +/**
   1.796 +Removes the specified extension.
   1.797 +
   1.798 +@param aExtensionName The fullname of the extension, as returned from
   1.799 +                      a call to ExtensionName().
   1.800 +
   1.801 +@return KErrNone, if successful;
   1.802 +        KErrNotFound, if aExtensionName is not found;
   1.803 +        otrherwise one of the other system-wide error codes.
   1.804 +*/
   1.805 +	{
   1.806 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveExtension, MODULEUID, Handle(), aExtensionName);
   1.807 +	TInt r = SendReceive(EFsRemoveExtension,TIpcArgs(&aExtensionName));
   1.808 +
   1.809 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemoveExtensionReturn, MODULEUID, r);
   1.810 +	return r;
   1.811 +	}
   1.812 +
   1.813 +
   1.814 +
   1.815 +
   1.816 +EFSRV_EXPORT_C TInt RFs::ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos)
   1.817 +/**
   1.818 +Gets the name of the extension on the specified drive at the specified position
   1.819 +in the extension hierarchy.
   1.820 +			 
   1.821 +@param aExtensionName  On successful return, contains the name of the extension.
   1.822 +@param aDrive          The drive for which the extension name is required.
   1.823 +@param aPos            The position of the extension in the extension hierarchy.
   1.824 +
   1.825 +@return KErrNone, if successful;
   1.826 +        KErrNotFound if the extension name is not found;
   1.827 +*/
   1.828 +	{
   1.829 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsExtensionName, MODULEUID, Handle(), aExtensionName, aDrive, aPos);
   1.830 +	TInt r = SendReceive(EFsExtensionName,TIpcArgs(&aExtensionName,aDrive,aPos));
   1.831 +
   1.832 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsExtensionNameReturn, MODULEUID, r);
   1.833 +	return r;
   1.834 +	}
   1.835 +
   1.836 +
   1.837 +
   1.838 +
   1.839 +EFSRV_EXPORT_C TInt RFs::RemountDrive(TInt aDrive,const TDesC8* aMountInfo,TUint aFlags)
   1.840 +/**
   1.841 +Forces a remount of the specified drive.
   1.842 +
   1.843 +@param aDrive     The drive for which a remount is to be forced.
   1.844 +@param aMountInfo Information passed down to the media driver. The meaning of
   1.845 +                  this information depends on the media driver, for example,
   1.846 +                  keys for secure areas.
   1.847 +@param aFlags     When the flag is set to
   1.848 +                  0x00000001 - Used to simulate ejecting and re-inserting the media.
   1.849 +                  0x80000000 - used to force the media driver for the specified logical
   1.850 +                               drive to be closed and reopened.
   1.851 +
   1.852 +@return KErrNone if successful, otherwise one of
   1.853 +        the other system wide error codes.
   1.854 +*/
   1.855 +	{
   1.856 +	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsRemountDrive, MODULEUID, Handle(), aDrive, aMountInfo, aFlags);
   1.857 +	TInt r = SendReceive(EFsRemountDrive,TIpcArgs(aDrive,aMountInfo,aFlags));
   1.858 +
   1.859 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemountDriveReturn, MODULEUID, r);
   1.860 +	return r;
   1.861 +	}
   1.862 +
   1.863 +
   1.864 +
   1.865 +EFSRV_EXPORT_C void RFs::NotifyChange(TNotifyType aType,TRequestStatus& aStat)
   1.866 +/**
   1.867 +Requests a notification of change to files or directories.
   1.868 +
   1.869 +Changes are notified either:
   1.870 +
   1.871 +1. following any change in the file system
   1.872 +
   1.873 +or
   1.874 +
   1.875 +2. only following the addition or deletion of a directory entry, or after
   1.876 +   a disk has been formatted or changed.
   1.877 + 
   1.878 +Such notification is useful for programs that maintain displays
   1.879 +of file lists which must be dynamically updated. The alternative is to do
   1.880 +no updating, or to perform periodic monitoring for change, which
   1.881 +is inefficient.
   1.882 +
   1.883 +This is an asynchronous request and, as such, results in precisely one signal
   1.884 +to the request status passed as a parameter. To avoid missing any change, this
   1.885 +request should be issued before the first file list is constructed. When
   1.886 +the request completes, a new request should be issued before the next file
   1.887 +list is constructed. When the file server session is
   1.888 +closed, this request is implicitly cancelled.
   1.889 +
   1.890 +Call NotifyChangeCancel() to explicitly cancel a notification request.
   1.891 +
   1.892 +@param aType Indicates the kind of change that should result in notification.
   1.893 +			 For example:
   1.894 +			 ENotifyEntry causes notification only when an entry is added or
   1.895 +             deleted, or when a disk is formatted or changed;
   1.896 +             ENotifyAll causes notification following any type of change, such
   1.897 +             as when a file is written to, or when a file's attributes
   1.898 +             are changed.
   1.899 +@param aStat The request status.
   1.900 +             This is set to KErrNone on completion, otherwise one of the other
   1.901 +             system-wide error codes.
   1.902 +
   1.903 +*/
   1.904 +	{
   1.905 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange1, MODULEUID, Handle(), aType, &aStat);
   1.906 +	aStat=KRequestPending;
   1.907 +	// for backward compatibility
   1.908 +	TNotifyType type = (aType == 0 ? ENotifyEntry : aType);
   1.909 +	RSessionBase::SendReceive(EFsNotifyChange, TIpcArgs(type,&aStat) , aStat );
   1.910 +	//This call is to synchronise with the file server when this functions stack varibles can go out of scope
   1.911 +	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(-1));		
   1.912 +
   1.913 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange1Return, MODULEUID);
   1.914 +	}
   1.915 +
   1.916 +
   1.917 +
   1.918 +
   1.919 +EFSRV_EXPORT_C void RFs::NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName)
   1.920 +/**
   1.921 +Requests a notification of change to files or directories, allowing
   1.922 +a directory/file path to be specified.
   1.923 +
   1.924 +Changes are notified either:
   1.925 +
   1.926 +1. following any change in the file system
   1.927 +
   1.928 +or
   1.929 +
   1.930 +2. only following the addition or deletion of a directory entry, or after
   1.931 +   a disk has been formatted or changed.
   1.932 + 
   1.933 +Such notification is useful for programs that maintain displays
   1.934 +of file lists which must be dynamically updated. The alternative is to do
   1.935 +no updating, or to perform periodic monitoring for change, which
   1.936 +is inefficient.
   1.937 +
   1.938 +This is an asynchronous request and, as such, results in precisely one signal
   1.939 +to the request status passed as a parameter. To avoid missing any change, this
   1.940 +request should be issued before the first file list is constructed. When
   1.941 +the request completes, a new request should be issued before the next file
   1.942 +list is constructed. When the file server session is
   1.943 +closed, this request is implicitly cancelled.
   1.944 +
   1.945 +Call NotifyChangeCancel() to explicitly cancel a notification request.
   1.946 +
   1.947 +@param aType     Indicates the kind of change that should result in
   1.948 +                 notification. For example:
   1.949 +			     ENotifyEntry causes notification only when an entry is added
   1.950 +			     or deleted, or when a disk is formatted or changed;
   1.951 +                 ENotifyAll causes notification following any type of change,
   1.952 +                 such as when a file is written to, or when a file's attributes
   1.953 +                 are changed.
   1.954 +@param aStat     The request status.
   1.955 +                 This is set to KErrNone on completion, otherwise one of
   1.956 +                 the other system-wide error codes.
   1.957 +@param aPathName The directory or file for which notification is required. By
   1.958 +                 specifying a drive as a wildcard, for example
   1.959 +                 "?:\\Resource\\apps\\", or
   1.960 +				 "*:\\Resource\\apps\\", a client can ask to be notified of changes
   1.961 +				 to a given directory on any drive.
   1.962 +				 As with all directory paths aPathName must be terminated with '\\',
   1.963 +				 Please refer to "Structure of paths and filenames" section in the
   1.964 +				 Symbian OS Library.
   1.965 +
   1.966 +@capability Dependent If aName is /Sys then AllFiles capability is required.
   1.967 +@capability Dependent If aName begins with /Private and does not match this process' SID
   1.968 +					  then AllFiles capability is required.
   1.969 +
   1.970 +*/
   1.971 +	{
   1.972 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange2, MODULEUID, Handle(), (TUint) aType, (TUint) &aStat, aPathName);
   1.973 +	aStat=KRequestPending;
   1.974 +	// for backward compatibility
   1.975 +	TNotifyType type = (aType == 0 ? ENotifyEntry : aType);
   1.976 +	RSessionBase::SendReceive(EFsNotifyChangeEx,TIpcArgs(type,&aPathName,&aStat),aStat);
   1.977 +	//This call is to synchronise with the file server when this functions stack varibles can go out of scope
   1.978 +	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(-1));
   1.979 +
   1.980 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChange2Return, MODULEUID);
   1.981 +	}
   1.982 +
   1.983 +
   1.984 +
   1.985 +
   1.986 +EFSRV_EXPORT_C void RFs::NotifyChangeCancel()
   1.987 +/**
   1.988 +Cancels all outstanding requests for notification of change
   1.989 +to files or directories.
   1.990 +
   1.991 +All outstanding requests complete with KErrCancel.
   1.992 +
   1.993 +Note that this is a synchronous function.
   1.994 +
   1.995 +*/
   1.996 +	{
   1.997 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel1, MODULEUID, Handle());
   1.998 +	RSessionBase::SendReceive(EFsNotifyChangeCancel);
   1.999 +
  1.1000 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel1Return, MODULEUID);
  1.1001 +	}
  1.1002 +
  1.1003 +
  1.1004 +
  1.1005 +
  1.1006 +EFSRV_EXPORT_C void RFs::NotifyChangeCancel(TRequestStatus& aStat)
  1.1007 +/**
  1.1008 +Cancels the specific request for notification of change
  1.1009 +to files or directories.
  1.1010 +
  1.1011 +The outstanding request completes with KErrCancel.
  1.1012 +
  1.1013 +Note that this is an asynchronous function.
  1.1014 +
  1.1015 +@param aStat The request status object associated with the request
  1.1016 +             to be cancelled. Note that the function does not change
  1.1017 +             this parameter.
  1.1018 +
  1.1019 +*/
  1.1020 +	{
  1.1021 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel2, MODULEUID, Handle(), &aStat);
  1.1022 +	if (aStat==KRequestPending)			//	May be better to ASSERT this?
  1.1023 +		SendReceive(EFsNotifyChangeCancelEx,TIpcArgs(&aStat));
  1.1024 +
  1.1025 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyChangeCancel2Return, MODULEUID);
  1.1026 +	}
  1.1027 +
  1.1028 +
  1.1029 +
  1.1030 +
  1.1031 +EFSRV_EXPORT_C void RFs::NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat)
  1.1032 +/**
  1.1033 +Requests notification when the free disk space on the specified
  1.1034 +drive crosses the specified threshold value.
  1.1035 +
  1.1036 +The threshold is crossed if free disk space increases to a value above
  1.1037 +the threshold value or decreases to a value below the threshold value.
  1.1038 +
  1.1039 +This is an asynchronous request that completes if any of the
  1.1040 +following events occur:
  1.1041 +
  1.1042 +1. the threshold is crossed 
  1.1043 +
  1.1044 +2. any drive is formatted 
  1.1045 +
  1.1046 +3. there is a media change on any socket 
  1.1047 +
  1.1048 +4. power up 
  1.1049 +
  1.1050 +5. the scandrive utility is run on any drive
  1.1051 +
  1.1052 +5. the specified threshold value is outside its limits 
  1.1053 +
  1.1054 +7. the outstanding request is cancelled. 
  1.1055 +
  1.1056 +Note that free disk space notification is not supported for
  1.1057 +drives using remote file systems.
  1.1058 +
  1.1059 +@param aThreshold The threshold value. This must be greater than zero and less
  1.1060 +                  than the total size of the disk.
  1.1061 +@param aDrive     The drive number. This is an explicit drive defined by one of
  1.1062 +				  the TDriveNumber enum values or the value
  1.1063 +				  KDefaultDrive. If KDefaultDrive is specified, then
  1.1064 +                  the drive monitored is the session path drive.
  1.1065 +@param aStat      The request status object. On request completion, contains:
  1.1066 +				  KErrNone, if the threshold value is crossed, if any drive is
  1.1067 +                  formatted, if there is a media change on any socket, if there is a power up or
  1.1068 +				  if the scandrive utility is run on any drive;
  1.1069 +				  KErrCancel, if the outstanding request is cancelled by a call to
  1.1070 +                  NotifyDiskSpaceCancel();
  1.1071 +                  KErrArgument, if the threshold value is outside its limits.
  1.1072 +
  1.1073 +@see TDriveNumber
  1.1074 +*/
  1.1075 +	{
  1.1076 +	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpace, MODULEUID, 
  1.1077 +		Handle(), I64LOW(aThreshold),I64HIGH(aThreshold), aDrive,(TUint) &aStat);
  1.1078 +	aStat=KRequestPending;
  1.1079 +	TPtrC8 tBuf((TUint8*)&aThreshold,sizeof(TInt64));
  1.1080 +	RSessionBase::SendReceive(EFsNotifyDiskSpace,TIpcArgs(&tBuf,aDrive,&aStat), aStat);
  1.1081 +	//This call is to synchronise with the driver thread as corresponding cancel function (NotifyDiskSpaceCancel)
  1.1082 +	//is synchronous, so it can complete before this notify request has even been added to TDiskSpaceQue.
  1.1083 +	//This call guarantees that the notify request has been added to queue.
  1.1084 +	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive));
  1.1085 +
  1.1086 +
  1.1087 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceReturn, MODULEUID);
  1.1088 +	}
  1.1089 +
  1.1090 +
  1.1091 +
  1.1092 +
  1.1093 +EFSRV_EXPORT_C void RFs::NotifyDiskSpaceCancel(TRequestStatus& aStat)
  1.1094 +/**
  1.1095 +Cancels a specific outstanding request for free disk space
  1.1096 +notification.
  1.1097 +
  1.1098 +The outstanding request completes with KErrCancel.
  1.1099 +
  1.1100 +@param aStat The request status object identified with the original
  1.1101 +			 notification request.
  1.1102 +*/
  1.1103 +	{
  1.1104 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel1, MODULEUID, Handle(), &aStat);
  1.1105 +	
  1.1106 +	if(aStat==KRequestPending)
  1.1107 +		SendReceive(EFsNotifyDiskSpaceCancel,TIpcArgs(&aStat));
  1.1108 +
  1.1109 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel1Return, MODULEUID);
  1.1110 +	}
  1.1111 +
  1.1112 +
  1.1113 +
  1.1114 +
  1.1115 +EFSRV_EXPORT_C void RFs::NotifyDiskSpaceCancel()
  1.1116 +/**
  1.1117 +Cancels all outstanding requests for free disk space
  1.1118 +notification.
  1.1119 +
  1.1120 +Outstanding requests complete with KErrCancel.
  1.1121 +*/
  1.1122 +	{
  1.1123 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel2, MODULEUID, Handle());
  1.1124 +	SendReceive(EFsNotifyDiskSpaceCancel,TIpcArgs(NULL));
  1.1125 +
  1.1126 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDiskSpaceCancel2Return, MODULEUID);
  1.1127 +	}
  1.1128 +
  1.1129 +
  1.1130 +
  1.1131 +
  1.1132 +EFSRV_EXPORT_C TInt RFs::DriveList(TDriveList& aList) const
  1.1133 +/**
  1.1134 +Gets a list of the available (not remote and non hidden) drives.
  1.1135 +
  1.1136 +The drive list consists of an array of 26 bytes. Array index zero corresponds
  1.1137 +to drive A, index one equals B etc.
  1.1138 +
  1.1139 +Each byte with a non zero value signifies that the corresponding drive is available
  1.1140 +to the system. In the case of removable media, RFs::Drive should be used to determine
  1.1141 +whether the media is inserted or not.
  1.1142 +
  1.1143 +The local file system always reserves drive letters A through I.
  1.1144 +Drive letter Z is always used for the ROM which means that letters J through Y
  1.1145 +are available to be used by SetSubst() or for redirecting.				
  1.1146 +
  1.1147 +@param aList On return, contains a list of drive attributes (only the first 8 bits) for the available non-remote and non-hidden drives.
  1.1148 +
  1.1149 +@return KErrNone, successful, otherwise one of the other system-wide error codes.
  1.1150 +*/
  1.1151 +	{
  1.1152 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList1, MODULEUID, Handle());
  1.1153 +	TInt r = SendReceive(EFsDriveList,TIpcArgs(&aList, KDriveAttExclude|KDriveAttRemote|KDriveAttHidden));
  1.1154 +
  1.1155 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList1Return, MODULEUID, r);
  1.1156 +	return r;
  1.1157 +	}
  1.1158 +
  1.1159 +
  1.1160 +
  1.1161 +EFSRV_EXPORT_C TInt RFs::DriveList(TDriveList& aList, TUint aFlags) const
  1.1162 +/**
  1.1163 +Gets a list of the available drives that match a combination of drive attributes,specified in aFlags.
  1.1164 +This combination may include,exclude or exclusively specify the attributes that that drives to be returned 
  1.1165 +should match.
  1.1166 +
  1.1167 +The drive list consists of an array of 26 bytes. Array index zero corresponds
  1.1168 +to drive A, index one equals B etc.
  1.1169 +
  1.1170 +Each byte with a non zero value signifies that the corresponding drive is available
  1.1171 +to the system. In the case of removable media, RFs::Drive should be used to determine
  1.1172 +whether the media is inserted or not.
  1.1173 +
  1.1174 +The local file system always reserves drive letters A through I.
  1.1175 +Drive letter Z is always used for the ROM which means that letters J through Y
  1.1176 +are available to be used by SetSubst() or for redirecting.				
  1.1177 +
  1.1178 +@param aList On return, contains a list of available drives that qualify aFlags.
  1.1179 +
  1.1180 +@param aFlags A combination of drive attributes that drives to be returned must qualify. 
  1.1181 +
  1.1182 +@return KErrNone, successful, otherwise one of the other system-wide error codes;
  1.1183 +		KErrArgument, If aFlags contains an invalid attribute combination.
  1.1184 +*/
  1.1185 +	{
  1.1186 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList2, MODULEUID, Handle(), aFlags);
  1.1187 +	TInt r = SendReceive(EFsDriveList,TIpcArgs(&aList,aFlags));
  1.1188 +
  1.1189 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDriveList2Return, MODULEUID, r);
  1.1190 +	return r;
  1.1191 +	}
  1.1192 +
  1.1193 +
  1.1194 +
  1.1195 +
  1.1196 +EFSRV_EXPORT_C TInt RFs::Drive(TDriveInfo& anInfo,TInt aDrive) const
  1.1197 +/**
  1.1198 +Gets information about a drive and the medium mounted on it.
  1.1199 +
  1.1200 +Note that Volume() can also be used to give information about the drive and
  1.1201 +the volume mounted on it. These two functions are separate because, while
  1.1202 +the characteristics of a drive cannot change, those of a
  1.1203 +volume can, by mounting different media, reformatting etc.
  1.1204 +			 
  1.1205 +@param anInfo On return, contains information describing the drive
  1.1206 +			  and the medium mounted on it. The value of TDriveInfo::iType
  1.1207 +			  shows whether the drive contains media.
  1.1208 +@param aDrive The drive for which information is requested.
  1.1209 +              Specify KDefaultDrive for the session default drive.
  1.1210 +			  Specify a drive in the range EDriveA to EDriveZ for drives
  1.1211 +			  A to Z respectively.
  1.1212 +
  1.1213 +@return       KErrNone, if successful, otherwise one of the other
  1.1214 +              system-wide error codes.
  1.1215 +			 
  1.1216 +@see RFs::Volume
  1.1217 +*/
  1.1218 +	{
  1.1219 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsDrive, MODULEUID, Handle(), aDrive);
  1.1220 +
  1.1221 +	TPckg<TDriveInfo> m(anInfo);
  1.1222 +	TInt r = SendReceive(EFsDrive,TIpcArgs(&m,aDrive));
  1.1223 +
  1.1224 +	TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFsDriveReturn, MODULEUID, r, anInfo.iDriveAtt, anInfo.iMediaAtt, anInfo.iType);
  1.1225 +	return r;
  1.1226 +	}
  1.1227 +
  1.1228 +
  1.1229 +
  1.1230 +
  1.1231 +EFSRV_EXPORT_C TInt RFs::Volume(TVolumeInfo& aVol,TInt aDrive) const
  1.1232 +/**
  1.1233 +Gets volume information for a formatted device.
  1.1234 +
  1.1235 +This function provides additional information to that given by Drive(),
  1.1236 +including the volume label, if set, and the amount of free space on the
  1.1237 +disk.
  1.1238 +
  1.1239 +Note, use Drive() to get information about the drive without reference to
  1.1240 +a volume. These two functions are separate because, while the characteristics
  1.1241 +of a drive cannot change, those of a volume can, by mounting different media,
  1.1242 +reformatting etc. A volume may not even be present if the media is removable.
  1.1243 +
  1.1244 +@param aVol   On return, contains the volume information.
  1.1245 +@param aDrive The drive which contains the media for which volume information is to be displayed.
  1.1246 +              Specify a drive in the range EDriveA to EDriveZ for drives A to Z respectively. 
  1.1247 +              The default drive is the session default drive KDefaultDrive.
  1.1248 +
  1.1249 +@return KErrNone, if successful;
  1.1250 +        KErrNotReady, if the drive contains no media;
  1.1251 +        otherwise one of the other system-wide error codes.
  1.1252 +			
  1.1253 +@see RFs::Drive
  1.1254 +*/
  1.1255 +	{
  1.1256 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolume1, MODULEUID, Handle(), aDrive);
  1.1257 +	TPckg<TVolumeInfo> v(aVol);
  1.1258 +    TInt r = SendReceive(EFsVolume,TIpcArgs(&v,aDrive,NULL));
  1.1259 +
  1.1260 +	TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFsVolume1Return, MODULEUID, 
  1.1261 +		r, aVol.iUniqueID, I64LOW(aVol.iSize), I64HIGH(aVol.iSize),
  1.1262 +		I64LOW(aVol.iFree), I64HIGH(aVol.iFree), aVol.iFileCacheFlags);
  1.1263 +	return r;
  1.1264 +	}
  1.1265 +
  1.1266 +/**
  1.1267 +Gets volume information for a formatted device asynchronously.
  1.1268 +@see TInt RFs::Volume(TVolumeInfo& aVol,TInt aDrive) for the synchronous version.
  1.1269 +
  1.1270 +"Asynchronously" corresponds to the amount of free space on the volume in TVolumeInfo::iFree.
  1.1271 +I.e. this function returns the _current_ amount of free space on the volume, which can be changing due to some
  1.1272 +filesystems' activities. For example, some filesystems can be performing free space calculations in the background. 
  1.1273 +Comparing to the RFs::Volume(TVolumeInfo& aVol,TInt aDrive), this method doesn't block the client until background filesystem 
  1.1274 +activity finishes, which can be useful in some situations. 
  1.1275 +
  1.1276 +@param aVol   On return, contains the volume information with the _current_ value in the TVolumeInfo::iFree.
  1.1277 +@param aDrive Drive number to query. Specify a drive in the range EDriveA to EDriveZ for drives A to Z respectively. 
  1.1278 +@param aStat  request status. At present is used just for indication of the asynchronous version and gets immediately completed, so there is no reason to analyse its value.                                                                                                                      
  1.1279 +			
  1.1280 +@publishedPartner
  1.1281 +@prototype
  1.1282 +*/
  1.1283 +EFSRV_EXPORT_C void RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const
  1.1284 +    {
  1.1285 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsVolume2, MODULEUID, Handle(), aDrive, &aStat);
  1.1286 +	TPckg<TVolumeInfo> v(aVol);
  1.1287 +    aStat=KRequestPending;
  1.1288 +    RSessionBase::SendReceive(EFsVolume,TIpcArgs(&v,aDrive,&aStat), aStat);
  1.1289 +
  1.1290 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsVolume2Return, MODULEUID);
  1.1291 +    }
  1.1292 +
  1.1293 +
  1.1294 +EFSRV_EXPORT_C TInt RFs::SetVolumeLabel(const TDesC& aName,TInt aDrive)
  1.1295 +/**
  1.1296 +Sets the label for a volume.
  1.1297 +
  1.1298 +Note that similar to file names, volume labels can be set with unicode characters.
  1.1299 +However it may not be recognized properly if correct code page is not
  1.1300 +loaded or it is mounted onto a system that does not support DBCS volume
  1.1301 +labels
  1.1302 +
  1.1303 +@param aName  The volume label.
  1.1304 +@param aDrive The drive containing the media whose label is to be set.
  1.1305 +	          Specify a drive in the range EDriveA to EDriveZ for
  1.1306 +			  drives A to Z.
  1.1307 +              The default drive is the session default drive KDefaultDrive.
  1.1308 +
  1.1309 +@return KErrNone, if successful;
  1.1310 +        KErrNotReady, if the drive contains no media;
  1.1311 +        otherwise one of the other system-wide error codes.
  1.1312 +
  1.1313 +@capability DiskAdmin
  1.1314 +
  1.1315 +@see TDriveNumber
  1.1316 +@see TVolumeInfo::iName
  1.1317 +@see RFs::Volume
  1.1318 +*/
  1.1319 +	{
  1.1320 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetVolumeLabel, MODULEUID, 
  1.1321 +		Handle(), aName, aDrive);
  1.1322 +
  1.1323 +	TInt r = SendReceive(EFsSetVolume,TIpcArgs(&aName,aDrive));
  1.1324 +
  1.1325 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetVolumeLabelReturn, MODULEUID, r);
  1.1326 +	return r;
  1.1327 +	}
  1.1328 +
  1.1329 +
  1.1330 +
  1.1331 +
  1.1332 +EFSRV_EXPORT_C TInt RFs::Subst(TDes& aPath,TInt aDrive) const
  1.1333 +/**
  1.1334 +Gets the path assigned to a drive letter by an earlier call to SetSubst().
  1.1335 +
  1.1336 +To find out whether a drive letter has been substituted, first get the drive
  1.1337 +information, using Drive(), and then test the value of the KDriveAttSubsted bit
  1.1338 +provided by TDriveInfo::iDriveAtt.
  1.1339 +
  1.1340 +@param aPath  On return, contains the path which has been assigned to the
  1.1341 +              drive. If the drive letter has not been substituted, this argument
  1.1342 +              returns an empty descriptor.
  1.1343 +@param aDrive The drive which is the subject of the enquiry. Specify a number
  1.1344 +			  in the range 0 (EDriveA) to 25 (>EDriveZ) for drives
  1.1345 +			  A to Z. The default drive is the session default
  1.1346 +              drive KDefaultDrive.
  1.1347 +              
  1.1348 +@return KErrNone, if successful, otherwise one of the other
  1.1349 +        system-wide error codes.
  1.1350 +
  1.1351 +@see RFs::SetSubst
  1.1352 +@see TDriveInfo
  1.1353 +@see RFs::Drive
  1.1354 +*/
  1.1355 +	{
  1.1356 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSubst, MODULEUID, Handle(), aPath, aDrive);
  1.1357 +	TInt r = SendReceive(EFsSubst,TIpcArgs(&aPath,aDrive));
  1.1358 +
  1.1359 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSubstReturn, MODULEUID, r);
  1.1360 +	return r;
  1.1361 +	}
  1.1362 +
  1.1363 +
  1.1364 +
  1.1365 +
  1.1366 +EFSRV_EXPORT_C TInt RFs::SetSubst(const TDesC& aPath,TInt aDrive)
  1.1367 +/**
  1.1368 +Assigns a path to a drive letter.
  1.1369 +
  1.1370 +Whenever that drive letter is used, it will be translated into a reference
  1.1371 +to the path specified here. To	clear a drive substitution, specify an empty
  1.1372 +descriptor for aPath. 
  1.1373 +
  1.1374 +Note that the substituted path is text-only. Its components need not
  1.1375 +be syntactically correct, nor must they be valid at the time the substitution
  1.1376 +is set. Any component may be deleted, removed or unmounted while the
  1.1377 +substitution is set.
  1.1378 +
  1.1379 +@param aPath  The path to be assigned to the drive letter. If a drive letter
  1.1380 +			  is specified in the path, it must not itself be substituted or
  1.1381 +			  redirected, or the function will return an error. If no drive is
  1.1382 +			  specified, the drive contained in the default session path is
  1.1383 +			  used, and if no path is specified, the default session path is
  1.1384 +			  used. If a filename or extension is included in the  path,
  1.1385 +			  the function will return an error. Therefore, the final component
  1.1386 +			  in the path must have a trailing backslash to indicate that it is
  1.1387 +			  a directory.
  1.1388 +			 
  1.1389 +@param aDrive The drive to which a path is to be assigned. Specify a number
  1.1390 +			  in the range 0 (EDriveA) to 25 (EDriveZ) for drives
  1.1391 +			  A to Z. Must not be local, ROM, or redirected, otherwise an
  1.1392 +              error is returned. May be substituted, but only if the function
  1.1393 +              is being used	to clear the substitution. If the same drive is
  1.1394 +              specified in the path, the function will return an error.
  1.1395 +              The default drive is the session default drive
  1.1396 +			  KDefaultDrive.
  1.1397 +			 
  1.1398 +@return KErrNone, if successful; otherwise one of the other	system-wide
  1.1399 +        error codes.
  1.1400 +
  1.1401 +@capability DiskAdmin
  1.1402 +@capability Dependent If aPath is /Sys then Tcb capability is required.
  1.1403 +@capability Dependent If aPath begins with /Private and does not match this process' SID
  1.1404 +					  then AllFiles capability is required.
  1.1405 +@capability Dependent If aPath is /Resource then Tcb capability is required.
  1.1406 +*/
  1.1407 +	{
  1.1408 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetSubst, MODULEUID, Handle(), aPath, aDrive);
  1.1409 +	TInt r = SendReceive(EFsSetSubst,TIpcArgs(&aPath,aDrive));
  1.1410 +
  1.1411 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSubstReturn, MODULEUID, r);
  1.1412 +	return r;
  1.1413 +	}
  1.1414 +
  1.1415 +
  1.1416 +
  1.1417 +
  1.1418 +EFSRV_EXPORT_C TInt RFs::RealName(const TDesC& aName,TDes& aResult) const
  1.1419 +/**
  1.1420 +Gets the real name of a file.
  1.1421 +
  1.1422 +This is used in circumstances where a file system needs to
  1.1423 +mangle Symbian OS natural names so that it can store them on that file
  1.1424 +system.
  1.1425 +
  1.1426 +@param aName   Contains the name by which the file is normally referred.
  1.1427 +@param aResult On return, contains the real name of the file, comprising the
  1.1428 +               full path, including the drive letter.
  1.1429 +
  1.1430 +@return KErrNone if successful, otherwise one of the other
  1.1431 +        system-wide error codes.
  1.1432 +
  1.1433 +@capability Dependent If aName is /Sys then AllFiles capability is required.
  1.1434 +@capability Dependent If aName begins with /Private and does not match this process' SID
  1.1435 +					  then AllFiles capability is required.
  1.1436 +
  1.1437 +*/
  1.1438 +	{
  1.1439 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRealName, MODULEUID, Handle(), aName);
  1.1440 +	TInt r = SendReceive(EFsRealName,TIpcArgs(&aName,&aResult));
  1.1441 +
  1.1442 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRealNameReturn, MODULEUID, r, aResult);
  1.1443 +	return r;
  1.1444 +	}
  1.1445 +
  1.1446 +
  1.1447 +
  1.1448 +
  1.1449 +/**
  1.1450 +Gets the serial number of media.
  1.1451 +
  1.1452 +Only local drive is allowed. Substed drive number will return KErrNotSupported.
  1.1453 +
  1.1454 +@param aSerialNum Contains serial number on successful return.
  1.1455 +@param aDrive     Drive number.
  1.1456 +
  1.1457 +@return KErrNone            if successful;
  1.1458 +        KErrNotSupported    if media doesn't support serial number (e.g. substed drives);
  1.1459 +        KErrBadName         if drive number is invalid;
  1.1460 +        otherwise one of system-wide error codes.
  1.1461 +
  1.1462 +@see TMediaSerialNumber
  1.1463 +*/
  1.1464 +EFSRV_EXPORT_C TInt RFs::GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive)
  1.1465 +    {
  1.1466 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetMediaSerialNumber, MODULEUID, Handle(), aDrive);
  1.1467 +    TInt r = SendReceive(EFsGetMediaSerialNumber, TIpcArgs(&aSerialNum, aDrive));
  1.1468 +
  1.1469 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetMediaSerialNumberReturn, MODULEUID, r, aSerialNum);
  1.1470 +	return r;
  1.1471 +    }
  1.1472 +
  1.1473 +
  1.1474 +
  1.1475 +
  1.1476 +EFSRV_EXPORT_C TInt RFs::SessionPath(TDes& aPath) const
  1.1477 +/**
  1.1478 +Gets the session path.
  1.1479 +
  1.1480 +When a client connects to the file server, its session path is initialised to
  1.1481 +the system default path. The session path of an existing client can only be
  1.1482 +changed by this function.
  1.1483 +
  1.1484 +@param aPath On return, contains the session path, including a trailing
  1.1485 +             backslash.
  1.1486 +
  1.1487 +@return KErrNone if successful, otherwise one of the other
  1.1488 +        system-wide error codes.
  1.1489 +*/
  1.1490 +	{
  1.1491 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsSessionPath, MODULEUID, Handle());
  1.1492 +	TInt r = SendReceive(EFsSessionPath,TIpcArgs(&aPath));
  1.1493 +
  1.1494 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSessionPathReturn, MODULEUID, r, aPath);
  1.1495 +	return r;
  1.1496 +	}
  1.1497 +
  1.1498 +
  1.1499 +
  1.1500 +
  1.1501 +EFSRV_EXPORT_C TInt RFs::SetSessionPath(const TDesC& aPath)
  1.1502 +/**
  1.1503 +Sets the session path for the current file server client.
  1.1504 +
  1.1505 +When the client first connects to the file server, its session path
  1.1506 +is initialised to the system default path.
  1.1507 +
  1.1508 +Note that the session path is text-only. It does not cause any locking.
  1.1509 +Thus, although the path must be syntactically correct, its components
  1.1510 +do not need to be valid at the time the path is set, and any component may be
  1.1511 +deleted, removed or unmounted while the path is set.
  1.1512 +
  1.1513 +@param aPath The new session path. Consists of a drive and path. Normally, a
  1.1514 +             drive should be specified, but if not, the drive specified in
  1.1515 +             the existing session path is preserved. If a file is specified,
  1.1516 +             then the function fails and returns an error code. Therefore,
  1.1517 +             the final component in the path must have a trailing backslash
  1.1518 +             to indicate that it is a directory. All components of the
  1.1519 +             path must be syntactically correct, for example, wildcard
  1.1520 +             characters and double backslashes are not allowed in any
  1.1521 +             part of it.
  1.1522 +
  1.1523 +@return KErrNone if successful, otherwise one of the other
  1.1524 +        system-wide error codes.
  1.1525 +
  1.1526 +@capability Dependent If aPath is /Sys then AllFiles capability is required.
  1.1527 +@capability Dependent If aPath begins with /Private and does not match this process' SID
  1.1528 +					  then AllFiles capability is required.
  1.1529 +
  1.1530 +*/
  1.1531 +	{
  1.1532 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionPath, MODULEUID, Handle(), aPath);
  1.1533 +	TInt r = SendReceive(EFsSetSessionPath,TIpcArgs(&aPath));
  1.1534 +
  1.1535 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetSessionPathReturn, MODULEUID, r);
  1.1536 +	return r;
  1.1537 +	}
  1.1538 +
  1.1539 +
  1.1540 +
  1.1541 +
  1.1542 +
  1.1543 +/**
  1.1544 +Makes a directory.
  1.1545 +
  1.1546 +It should be a sub-directory of an existing	directory and its name should be
  1.1547 +unique within its parent directory, otherwise the function returns error code KErrAlreadyExists.
  1.1548 +				
  1.1549 +Note that if a filename is specified in the argument, it is	ignored.
  1.1550 +Therefore, there should be a trailing backslash after the final
  1.1551 +directory name in the argument to indicate that it is a directory, not a filename. 
  1.1552 +
  1.1553 +For example, following code will create directory "C:\\DIR1\\"
  1.1554 +   
  1.1555 +@code
  1.1556 +fs.MkDir(_L("C:\\DIR1\\"));
  1.1557 +@endcode
  1.1558 +
  1.1559 +The last line in the following example will result in KErrAlreadyExists because "DIR2" doesn't have a trailing backslash, 
  1.1560 +therefore is considered as a file name and discarded. Directory "C:\\DIR1\\" has already been created.
  1.1561 +
  1.1562 +@code
  1.1563 +fs.MkDir(_L("C:\\DIR1\\"));     // shall create DIR1 in the root directory
  1.1564 +fs.MkDir(_L("C:\\DIR1\\DIR2")); // No trailing backslash, fails with KErrAlreadyExists
  1.1565 +@endcode
  1.1566 +
  1.1567 +This example will always fail because "DIR1" doesn't have a trailing backslash and discarded while the root
  1.1568 +directory always exists. 
  1.1569 +
  1.1570 +@code
  1.1571 +fs.MkDir(_L("C:\\DIR1"));  // No trailing backslash, will always fail with KErrAlreadyExists
  1.1572 +@endcode
  1.1573 +
  1.1574 +Note, the following case
  1.1575 +
  1.1576 +@code
  1.1577 +fs.MkDir(_L("C:\\example.txt\\"));	// would normally create a directory "c:\\example.txt\\" with KErrNone
  1.1578 +@endcode
  1.1579 + 
  1.1580 +But if there is a file named "example.txt", which exists at the same location, KErrAccessDenied is returned.    
  1.1581 +
  1.1582 +Note also that because this method can return an error code (eg. because
  1.1583 +the disk is full) before checking whether the path already exists, it
  1.1584 +is not appropriate to use it just to work out whether a path exists or not.
  1.1585 +
  1.1586 +See MkDirAll(), which may also create intermediate directories.
  1.1587 +
  1.1588 +@param aPath The name of the new directory. Any path components which are
  1.1589 +             not specified here will be taken from the session path.
  1.1590 +			 The directory name shall not contain wild cards ('?' or '*' characters) 
  1.1591 +			 and illegal characters like '<', '>', ':', '"', '/', '|' and '\000'.
  1.1592 +			 The directory name containing only whilte space characters 
  1.1593 +			 (See TChar::IsSpace()) is also illegal. 
  1.1594 +
  1.1595 +@return KErrNone if successful, otherwise one of the other
  1.1596 +        system-wide error codes. Even if another error code is returned,
  1.1597 +		(for example, if the disk is full) it is still possible that the 
  1.1598 +		path may already exist.
  1.1599 +
  1.1600 +@capability Dependent If aPath is /Sys then Tcb capability is required.
  1.1601 +@capability Dependent If aPath begins with /Private and does not match this process' SID
  1.1602 +					  then AllFiles capability is required.
  1.1603 +@capability Dependent If aPath is /Resource then Tcb capability is required.
  1.1604 +        
  1.1605 +@see RFs::MkDirAll       
  1.1606 +*/
  1.1607 +EFSRV_EXPORT_C TInt RFs::MkDir(const TDesC& aPath)
  1.1608 +	{
  1.1609 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMkDir, MODULEUID, Handle(), aPath);
  1.1610 +	TInt r = SendReceive(EFsMkDir,TIpcArgs(&aPath,NULL));
  1.1611 +
  1.1612 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirReturn, MODULEUID, r);
  1.1613 +	return r;
  1.1614 +	}
  1.1615 +
  1.1616 +
  1.1617 +
  1.1618 +
  1.1619 +
  1.1620 +/**
  1.1621 +Makes one or more directories.
  1.1622 +
  1.1623 +Any valid path component specified in aPath which does not already exist is
  1.1624 +created as a directory.
  1.1625 + 
  1.1626 +Note that if a filename is specified in the argument, it is	ignored.
  1.1627 +Therefore, there should be a trailing backslash after the final
  1.1628 +directory name in the argument to indicate that it is a directory, not a
  1.1629 +filename.
  1.1630 +
  1.1631 +See also notes on RFs::MkDir() about trailing backslashes in directory names.
  1.1632 +
  1.1633 +Note also that because this method can return an error code (eg. because
  1.1634 +the disk is full) before checking whether the path already exists, it
  1.1635 +is not appropriate to use it just to work out whether a path exists or not.
  1.1636 +		
  1.1637 +See MkDir(), which creates only a single new directory.
  1.1638 +
  1.1639 +@param aPath The path name specifiying the directory or directories to
  1.1640 +             create. If the function completes successfully, this path
  1.1641 +             identifies a valid	directory. Any path components which are not
  1.1642 +             specified here are taken from the session path.
  1.1643 +
  1.1644 +@return KErrNone if successful, otherwise one of the other
  1.1645 +        system-wide error codes. Even if another error code is returned,
  1.1646 +		(for example, if the disk is full) it is still possible that the 
  1.1647 +		path may already exist. 
  1.1648 +
  1.1649 +
  1.1650 +@capability Dependent If aPath is /Sys then Tcb capability is required.
  1.1651 +@capability Dependent If aPath begins with /Private and does not match this process' SID
  1.1652 +					  then AllFiles capability is required.
  1.1653 +@capability Dependent If aPath is /Resource then Tcb capability is required.
  1.1654 +
  1.1655 +@see RFs::MkDir
  1.1656 +*/
  1.1657 +EFSRV_EXPORT_C TInt RFs::MkDirAll(const TDesC& aPath)
  1.1658 +	{
  1.1659 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirAll, MODULEUID, Handle(), aPath);
  1.1660 +	TInt r = SendReceive(EFsMkDir,TIpcArgs(&aPath,TRUE));
  1.1661 +
  1.1662 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMkDirAllReturn, MODULEUID, r);
  1.1663 +	return r;
  1.1664 +	}
  1.1665 +
  1.1666 +
  1.1667 +
  1.1668 +
  1.1669 +EFSRV_EXPORT_C TInt RFs::RmDir(const TDesC& aPath)
  1.1670 +/**
  1.1671 +Removes a directory.
  1.1672 +
  1.1673 +The directory must be empty and cannot be the root directory. 
  1.1674 +
  1.1675 +Note that if a filename is specified in the argument, it is
  1.1676 +ignored. 
  1.1677 +
  1.1678 +For example, following code will result in directory "C:\\SRC\\" being removed as long as 
  1.1679 +it is empty, the existance of "ENTRY" will not be checked:
  1.1680 +
  1.1681 +@code
  1.1682 +fs.RmDir(_L("C:\\SRC\\ENTRY"));
  1.1683 +@endcode
  1.1684 +
  1.1685 +Similarly, following code will try to remove "C:\\SRC\\" instead of "C:\\SRC\DIR\\":
  1.1686 +@code
  1.1687 +fs.RmDir(_L("C:\\SRC\\DIR"));
  1.1688 +@endcode
  1.1689 +
  1.1690 +Therefore, there should be a trailing backslash after the final
  1.1691 +directory name in the argument to indicate that it is a directory, not a
  1.1692 +filename.
  1.1693 +
  1.1694 +See class CFileMan for information on deleting a
  1.1695 +non-empty directory and all of its contents.
  1.1696 +				
  1.1697 +@param aPath The path name of the directory to be removed. Any path	components
  1.1698 +             which are not specified here are taken from the session path. Only
  1.1699 +             the lowest-level directory identified is removed.
  1.1700 +
  1.1701 +@return KErrNone, if successful;
  1.1702 +        KErrInUse, if trying to remove a non-empty directory or root directory;
  1.1703 +        otherwise, one of the other system-wide error codes.
  1.1704 +              
  1.1705 +@capability Dependent If aPath is /Sys then Tcb capability is required.
  1.1706 +@capability Dependent If aPath begins with /Private and does not match this process' SID
  1.1707 +					  then AllFiles capability is required.
  1.1708 +@capability Dependent If aPath is /Resource then Tcb capability is required.
  1.1709 +
  1.1710 +@see CFileMan
  1.1711 +*/
  1.1712 +	{
  1.1713 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRmDir, MODULEUID, Handle(), aPath);
  1.1714 +	TInt r = SendReceive(EFsRmDir,TIpcArgs(&aPath));
  1.1715 +
  1.1716 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRmDirReturn, MODULEUID, r);
  1.1717 +	return r;
  1.1718 +	}
  1.1719 +
  1.1720 +
  1.1721 +
  1.1722 +
  1.1723 +void RFs::GetDirL(const TDesC& aName,const TUidType& aUidType,TUint aKey,CDir*& aFileList,RDir& aDir) const
  1.1724 +//
  1.1725 +// Create a dir array. Leave on any error.
  1.1726 +//
  1.1727 +	{
  1.1728 +	aFileList=NULL;
  1.1729 +	User::LeaveIfError(aDir.Open((RFs& )*this,aName,aUidType));
  1.1730 +	DoGetDirL(aKey,aFileList,aDir);
  1.1731 +	}
  1.1732 +
  1.1733 +void RFs::GetDirL(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList,RDir& aDir) const
  1.1734 +//
  1.1735 +// Create a dir array. Leave on any error.
  1.1736 +//
  1.1737 +	{
  1.1738 +
  1.1739 +	aFileList=NULL;
  1.1740 +	User::LeaveIfError(aDir.Open((RFs& )*this,aName,anAttMask));
  1.1741 +	DoGetDirL(aKey,aFileList,aDir);
  1.1742 +	}
  1.1743 +
  1.1744 +void RFs::GetDirL(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList,CDir*& aDirList,RDir& aDir) const
  1.1745 +//
  1.1746 +// Create a dir array. Leave on any error.
  1.1747 +//
  1.1748 +	{
  1.1749 +	
  1.1750 +	aDirList=NULL;
  1.1751 +	GetDirL(aName,anAttMask|KEntryAttDir,aKey,aFileList,aDir);
  1.1752 +	aFileList->ExtractL(!(anAttMask&KEntryAttDir),aDirList);
  1.1753 +	}
  1.1754 +
  1.1755 +void RFs::DoGetDirL(TUint aKey,CDir*& aFileList,RDir& aDir) const
  1.1756 +//
  1.1757 +// Create a dir array. Leave on any error.
  1.1758 +//
  1.1759 +	{
  1.1760 +
  1.1761 +	aFileList=CDir::NewL();
  1.1762 +	TInt r;
  1.1763 +	TEntryArray* pArray=new(ELeave) TEntryArray;
  1.1764 +	CleanupStack::PushL(pArray);
  1.1765 +	
  1.1766 +	TEntryArray& array=*pArray;
  1.1767 +	do
  1.1768 +		{
  1.1769 +		r=aDir.Read(array);
  1.1770 +		if (r==KErrNone || r==KErrEof)
  1.1771 +			{
  1.1772 +			TInt count=array.Count();
  1.1773 +			if (count==0)
  1.1774 +				break;
  1.1775 +			TInt i=0;
  1.1776 +			while (i<count)
  1.1777 +				aFileList->AddL(array[i++]);
  1.1778 +			}
  1.1779 +		}while (r==KErrNone);
  1.1780 +	
  1.1781 +	CleanupStack::PopAndDestroy();
  1.1782 +	if (!(r==KErrNone || r==KErrEof))
  1.1783 +		User::Leave(r);
  1.1784 +	aFileList->Compress();
  1.1785 +	if (aKey==ESortNone)
  1.1786 +		return;
  1.1787 +	
  1.1788 +	r=aFileList->Sort(aKey);
  1.1789 +	if (r!=KErrNone)
  1.1790 +		User::Leave(r);
  1.1791 +	}
  1.1792 +
  1.1793 +
  1.1794 +
  1.1795 +
  1.1796 +EFSRV_EXPORT_C TInt RFs::GetDir(const TDesC& aName,const TUidType& aUidType,TUint aKey,CDir*& aFileList) const
  1.1797 +/**
  1.1798 +Gets a filtered list of a directory's contents by UID type.
  1.1799 +
  1.1800 +The aUidType parameter determines which file entry types should be listed.
  1.1801 +The sort key determines the order in which they are listed.
  1.1802 +
  1.1803 +Notes:
  1.1804 +
  1.1805 +1. The function sets aFileList to NULL, and then allocates memory for it before
  1.1806 +   appending entries to the list. Therefore, aFileList should have no memory
  1.1807 +   allocated to it before this function is called, otherwise this memory
  1.1808 +   will become orphaned.
  1.1809 +   
  1.1810 +2. The caller of this function is responsible for deleting aFileList after
  1.1811 +   the function has returned.
  1.1812 +   
  1.1813 +@param aName     The name of the directory for which a listing is required.
  1.1814 +                 Wildcards may be used to specify particular files.
  1.1815 +@param aUidType  Only those files whose UIDs match those specified within this
  1.1816 +                 UID type will be included in the file list. Any, or all, of
  1.1817 +                 the three UIDs within the UID type may be omitted.
  1.1818 +				 Any UID which is omitted acts in a similar manner to
  1.1819 +				 a wildcard character, matching to all UIDs.
  1.1820 +@param aKey      The sort key. This is a set of flags indicating the order in
  1.1821 +                 which the entries are to be sorted. These flags are defined
  1.1822 +                 by TEntryKey.
  1.1823 +@param aFileList On return contains a filtered list of directory and file entries.
  1.1824 +
  1.1825 +@return KErrNone if successful, otherwise one of the other
  1.1826 +        system-wide error codes.
  1.1827 +        
  1.1828 +@see TEntryKey
  1.1829 +*/
  1.1830 +	{
  1.1831 +	TRACEMULT6(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir1, MODULEUID, 
  1.1832 +		Handle(), aName, aUidType[0].iUid, aUidType[1].iUid, aUidType[2].iUid, aKey);
  1.1833 +
  1.1834 +	RDir d;
  1.1835 +	TRAPD(r,GetDirL(aName,aUidType,aKey,aFileList,d))
  1.1836 +	d.Close();
  1.1837 +	if (r!=KErrNone)
  1.1838 +		{
  1.1839 +		delete aFileList;
  1.1840 +		aFileList=NULL;
  1.1841 +		}
  1.1842 +
  1.1843 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir1Return, MODULEUID, r);
  1.1844 +	return r;
  1.1845 +	}
  1.1846 +
  1.1847 +
  1.1848 +
  1.1849 +
  1.1850 +EFSRV_EXPORT_C TInt RFs::GetDir(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList) const
  1.1851 +/**
  1.1852 +Gets a filtered list of a directory's contents.
  1.1853 +
  1.1854 +The	bitmask determines which file and directory entry types should be listed.
  1.1855 +The sort key determines the order in which they are listed.
  1.1856 +
  1.1857 +Notes:
  1.1858 +
  1.1859 +1. If sorting by UID (as indicated when the ESortByUid bit is OR'ed with
  1.1860 +   the sort key), then UID information will be included in the listing
  1.1861 +   whether or not KEntryAttAllowUid is specified in anAttMask.
  1.1862 +
  1.1863 +2. The function sets aFileList to NULL, and then allocates memory for it before
  1.1864 +   appending entries to the list. Therefore, aFileList should have no memory
  1.1865 +   allocated to it before this function is called, otherwise this memory will
  1.1866 +   become orphaned.
  1.1867 +
  1.1868 +3. The caller of this function is responsible for deleting aFileList after
  1.1869 +   the function has returned.
  1.1870 +
  1.1871 +@param aName     The name of the directory for which a listing is required.
  1.1872 +                 Wildcards may be used to specify particular files.
  1.1873 +@param anAttMask Bitmask indicating the attributes of interest. Only files and
  1.1874 +                 directories whose attributes match those specified here can be
  1.1875 +                 included in the listing. For more information,
  1.1876 +                 see KEntryAttMatchMask and the other directory entry details.
  1.1877 +                 Also see KEntryAttNormal and the other file or directory attributes.
  1.1878 +@param aKey      The sort key. This is a set of flags indicating the order in
  1.1879 +                 which the entries are to be sorted. These flags are defined
  1.1880 +                 by TEntryKey.
  1.1881 +@param aFileList On return contains a filtered list of directory and file entries.
  1.1882 +
  1.1883 +@return KErrNone if successful, otherwise one of the other
  1.1884 +        system-wide error codes.
  1.1885 +        
  1.1886 +@see TEntryKey
  1.1887 +*/
  1.1888 +	{
  1.1889 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir2, MODULEUID, Handle(), aName, anAttMask, aKey);
  1.1890 +
  1.1891 +	RDir d;
  1.1892 +	if ((aKey&0xff)==ESortByUid)
  1.1893 +		anAttMask|=KEntryAttAllowUid;
  1.1894 +	TRAPD(r,GetDirL(aName,anAttMask,aKey,aFileList,d))
  1.1895 +	d.Close();
  1.1896 +	if (r!=KErrNone)
  1.1897 +		{
  1.1898 +		delete aFileList;
  1.1899 +		aFileList=NULL;
  1.1900 +		}
  1.1901 +
  1.1902 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir2Return, MODULEUID, r);
  1.1903 +	return r;
  1.1904 +	}
  1.1905 +
  1.1906 +
  1.1907 +
  1.1908 +
  1.1909 +EFSRV_EXPORT_C TInt RFs::GetDir(const TDesC& aName,TUint anAttMask,TUint aKey,CDir*& aFileList,CDir*& aDirList) const
  1.1910 +/**
  1.1911 +Gets a filtered list of the directory and file entries contained in
  1.1912 +a directory, and a list of the directory entries only.
  1.1913 +
  1.1914 +The bitmask	determines which file and directory entry types should be listed in
  1.1915 +aFileList. The contents of the second list, aDirList are not affected by the bitmask; it
  1.1916 +returns all directory entries contained in directory aName. The
  1.1917 +sort key determines the order in which both lists are sorted.
  1.1918 +
  1.1919 +Notes:
  1.1920 +
  1.1921 +1. If sorting by UID (as indicated when the ESortByUid bit is OR'ed with
  1.1922 +   the sort key), then UID information will be included in the listing
  1.1923 +   whether or not KEntryAttAllowUid is specified in anAttMask.
  1.1924 +   
  1.1925 +2. The function sets both aFileList and aDirList to NULL, and then allocates
  1.1926 +   memory to them before appending entries to the lists. Therefore, aFileList
  1.1927 +   and aDirList should have no memory allocated to them before this
  1.1928 +   function is called, otherwise the allocated memory will become orphaned.
  1.1929 +
  1.1930 +3. The caller of this function is responsible for deleting aFileList
  1.1931 +   and aDirList after the function has returned.
  1.1932 +   
  1.1933 +@param aName     The name of the directory for which a listing is required.
  1.1934 +                 Wildcards may be used to specify particular files.
  1.1935 +@param anAttMask Bitmask indicating the attributes of interest. Only files and
  1.1936 +                 directories whose attributes match those specified here can be
  1.1937 +                 included in aFileList. aDirList is unaffected by this mask. 
  1.1938 +                 For more information, see KEntryAttMatchMask and the other
  1.1939 +                 directory entry details.
  1.1940 +                 Also see KEntryAttNormal and the other file or directory
  1.1941 +                 attributes.
  1.1942 +@param aKey      The sort key. This is a set of flags indicating the order in
  1.1943 +                 which the entries in both lists are to be sorted. These flags
  1.1944 +                 are defined by TEntryKey.
  1.1945 +@param aFileList On return contains a filtered list of directory and
  1.1946 +                 file entries.
  1.1947 +@param aDirList  On return contains a filtered list of directory entries only.
  1.1948 +
  1.1949 +@return KErrNone if successful, otherwise one of the other
  1.1950 +        system-wide error codes.
  1.1951 +
  1.1952 +@see TEntryKey
  1.1953 +*/
  1.1954 +	{
  1.1955 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir3, MODULEUID, Handle(), aName, anAttMask, aKey);
  1.1956 +
  1.1957 +	RDir d;
  1.1958 +	if (aKey&ESortByUid)
  1.1959 +		anAttMask|=KEntryAttAllowUid;
  1.1960 +	TRAPD(r,GetDirL(aName,anAttMask,aKey,aFileList,aDirList,d))
  1.1961 +	d.Close();
  1.1962 +	if (r!=KErrNone)
  1.1963 +		{
  1.1964 +		delete aFileList;
  1.1965 +		aFileList=NULL;
  1.1966 +		delete aDirList;
  1.1967 +		aDirList=NULL;
  1.1968 +		}
  1.1969 +
  1.1970 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetDir3Return, MODULEUID, r);
  1.1971 +	return r;
  1.1972 +	}
  1.1973 +
  1.1974 +
  1.1975 +
  1.1976 +
  1.1977 +EFSRV_EXPORT_C TInt RFs::Parse(const TDesC& aName,TParse& aParse) const
  1.1978 +/**
  1.1979 +Parses a filename specification.
  1.1980 +
  1.1981 +Parsing is done with wildcard resolution, using the session path as
  1.1982 +the default. You can then use TParse's getter functions to extract individual
  1.1983 +components of the resulting name. All the path components that are included
  1.1984 +in aName are put into the resulting	filename. Any components that are still
  1.1985 +missing are taken from the session path.
  1.1986 +
  1.1987 +Specifying:
  1.1988 +
  1.1989 +@code
  1.1990 +TParse fp;
  1.1991 +@endcode
  1.1992 +@code
  1.1993 +fs.Parse(name,fp);
  1.1994 +@endcode
  1.1995 +
  1.1996 +is equivalent to 
  1.1997 +
  1.1998 +@code
  1.1999 +TParse fp;
  1.2000 +@endcode
  1.2001 +@code
  1.2002 +fp.Set(name,NULL,&fs.SessionPath());
  1.2003 +@endcode
  1.2004 +
  1.2005 +Note that the function does not check for illegal characters, or for
  1.2006 +illegal path components in either of the paths specified.
  1.2007 +
  1.2008 +@param aName  The file name to be parsed, using the session path to provide
  1.2009 +              the missing components.
  1.2010 +@param aParse A TParse objct that provides functions for
  1.2011 +              extracting individual components of the resulting file name.
  1.2012 +
  1.2013 +@return KErrNone if successful, otherwise one of the other
  1.2014 +        system-wide error codes.
  1.2015 +*/
  1.2016 +	{
  1.2017 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsParse1, MODULEUID, Handle(), aName);
  1.2018 +	TFileName session_path;
  1.2019 +	TInt r = SessionPath(session_path);
  1.2020 +	if (r==KErrNone)
  1.2021 +		r = aParse.Set(aName, NULL, &session_path);
  1.2022 +
  1.2023 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsParse1Return, MODULEUID, r);
  1.2024 +	return r;
  1.2025 +	}
  1.2026 +
  1.2027 +
  1.2028 +
  1.2029 +
  1.2030 +EFSRV_EXPORT_C TInt RFs::Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const
  1.2031 +/**
  1.2032 +Parses a filename specification, specifying related file path components.
  1.2033 +
  1.2034 +Parsing is done with wildcard resolution, using the session path as
  1.2035 +the default. You can then use TParse's getter functions to extract individual
  1.2036 +components of the resulting name. All the path components that are included
  1.2037 +in aName are put into the resulting	filename. Any missing components are taken
  1.2038 +from the optional aRelated argument, which has the next order of precedence.
  1.2039 +Finally, any components that are still missing are taken from the session path.
  1.2040 +
  1.2041 +Specifying:
  1.2042 +
  1.2043 +@code
  1.2044 +TParse fp;
  1.2045 +@endcode
  1.2046 +@code
  1.2047 +fs.Parse(name,related,fp);
  1.2048 +@endcode
  1.2049 +
  1.2050 +is equivalent to 
  1.2051 +
  1.2052 +@code
  1.2053 +TParse fp;
  1.2054 +@endcode
  1.2055 +@code
  1.2056 +fp.Set(name,related,&fs.SessionPath());
  1.2057 +@endcode
  1.2058 +
  1.2059 +Note that the function does not check for illegal characters, or for
  1.2060 +illegal path components in any of the paths specified.
  1.2061 +
  1.2062 +@param aName    The file name to be parsed, using the session path and the
  1.2063 +                related path to provide the missing components.
  1.2064 +@param aRelated The related file specification.
  1.2065 +@param aParse   A TParse objct that provides functions for
  1.2066 +                extracting individual components of the resulting file name.
  1.2067 +
  1.2068 +@return KErrNone if successful, otherwise one of the other
  1.2069 +        system-wide error codes.
  1.2070 +*/
  1.2071 +	{
  1.2072 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsParse2, MODULEUID, Handle(), aName, aRelated);
  1.2073 +	TFileName session_path;
  1.2074 +	TInt r = SessionPath(session_path);
  1.2075 +	if (r==KErrNone)
  1.2076 +		r = aParse.Set(aName, &aRelated, &session_path);
  1.2077 +
  1.2078 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsParse2Return, MODULEUID, r);
  1.2079 +	return r;
  1.2080 +	}
  1.2081 +
  1.2082 +
  1.2083 +
  1.2084 +
  1.2085 +EFSRV_EXPORT_C TInt RFs::Delete(const TDesC& aName)
  1.2086 +/**
  1.2087 +Deletes a single file.
  1.2088 +
  1.2089 +Wildcards are not allowed in either the	file name or the extension,
  1.2090 +otherwise an error is returned.
  1.2091 +
  1.2092 +Note that the file must be closed and must not be read-only.
  1.2093 +Hidden files can be deleted but system files cannot.
  1.2094 +
  1.2095 +See class CFileMan for information on deleting multiple files.
  1.2096 +		  
  1.2097 +@param aName The name of the file to be deleted. Any path components which
  1.2098 +             are not specified here will be taken from the session path.
  1.2099 +
  1.2100 +@return KErrNone if successful, otherwise one of the other
  1.2101 +        system-wide error codes.
  1.2102 +
  1.2103 +@capability Dependent If aName is /Sys then Tcb capability is required.
  1.2104 +@capability Dependent If aName begins with /Private and does not match this process' SID
  1.2105 +					  then AllFiles capability is required.
  1.2106 +@capability Dependent If aName is /Resource then Tcb capability is required.
  1.2107 +        
  1.2108 +@see CFileMan        
  1.2109 +*/
  1.2110 +	{
  1.2111 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsDelete, MODULEUID, Handle(), aName);
  1.2112 +	TInt r = SendReceive(EFsDelete,TIpcArgs(&aName));
  1.2113 +
  1.2114 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDeleteReturn, MODULEUID, r);
  1.2115 +	return r;
  1.2116 +	}
  1.2117 +
  1.2118 +
  1.2119 +
  1.2120 +
  1.2121 +EFSRV_EXPORT_C TInt RFs::Rename(const TDesC& anOldName,const TDesC& aNewName)
  1.2122 +/**
  1.2123 +Renames a single file or directory.
  1.2124 +
  1.2125 +It can also be used to move a file or directory by specifying different
  1.2126 +destination and source directories.	If so, the destination and source
  1.2127 +directories must be on the same drive. If a	directory is moved, then
  1.2128 +the directory structure beneath it is also	moved.
  1.2129 +
  1.2130 +If a directory specified by aNewName is different from one specified
  1.2131 +by anOldName, then the file or directory is	moved to the new directory.
  1.2132 +The file or directory cannot be moved to another device by this means,
  1.2133 +either explicitly (by another drive	specified in the name) or implicitly
  1.2134 +(because the directory has been mapped to another device with SetSubst().
  1.2135 +
  1.2136 +The function fails and returns an error code in the following
  1.2137 +circumstances:
  1.2138 +
  1.2139 +1. If either the old or new name includes wildcards.
  1.2140 +
  1.2141 +2. If a file or directory with the new name already exists in
  1.2142 +   the target directory. Overwriting is not permitted.
  1.2143 +
  1.2144 +3. If file anOldName does not exist, or is open.
  1.2145 +
  1.2146 +Read-only, system and hidden files may be renamed. The renamed
  1.2147 +file's attributes are preserved.
  1.2148 +
  1.2149 +Note that when this function is operating on directories, a	trailing backslash
  1.2150 +is not required after the final directory name in either anOldName or aNewName.
  1.2151 +
  1.2152 +See class CFileMan for information on renaming multiple files.
  1.2153 +		  				
  1.2154 +@param anOldName File or directory to be renamed. Any path components which are
  1.2155 +                 not specified here will be taken from the session path.
  1.2156 +@param aNewName  Path specifying the new name for the file or directory and/or
  1.2157 +				 its new parent directory. All directories specified in this path
  1.2158 +				 must exist.
  1.2159 +				 Any path components which are not specified here will be taken
  1.2160 +				 from the session path.
  1.2161 +
  1.2162 +@return KErrNone if successful, otherwise one of the other
  1.2163 +        system-wide error codes.
  1.2164 +
  1.2165 +@capability Dependent If either anOldName or aNewName is /Sys then Tcb capability is required.
  1.2166 +@capability Dependent If either anOldName or aNewName begins with /Private and does not match
  1.2167 +					  this process' SID then AllFiles capability is required.
  1.2168 +@capability Dependent If either anOldName or aNewName is /Resource then Tcb capability is required.
  1.2169 +        
  1.2170 +@see CFileMan        
  1.2171 +*/
  1.2172 +	{
  1.2173 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsRename, MODULEUID, Handle(), anOldName, aNewName);
  1.2174 +
  1.2175 +	TInt r;
  1.2176 +	if (anOldName.Length() <= 0 || aNewName.Length() <= 0 )
  1.2177 +		r = KErrBadName;
  1.2178 +	else
  1.2179 +		r = SendReceive(EFsRename,TIpcArgs(&anOldName,&aNewName));
  1.2180 +
  1.2181 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRenameReturn, MODULEUID, r);
  1.2182 +	return r;
  1.2183 +	}
  1.2184 +
  1.2185 +
  1.2186 +
  1.2187 +
  1.2188 +EFSRV_EXPORT_C TInt RFs::Replace(const TDesC& anOldName,const TDesC& aNewName)
  1.2189 +/**
  1.2190 +Replaces a single file with another.
  1.2191 +
  1.2192 +This function does not support the use of wildcards. Unlike Rename(), it only
  1.2193 +applies to files.
  1.2194 +
  1.2195 +This function operates as follows:
  1.2196 +
  1.2197 +1. if the aNewName file does not exist, it is created.
  1.2198 +
  1.2199 +2. anOldName's contents, attributes and the date and time of its last
  1.2200 +   modification are copied to file aNewName, overwriting any existing contents
  1.2201 +   and attribute details.
  1.2202 +
  1.2203 +3. anOldName is deleted.
  1.2204 +				 
  1.2205 +anOldName may be hidden, read-only or a system file. However,
  1.2206 +neither anOldName, nor, if it exists, aNewName, can be open;
  1.2207 +aNewName must not be read-only.
  1.2208 +Both files must be on the same drive.
  1.2209 +
  1.2210 +@param anOldName The file to be replaced. Must exist and must be closed. It is
  1.2211 +                 deleted by this function.
  1.2212 +@param aNewName  The file to replace anOldName. Does not need to exist, but if
  1.2213 +                 it does exist, it must be closed. If it exists, its name
  1.2214 +                 remains unchanged but its contents, attributes and the date
  1.2215 +                 and time of its last modification are replaced by those
  1.2216 +                 of anOldName.
  1.2217 +                 If it does not exist, it will be created and is assigned
  1.2218 +                 the contents and attributes of anOldName. Must not be followed
  1.2219 +                 by a trailing backslash.
  1.2220 +
  1.2221 +@return KErrNone, if successful;
  1.2222 +        KErrAccessDenied, if an attempt is made to replace a directory;
  1.2223 +        otherwise one of the other system-wide error codes. 
  1.2224 +
  1.2225 +@capability Dependent If either anOldName or aNewName is /Sys then Tcb capability is required.
  1.2226 +@capability Dependent If either anOldName or aNewName begins with /Private and does not match
  1.2227 +					  this process' SID then AllFiles capability is required.
  1.2228 +@capability Dependent If either anOldName or aNewName is /Resource then Tcb capability is required.
  1.2229 +
  1.2230 +*/
  1.2231 +	{
  1.2232 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsReplace, MODULEUID, Handle(), anOldName, aNewName);
  1.2233 +	TInt r = SendReceive(EFsReplace,TIpcArgs(&anOldName,&aNewName));
  1.2234 +
  1.2235 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReplaceReturn, MODULEUID, r);
  1.2236 +	return r;
  1.2237 +	}
  1.2238 +
  1.2239 +
  1.2240 +
  1.2241 +
  1.2242 +EFSRV_EXPORT_C TInt RFs::Att(const TDesC& aName,TUint& aVal) const
  1.2243 +/**
  1.2244 +Gets a file's attributes.
  1.2245 +
  1.2246 +@param aName The filename. Any path components which are not specified here
  1.2247 +             will be taken from the session path.
  1.2248 +@param aVal  On return, the individual bits within the byte indicate which
  1.2249 +             attributes have been set. For more information see KEntryAttNormal
  1.2250 +	         and the other file/directory attributes.
  1.2251 +
  1.2252 +@return KErrNone if successful, otherwise one of the other
  1.2253 +        system-wide error codes.
  1.2254 +
  1.2255 +@capability Dependent If aName contains /sys/ then AllFiles capability is required.
  1.2256 +@capability Dependent If aName contains /Private/ and does not match
  1.2257 +					  this process' SID then AllFiles capability is required.
  1.2258 +        
  1.2259 +@see KEntryAttNormal
  1.2260 +*/
  1.2261 +	{
  1.2262 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAtt, MODULEUID, Handle(), aName);
  1.2263 +
  1.2264 +	TEntry e;
  1.2265 +	TInt r=Entry(aName,e);
  1.2266 +	if (r==KErrNone)
  1.2267 +		aVal=e.iAtt;
  1.2268 +
  1.2269 +	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsAttReturn, MODULEUID, r, aVal);
  1.2270 +	return r;
  1.2271 +	}
  1.2272 +
  1.2273 +
  1.2274 +
  1.2275 +
  1.2276 +EFSRV_EXPORT_C TInt RFs::SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask)
  1.2277 +/**
  1.2278 +Sets or clears the attributes of a single file or directory.
  1.2279 +
  1.2280 +The function uses two bitmasks. The first bitmask specifies the	attributes
  1.2281 +to be set; the second specifies the attributes to be cleared.
  1.2282 +
  1.2283 +An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote
  1.2284 +attributes have no effect.
  1.2285 +
  1.2286 +@param aName          File or directory name. Any path components which are not
  1.2287 +                      specified here will be taken from the session path. Must
  1.2288 +                      not include wildcard characters. The file must be closed.
  1.2289 +@param aSetAttMask    Bitmask indicating the attributes to be set.
  1.2290 +@param aClearAttMask  Bitmask indicating the attributes to be cleared. For more
  1.2291 +				      information, see KEntryAttNormal and the other file or
  1.2292 +				      directory attributes.
  1.2293 +
  1.2294 +@return KErrNone if successful, otherwise one of the other
  1.2295 +        system-wide error codes.
  1.2296 +
  1.2297 +@panic FSCLIENT 21 if any attribute appears in both bitmasks.
  1.2298 +
  1.2299 +
  1.2300 +@capability Dependent If aName is /Sys then Tcb capability is required.
  1.2301 +@capability Dependent If aName begins with /Private and does not match
  1.2302 +					  this process' SID then AllFiles capability is required.
  1.2303 +@capability Dependent If aName is /Resource then Tcb capability is required.
  1.2304 +	
  1.2305 +@see RFs::SetEntry
  1.2306 +
  1.2307 +*/
  1.2308 +	{
  1.2309 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSetAtt, MODULEUID, 
  1.2310 +		Handle(), aName, aSetAttMask, aClearAttMask);
  1.2311 +
  1.2312 + 	TInt r = SetEntry(aName,TTime(0),aSetAttMask,aClearAttMask);
  1.2313 +
  1.2314 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetAttReturn, MODULEUID, r);
  1.2315 +	return r;
  1.2316 +	}
  1.2317 +
  1.2318 +
  1.2319 +
  1.2320 +
  1.2321 +EFSRV_EXPORT_C TInt RFs::Modified(const TDesC& aName,TTime& aTime) const
  1.2322 +/**
  1.2323 +Gets the last modification date and time of a file or a directory,
  1.2324 +in UTC.
  1.2325 +
  1.2326 +If there has been no modification, the function gets the date and
  1.2327 +time of the file or directory's creation.
  1.2328 +
  1.2329 +@param aName File or directory name.
  1.2330 +@param aTime On return, contains the date and time of the file or
  1.2331 +             directory's last modification in universal time.
  1.2332 +
  1.2333 +@return KErrNone if successful, otherwise one of the other
  1.2334 +        system-wide error codes.
  1.2335 +
  1.2336 +@capability Dependent If aName contains /sys/ then AllFiles capability is required.
  1.2337 +@capability Dependent If aName contains /Private/ and does not match
  1.2338 +					  this process' SID then AllFiles capability is required.
  1.2339 +
  1.2340 +*/
  1.2341 +	{
  1.2342 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsModified, MODULEUID, Handle(), aName);
  1.2343 +
  1.2344 +	TEntry e;
  1.2345 +	TInt r=Entry(aName,e);
  1.2346 +	if (r==KErrNone)
  1.2347 +		aTime=e.iModified;
  1.2348 +
  1.2349 +	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFsModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
  1.2350 +	return r;
  1.2351 +	}
  1.2352 +
  1.2353 +
  1.2354 +
  1.2355 +
  1.2356 +EFSRV_EXPORT_C TInt RFs::SetModified(const TDesC& aName,const TTime& aTime)
  1.2357 +/**
  1.2358 +Sets the date and time that the contents of a file or directory
  1.2359 +were modified, in UTC.
  1.2360 +
  1.2361 +@param aName File or directory name.
  1.2362 +@param aTime The new date and time that the file or directory was modified
  1.2363 +             in universal time.
  1.2364 +
  1.2365 +@return KErrNone if successful;
  1.2366 +        KErrInUse, if the file is open;
  1.2367 +        otherwise one of the other system-wide error codes.
  1.2368 +
  1.2369 +@capability Dependent If aName is /Sys then Tcb capability is required.
  1.2370 +@capability Dependent If aName begins with /Private and does not match
  1.2371 +					  this process' SID then AllFiles capability is required.
  1.2372 +@capability Dependent If aName is /Resource then Tcb capability is required.
  1.2373 +
  1.2374 +*/
  1.2375 +	{
  1.2376 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSetModified, MODULEUID, Handle(), aName, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()) );
  1.2377 +
  1.2378 +	TInt r = SetEntry(aName,aTime,KEntryAttModified,0);
  1.2379 +
  1.2380 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetModifiedReturn, MODULEUID, r);
  1.2381 +	return r;
  1.2382 +	}
  1.2383 +
  1.2384 +
  1.2385 +
  1.2386 +
  1.2387 +EFSRV_EXPORT_C TInt RFs::Entry(const TDesC& aName,TEntry& anEntry) const
  1.2388 +/**
  1.2389 +Gets the entry details for a file or directory.
  1.2390 +
  1.2391 +This information includes UID information.
  1.2392 +
  1.2393 +@param aName   Name of file or directory.
  1.2394 +@param anEntry On return, contains the entry details for the file or directory. TEntry::iModified contains UTC date and time.
  1.2395 +
  1.2396 +@return KErrNone if successful, otherwise one of the other
  1.2397 +        system-wide error codes.
  1.2398 +
  1.2399 +@capability Dependent If aName contains "\\Sys\\" and includes an additional file or directory then AllFiles capability 
  1.2400 +					  is required. For example, the paths "c:\\sys" and "c:\\sys\\" will always be readable, whereas
  1.2401 +					  the path "c:\\sys\\abc\\" will only be readable with AllFiles capability.
  1.2402 +
  1.2403 +@capability Dependent If aName contains \\Private\\ and includes an additional file, or a directory which does not match
  1.2404 +					  this process' SID, then AllFiles capability is required. For example, the paths "c:\\private" and 
  1.2405 +					  "c:\\private\\" will always be readable, whereas the path "c:\\private\\<n>\\" will only be 
  1.2406 +					  readable with AllFiles capability or if <n> matches the process' SID.
  1.2407 +*/
  1.2408 +	{
  1.2409 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsEntry, MODULEUID, Handle(), aName);
  1.2410 +	TPckg<TEntry> e(anEntry);
  1.2411 +	TInt r = SendReceive(EFsEntry,TIpcArgs(&aName,&e));
  1.2412 +
  1.2413 +	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsEntryReturn, MODULEUID, 
  1.2414 +		r, anEntry.iAtt, 
  1.2415 +		I64LOW(anEntry.iModified.Int64()), I64HIGH(anEntry.iModified.Int64()), 
  1.2416 +		anEntry.iSize);
  1.2417 +	return r;
  1.2418 +	}
  1.2419 +
  1.2420 +
  1.2421 +
  1.2422 +
  1.2423 +EFSRV_EXPORT_C TInt RFs::SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask)
  1.2424 +/**
  1.2425 +Sets both the attributes and the last modified date and time for a file or directory.
  1.2426 +
  1.2427 +The function uses two bitmasks. The first bitmask determines
  1.2428 +which attributes should be set. The second bitmask determines which should be cleared.
  1.2429 +
  1.2430 +An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote
  1.2431 +attributes have no effect.
  1.2432 +			 
  1.2433 +@param aName          File or directory name.
  1.2434 +@param aTime	      New date and time. UTC date and time should be used.
  1.2435 +@param aSetAttMask    Bitmask indicating which attributes are to be set.
  1.2436 +@param aClearAttMask  Bitmask indicating which attributes are cleared. For more
  1.2437 +                      information, see KEntryAttNormal, and the other file
  1.2438 +                      or directory attributes.
  1.2439 +
  1.2440 +@return KErrNone, if successful;
  1.2441 +        KErrInUse, if the file is open;
  1.2442 +        otherwise one of the other system-wide error codes.
  1.2443 +
  1.2444 +@panic FSCLIENT 21 if any attribute appears in both bitmasks.        
  1.2445 +
  1.2446 +@capability Dependent If aName is /Sys then Tcb capability is required.
  1.2447 +@capability Dependent If aName begins with /Private and does not match
  1.2448 +					  this process' SID then AllFiles capability is required.
  1.2449 +@capability Dependent If aName is /Resource then Tcb capability is required.
  1.2450 +
  1.2451 +@see KEntryAttNormal
  1.2452 +@see KEntryAttDir
  1.2453 +@see KEntryAttVolume
  1.2454 +*/
  1.2455 +	{
  1.2456 +	TRACEMULT6(UTF::EBorder, UTraceModuleEfsrv::EFsSetEntry, MODULEUID, 
  1.2457 +		Handle(), aName, 
  1.2458 +		I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), 
  1.2459 +		aSetAttMask, aClearAttMask);
  1.2460 +
  1.2461 +	__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
  1.2462 +	TPtrC8 timeBuf((TUint8*)&aTime,sizeof(TTime));
  1.2463 +	TInt r = SendReceive(EFsSetEntry,TIpcArgs(&aName,&timeBuf,aSetAttMask,aClearAttMask));
  1.2464 +
  1.2465 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetEntryReturn, MODULEUID, r);
  1.2466 +	return r;
  1.2467 +	}
  1.2468 +
  1.2469 +/**
  1.2470 +Reads data from a file without opening it.
  1.2471 +
  1.2472 +The contents of the	file can be accessed regardless of the file's lock state.
  1.2473 +
  1.2474 +The file may be open by any number of other clients for reading	or writing.
  1.2475 +In allowing such access to a file, the fileserver makes no guarantees as to
  1.2476 +the validity of the data it returns.
  1.2477 +
  1.2478 +@param aName    Name of the file to be accessed.
  1.2479 +@param aPos     The offset, in bytes, from the start of the file where
  1.2480 +				reading is to start.
  1.2481 +@param aDes     On return, contains the data read from the file. The length of
  1.2482 +				the descriptor is set to the number of bytes read. If the
  1.2483 +				specified offset lies beyond the end of the file, no data is
  1.2484 +				read and the length of this descriptor is set to zero.
  1.2485 +@param aLength  The number of bytes to be read from the file.
  1.2486 +
  1.2487 +@return KErrNone if successful, 
  1.2488 +		KErrArgument if aLength is negative,
  1.2489 +		otherwise one of the other system-wide error codes.
  1.2490 +
  1.2491 +@panic FSCLIENT 19 if aPos negative.
  1.2492 +@panic FSCLIENT 27 if aLength is greater than the maximum length of
  1.2493 +       the target descriptor.
  1.2494 +
  1.2495 +@capability Dependent If the path for aName starts with /Sys capability AllFiles is required
  1.2496 +@capability Dependent If the path for aName starts with /Private and this process does not have 
  1.2497 +                      the relevant SID capability AllFiles is required
  1.2498 +
  1.2499 +*/
  1.2500 +EFSRV_EXPORT_C TInt RFs::ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const
  1.2501 +	{
  1.2502 +	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSection, MODULEUID, 
  1.2503 +		Handle(), aName, I64LOW(aPos), I64HIGH(aPos), aLength);
  1.2504 +
  1.2505 +	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1.2506 +	
  1.2507 +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
  1.2508 +	if(aPos > KMaxTInt)
  1.2509 +		{
  1.2510 +		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrTooBig);
  1.2511 +		return KErrTooBig;
  1.2512 +		}
  1.2513 +	if((aPos + aLength) > KMaxTInt)
  1.2514 +		aLength = KMaxTInt - (TInt)aPos;
  1.2515 +#endif
  1.2516 +	if (aLength)	//	Number of characters to read
  1.2517 +		{
  1.2518 +		__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength));
  1.2519 +  	 	}
  1.2520 +	else
  1.2521 +		{
  1.2522 +		aDes.Zero();
  1.2523 +		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrNone);
  1.2524 +		return(KErrNone);
  1.2525 +		}
  1.2526 +		
  1.2527 +	__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength));
  1.2528 +	
  1.2529 +	TInt r;
  1.2530 +	if(!(I64HIGH(aPos)))
  1.2531 +		{
  1.2532 +		r = SendReceive(EFsReadFileSection,TIpcArgs(&aDes,&aName,I64LOW(aPos),aLength));
  1.2533 +		}
  1.2534 +	else
  1.2535 +		{
  1.2536 +		TPckgC<TInt64> pkPos(aPos);
  1.2537 +		r = SendReceive(EFsReadFileSection|KIpcArgSlot2Desc,TIpcArgs(&aDes,&aName,&pkPos,aLength));
  1.2538 +		}
  1.2539 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, r);
  1.2540 +	return r;
  1.2541 +	}
  1.2542 +/**
  1.2543 +Maintained for BC
  1.2544 +
  1.2545 +@internalTechnology
  1.2546 +*/
  1.2547 +EFSRV_EXPORT_C TInt RFs::ReadFileSection_RESERVED(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const
  1.2548 +	{
  1.2549 +	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSection, MODULEUID, 
  1.2550 +		Handle(), aName, aPos, 0, aLength);
  1.2551 +
  1.2552 +	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
  1.2553 +	
  1.2554 +	if (aLength)	//	Number of characters to read
  1.2555 +		{
  1.2556 +		__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength));
  1.2557 +  	 	}
  1.2558 +	else
  1.2559 +		{
  1.2560 +		aDes.Zero();
  1.2561 +		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, KErrNone);
  1.2562 +		return(KErrNone);
  1.2563 +		}
  1.2564 +		
  1.2565 +	__ASSERT_ALWAYS(aDes.MaxLength()>=aLength,Panic(EBadLength));
  1.2566 +		
  1.2567 +	TInt r = SendReceive(EFsReadFileSection,TIpcArgs(&aDes,&aName,aPos,aLength));
  1.2568 +
  1.2569 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReadFileSectionReturn, MODULEUID, r);
  1.2570 +	return r;
  1.2571 +	}
  1.2572 +
  1.2573 +
  1.2574 +
  1.2575 +
  1.2576 +EFSRV_EXPORT_C void RFs::ResourceCountMarkStart() const
  1.2577 +/**
  1.2578 +Marks the start of resource count checking.
  1.2579 +
  1.2580 +Typically, this function is called immediately after a client is connected
  1.2581 +to the file server, and before any resources are opened.
  1.2582 +*/
  1.2583 +	{
  1.2584 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkStart, MODULEUID, Handle());
  1.2585 +	
  1.2586 +	RSessionBase::SendReceive(EFsResourceCountMarkStart);
  1.2587 +
  1.2588 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkStartReturn, MODULEUID);
  1.2589 +	}
  1.2590 +
  1.2591 +
  1.2592 +
  1.2593 +
  1.2594 +EFSRV_EXPORT_C void RFs::ResourceCountMarkEnd() const
  1.2595 +/**
  1.2596 +Ends resource count checking. Typically, this function is called immediately 
  1.2597 +before closing a session with the file server.
  1.2598 +
  1.2599 +@panic CSessionFs 2 if the number of resources opened since the start of resource 
  1.2600 +       count checking is not equal to the number of resources closed.
  1.2601 +*/
  1.2602 +	{
  1.2603 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkEnd, MODULEUID, Handle());
  1.2604 +
  1.2605 +	RSessionBase::SendReceive(EFsResourceCountMarkEnd);
  1.2606 +
  1.2607 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountMarkEndReturn, MODULEUID);
  1.2608 +	}
  1.2609 +
  1.2610 +
  1.2611 +
  1.2612 +
  1.2613 +EFSRV_EXPORT_C TInt RFs::ResourceCount() const
  1.2614 +/**
  1.2615 +Gets the number of currently open resources.
  1.2616 +
  1.2617 +The resource count is incremented by one: when a file or directory
  1.2618 +is opened, when a device is opened in preparation for formatting, when a direct access channel
  1.2619 +to a disk is opened.
  1.2620 +
  1.2621 +@return The number of resources currently open.
  1.2622 +*/
  1.2623 +	{
  1.2624 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCount, MODULEUID, Handle());
  1.2625 +
  1.2626 +	TInt count;
  1.2627 +	TPckg<TInt> pckg(count);
  1.2628 +	SendReceive(EFsResourceCount,TIpcArgs(&pckg));
  1.2629 +	TInt r = *(TInt*)pckg.Ptr();
  1.2630 +
  1.2631 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsResourceCountReturn, MODULEUID, r);
  1.2632 +	return r;
  1.2633 +	}
  1.2634 +
  1.2635 +
  1.2636 +
  1.2637 +/**
  1.2638 +Checks the integrity of the disk on the specified drive.
  1.2639 +On FAT, this checks if a cluster number is invalid, if a cluster is allocated to
  1.2640 +more than one file entry, if an unallocated cluster is not set free, and if size
  1.2641 +of an entry is invalid.
  1.2642 +
  1.2643 +@param aDrive Path indicating the drive which contains the disk to be checked. If the drive 
  1.2644 +        information is not specified the current session drive is taken by default.
  1.2645 +		Checkdisk is performed on the requested drive irrespective of the correctness or
  1.2646 +		existance of the given path.
  1.2647 +
  1.2648 +@return KErrNone, if successful;
  1.2649 +		1, if successful but a file cluster contains a bad value;
  1.2650 +		2, if successful but two files are linked to the same cluster;
  1.2651 +		3, if successful but an unallocated cluster contains a value;
  1.2652 +		4, if successful but the size of a file is not equal to the number of clusters in chain;
  1.2653 +        KErrNotReady, if the specified drive is empty;
  1.2654 +        KErrNotSupported, if the drive cannot handle this request;
  1.2655 +        KErrPermissionDenied, if the caller doesn't have DiskAdmin capability;
  1.2656 +        Other system wide error codes may also be returned.
  1.2657 +
  1.2658 +@capability DiskAdmin
  1.2659 +*/
  1.2660 +EFSRV_EXPORT_C TInt RFs::CheckDisk(const TDesC& aDrive) const
  1.2661 +	{
  1.2662 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDisk, MODULEUID, Handle(), aDrive);
  1.2663 +	TInt r = SendReceive(EFsCheckDisk,TIpcArgs(&aDrive));
  1.2664 +
  1.2665 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsCheckDiskReturn, MODULEUID, r);
  1.2666 +	return r;
  1.2667 +	}
  1.2668 +
  1.2669 +
  1.2670 +
  1.2671 +
  1.2672 +EFSRV_EXPORT_C TInt RFs::ScanDrive(const TDesC& aDrive) const
  1.2673 +/**
  1.2674 +Checks the specified drive for errors and corrects them. Specifically, it
  1.2675 +checks if long file name entries' IDs are in sequence and short name is valid,
  1.2676 +and file's allocated clusters are not used by other files.
  1.2677 +
  1.2678 +This does not run on the internal RAM drive, and only applies to a
  1.2679 +FAT file system.
  1.2680 +
  1.2681 +@param aDrive Path indicating the drive which contains the disk to be checked. If the drive 
  1.2682 +        information is not specified the current session drive is taken by default.
  1.2683 +		ScanDrive is performed on the requested drive irrespective of the correctness or
  1.2684 +		existance of the given path.
  1.2685 +
  1.2686 +@return KErrNone if successful,
  1.2687 +        KErrPermissionDenied if caller doesn't have capability DiskAdmin,
  1.2688 +        KErrInUse if drive is in use,
  1.2689 +        otherwise one of the other system-wide error codes
  1.2690 +
  1.2691 +@capability DiskAdmin
  1.2692 +*/
  1.2693 +	{
  1.2694 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsScanDrive, MODULEUID, Handle(), aDrive);
  1.2695 +	TInt r = SendReceive(EFsScanDrive,TIpcArgs(&aDrive));
  1.2696 +
  1.2697 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsScanDriveReturn, MODULEUID, r);
  1.2698 +	return r;
  1.2699 +	}
  1.2700 +
  1.2701 +
  1.2702 +
  1.2703 +
  1.2704 +EFSRV_EXPORT_C TInt RFs::GetShortName(const TDesC& aLongName,TDes& aShortName) const
  1.2705 +/**
  1.2706 +Gets the short filename associated with a VFAT long filename.
  1.2707 +
  1.2708 +The short filename has a limit of eight characters for the file name and three
  1.2709 +characters for the extension.
  1.2710 +
  1.2711 +@param aLongName  The long filename. Any path components which are not
  1.2712 +                  specified	here will be taken from the session path.
  1.2713 +                  If the path specifies a directory, it may or may not be
  1.2714 +                  followed by a trailing backslash.
  1.2715 +@param aShortName On return, contains the short filename associated with the file
  1.2716 +                  or directory specified in aLongName.
  1.2717 +
  1.2718 +@return KErrNone if successful, otherwise one of the other
  1.2719 +        system-wide error codes.
  1.2720 +
  1.2721 +@capability Dependent If the path for aLongName starts with /Sys capability AllFiles is required
  1.2722 +@capability Dependent If the path for aLongName starts with /Private and this process does not
  1.2723 +					  have the relevant SID capability AllFiles is required
  1.2724 +*/
  1.2725 +	{
  1.2726 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortName, MODULEUID, Handle(), aLongName);
  1.2727 +	TInt r = SendReceive(EFsGetShortName,TIpcArgs(&aLongName,&aShortName));
  1.2728 +
  1.2729 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetShortNameReturn, MODULEUID, r, aShortName);
  1.2730 +	return r;
  1.2731 +	}
  1.2732 +
  1.2733 +
  1.2734 +
  1.2735 +
  1.2736 +EFSRV_EXPORT_C TInt RFs::GetLongName(const TDesC& aShortName,TDes& aLongName) const
  1.2737 +/**
  1.2738 +Gets the long filename associated with a short (8.3) filename.
  1.2739 +
  1.2740 +A long filename has a limit of 256 characters for each component, as well as a
  1.2741 +limit of 256 characters for the entire path.
  1.2742 +
  1.2743 +@param aShortName The short file name. Any path components which are not
  1.2744 +                  specified here will be taken from the session path. If
  1.2745 +                  the path specifies a directory, it may or may not be followed
  1.2746 +                  by a trailing backslash.
  1.2747 +@param aLongName  On return, contains the long version of the name.
  1.2748 +				
  1.2749 +@return KErrNone if successful, otherwise one of the other
  1.2750 +        system-wide error codes.
  1.2751 +
  1.2752 +@capability Dependent If the path for aShortName starts with /Sys capability AllFiles is required
  1.2753 +@capability Dependent If the path for aShortName starts with /Private and this process does not
  1.2754 +					  have the relevant SID capability AllFiles is required
  1.2755 +
  1.2756 +*/
  1.2757 +	{
  1.2758 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongName, MODULEUID, Handle(), aShortName);
  1.2759 +	TInt r = SendReceive(EFsGetLongName,TIpcArgs(&aShortName,&aLongName));
  1.2760 +
  1.2761 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetLongNameReturn, MODULEUID, r, aLongName);
  1.2762 +	return r;
  1.2763 +	}
  1.2764 +
  1.2765 +
  1.2766 +
  1.2767 +
  1.2768 +EFSRV_EXPORT_C TInt RFs::IsFileOpen(const TDesC& aFileName,TBool& anAnswer) const
  1.2769 +/**
  1.2770 +Tests whether a file is open.
  1.2771 +
  1.2772 +This function is useful because several file based operations provided by
  1.2773 +the RFs class, for example: Delete(), Replace() and Rename(), require that
  1.2774 +the file be closed.
  1.2775 +
  1.2776 +@param aFileName The name of the file to test. Any path components which are
  1.2777 +                 not specified here will be taken from the session path. If a
  1.2778 +				 directory is specified instead of a file then KErrNone will be
  1.2779 +				 returned and anAnswer will be set to EFalse.
  1.2780 +@param anAnswer  On return, true if the file is open, false if closed.
  1.2781 +
  1.2782 +@return KErrNone if successful, otherwise one of the other
  1.2783 +        system-wide error codes.
  1.2784 +
  1.2785 +@capability Dependent If the path for aFileName starts with /Sys capability AllFiles is required
  1.2786 +@capability Dependent If the path for aFileName starts with /Private and this process does not
  1.2787 +					  have the relevant SID capability AllFiles is required
  1.2788 +        
  1.2789 +@see RFs::Delete
  1.2790 +@see RFs::Rename 
  1.2791 +@see RFs::Replace
  1.2792 +*/
  1.2793 +	{
  1.2794 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpen, MODULEUID, Handle(), aFileName);
  1.2795 +	TPckg<TBool> b(anAnswer);
  1.2796 +	TInt r = SendReceive(EFsIsFileOpen,TIpcArgs(&aFileName,&b));
  1.2797 +
  1.2798 +	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileOpenReturn, MODULEUID, r, anAnswer);
  1.2799 +	return r;
  1.2800 +	}
  1.2801 +
  1.2802 +
  1.2803 +
  1.2804 +
  1.2805 +TInt RFs::GetOpenFileList(TInt& aSessionNumber,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const
  1.2806 +//
  1.2807 +// Private function to get a list of open files 
  1.2808 +//
  1.2809 +	{
  1.2810 +	TOpenFileListPos s(aSessionNumber,aLocalPos);
  1.2811 +	TPckg<TOpenFileListPos> pS(s);
  1.2812 +	TPckg<TThreadId> threadId(aThreadId);
  1.2813 +	anArray.iCount=KCountNeeded;
  1.2814 +	TInt r=SendReceive(EFsListOpenFiles,TIpcArgs(&pS,&threadId,&anArray.iBuf));
  1.2815 +	aSessionNumber=s.iSession;
  1.2816 +	aLocalPos=s.iEntryListPos;
  1.2817 +	return r;
  1.2818 +	}
  1.2819 +
  1.2820 +
  1.2821 +
  1.2822 +
  1.2823 +EFSRV_EXPORT_C TBool RFs::GetNotifyUser()
  1.2824 +/**
  1.2825 +Tests whether user notification of file read or write failure is in effect.
  1.2826 +
  1.2827 +@return True if notification in effect, false if not.
  1.2828 +*/
  1.2829 +	{
  1.2830 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUser, MODULEUID, Handle());
  1.2831 +
  1.2832 +	TInt notifyUser;
  1.2833 +	TPckg<TInt> pckgNotify(notifyUser);
  1.2834 +	SendReceive(EFsGetNotifyUser,TIpcArgs(&pckgNotify));
  1.2835 +	TBool r = notifyUser;
  1.2836 +
  1.2837 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetNotifyUserReturn, MODULEUID, r);
  1.2838 +	return r;
  1.2839 +	}
  1.2840 +
  1.2841 +
  1.2842 +
  1.2843 +
  1.2844 +EFSRV_EXPORT_C void RFs::SetNotifyUser(TBool aValue)
  1.2845 +/**
  1.2846 +Sets whether the user should be notified of file read or write failure.
  1.2847 +Note that if some drive is mounted as synchronous (see RFs::MountFileSystem), the user won't be 
  1.2848 +notified about read/write failures on it. 
  1.2849 +
  1.2850 +@param aValue ETrue, if user is to be notified of read or write failures;
  1.2851 +              EFalse, for no notification.
  1.2852 +*/
  1.2853 +	{
  1.2854 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUser, MODULEUID, Handle(), aValue);
  1.2855 +	SendReceive(EFsSetNotifyUser,TIpcArgs(aValue));
  1.2856 +
  1.2857 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyUserReturn, MODULEUID);
  1.2858 +	}
  1.2859 +
  1.2860 +
  1.2861 +
  1.2862 +
  1.2863 +EFSRV_EXPORT_C TUint8* RFs::IsFileInRom(const TDesC& aFileName) const
  1.2864 +/**
  1.2865 +Gets a pointer to the specified file, if it is in ROM.
  1.2866 +
  1.2867 +Note that this is not a test of whether the file is on the Z: drive, as
  1.2868 +the Z: drive may consist of a ROM and another file system, using the composite
  1.2869 +file system. For example, the file system may be ROFS, and the underlying media
  1.2870 +NAND flash.
  1.2871 +
  1.2872 +@param aFileName The filename whose address is sought. Cannot include wildcards.
  1.2873 +                 Any path components which are not specified here will be taken
  1.2874 +                 from the session path.
  1.2875 +
  1.2876 +@return Address of the start of the file, if it is in ROM. This is NULL, if
  1.2877 +        the file is not in ROM. Note that for the composite file system, the file
  1.2878 +        might be on the Z: drive but in a non-ROM file system (i.e. ROFS), in
  1.2879 +        which case the function still returns NULL.
  1.2880 +
  1.2881 +@capability Dependent If the path for aFileName starts with /Sys capability AllFiles is required
  1.2882 +@capability Dependent If the path for aFileName starts with /Private and this process does not
  1.2883 +					  have the relevant SID capability AllFiles is required
  1.2884 +
  1.2885 +*/
  1.2886 +	{
  1.2887 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRom, MODULEUID, Handle(), aFileName);
  1.2888 +
  1.2889 +	TPckgBuf<TUint8*> start;
  1.2890 +
  1.2891 +	TUint8* r;
  1.2892 +	if (SendReceive(EFsIsFileInRom,TIpcArgs(&aFileName,&start))!=KErrNone)
  1.2893 +		r = NULL;
  1.2894 +	else
  1.2895 +		r = start();
  1.2896 +
  1.2897 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsFileInRomReturn, MODULEUID, r);
  1.2898 +	return r;
  1.2899 +	}
  1.2900 +
  1.2901 +
  1.2902 +
  1.2903 +
  1.2904 +/**
  1.2905 +Tests whether a filename and path are syntactically correct.
  1.2906 +
  1.2907 +The following restrictions apply to the path and to its components:
  1.2908 +
  1.2909 +1.  Wildcards are not allowed in any path component, including the filename and extension.
  1.2910 +2.  Double backslashes are not allowed anywhere in the path
  1.2911 +3.  The following 6 characters cannot appear in the path: < > : " / |
  1.2912 +4.  Either or both of a filename or extension must be present. This means that a valid aFileName can not 
  1.2913 +    end with backslash (like "c:\\SomeName\\"), because it will mean that "SomeName" is a directory.
  1.2914 +
  1.2915 +5.  The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, 
  1.2916 +    or of a single or double dot.
  1.2917 +
  1.2918 +6.  Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be 
  1.2919 +    spaces between other path components, for example, between directories.
  1.2920 +
  1.2921 +7.  If the path in aFileName is not fully specified, i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing 
  1.2922 +    parts of the full path will be taken from the session path, @see RFs::SetSessionPath, @see RFs::SessionPath.
  1.2923 +    In this case the session path must be set, otherwise this method will return EFalse.
  1.2924 +    For example: for the case "\\file1.txt" only the drive letter will be taken from the session path;
  1.2925 +                 for the case "file1.txt"   whole session path will be internally prepended to the "file1.txt" and whole path checked.
  1.2926 +    Note that in this case total length of the name in the aFileName parameter and the session path shall not exceed KMaxFileName characters.
  1.2927 +    
  1.2928 +   
  1.2929 +@param aFileName    The path to be checked for validity. 
  1.2930 +                    May specify a filename alone, or an entire path specification, including drive letter. 
  1.2931 +                    If a path is specified, all components are checked for validity.
  1.2932 +
  1.2933 +@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise.
  1.2934 +*/
  1.2935 +EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName) const
  1.2936 +	{
  1.2937 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1, MODULEUID, Handle(), aFileName);
  1.2938 +	TBool returnInvalidChar=EFalse;
  1.2939 +	TPckg<TBool> bPckg(returnInvalidChar);
  1.2940 +	TBool b;
  1.2941 +	if (SendReceive(EFsIsValidName,TIpcArgs(&aFileName,&bPckg,NULL,NULL))!=KErrNone)
  1.2942 +		b = EFalse;
  1.2943 +	else
  1.2944 +		b = ETrue;
  1.2945 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName1Return, MODULEUID, b);
  1.2946 +	return b;
  1.2947 +	}
  1.2948 +
  1.2949 +
  1.2950 +
  1.2951 +
  1.2952 +/**
  1.2953 +The following restrictions apply to the path and to its components:
  1.2954 +
  1.2955 +1.  Wildcards are not allowed in any path component, including the filename and extension.
  1.2956 +2.  Double backslashes are not allowed anywhere in the path
  1.2957 +3.  The following 6 characters cannot appear in the path: < > : " / |
  1.2958 +4.  Either or both of a filename or extension must be present. This means that a valid aFileName can not 
  1.2959 +    end with backslash (like "c:\\SomeName\\"), because it will mean that "SomeName" is a directory.
  1.2960 +
  1.2961 +5.  The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, 
  1.2962 +    or of a single or double dot.
  1.2963 +
  1.2964 +6.  Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be 
  1.2965 +    spaces between other path components, for example, between directories.
  1.2966 +
  1.2967 +7.  If the path in aFileName is not fully specified, i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing 
  1.2968 +    parts of the full path will be taken from the session path, @see RFs::SetSessionPath, @see RFs::SessionPath.
  1.2969 +    In this case the session path must be set, otherwise this method will return EFalse.
  1.2970 +    For example: for the case "\\file1.txt" only the drive letter will be taken from the session path;
  1.2971 +                 for the case "file1.txt"   whole session path will be internally prepended to the "file1.txt" and whole path checked.
  1.2972 +    Note that in this case total length of the name in the aFileName parameter and the session path shall not exceed KMaxFileName characters.
  1.2973 +   
  1.2974 +@param aFileName    The path to be checked for validity. 
  1.2975 +                    May specify a filename alone, or an entire path specification, including drive letter. 
  1.2976 +                    If a path is specified, all components are checked for validity.
  1.2977 +
  1.2978 +@param aBadChar     reference to the variable that on return can contain illegal character from aFileName.
  1.2979 +                    1. if the filename and optional path in aFileName are valid, this method will return ETrue and aBadChar will be set to 0x00.
  1.2980 +                    2. if there is an illegal character in aFileName, this method will return EFalse and aBadChar will contain this illegal character.
  1.2981 +                    3. if there is no illegal characters in aFileName, but this is still not a valid filename (like "\\SomeName\\") 
  1.2982 +                        this method will return EFalse and aBadChar will contain space ' ' or code 0x20.
  1.2983 +
  1.2984 +@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise.
  1.2985 +*/
  1.2986 +EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aFileName,TText& aBadChar) const
  1.2987 +	{
  1.2988 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2, MODULEUID, Handle(), aFileName);
  1.2989 +	TBool returnInvalidChar=ETrue;
  1.2990 +	TPckg<TBool> boolPckg(returnInvalidChar);
  1.2991 +	TPckg<TText> textPckg(aBadChar);
  1.2992 +	TBool b;
  1.2993 +	if (SendReceive(EFsIsValidName,TIpcArgs(&aFileName,&boolPckg,&textPckg,NULL))!=KErrNone)
  1.2994 +		b = EFalse;
  1.2995 +	else 
  1.2996 +		b = ETrue;
  1.2997 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName2Return, MODULEUID, b, aBadChar);
  1.2998 +	return b;
  1.2999 +	}
  1.3000 +/**
  1.3001 +This API can be used to validate both directory and file names.
  1.3002 +If the name ends with a trailing backslash '\\' then it is considered to be a directory
  1.3003 +else a filename.
  1.3004 +For example: "C:\\test\\" would mean a directory, whereas
  1.3005 +			 "C:\\test" would mean a file, both of which would be returned as a Valid Name.
  1.3006 +However a name such as "C:\\test\\\\" would be returned as an Invalid name with error code TError::ErrBadName
  1.3007 +
  1.3008 +The following restrictions apply to the path and to its components:
  1.3009 +
  1.3010 +1.  Wildcards are not allowed in any path component, including the name and extension.
  1.3011 +2.  Double backslashes are not allowed anywhere in the path
  1.3012 +3.  The following 6 characters cannot appear in the path: < > : " / |
  1.3013 +4.  The entire component following the final backslash (the filename and extension) cannot consist solely of space characters, 
  1.3014 +    or of a single or double dot.
  1.3015 +5.  Spaces between the drive, if specified, and the first directory in the path are illegal, although there may be 
  1.3016 +    spaces between other path components, for example, between directories.
  1.3017 +6.  If TNameValidParam::iUseSesssionPath is set to ETrue, and if the path in aName is not fully specified, 
  1.3018 +	i.e. doesn't look like "c:\\Dir1\\File1.bin", all missing parts of the full path will be taken from the session path,
  1.3019 + 	@see RFs::SetSessionPath, @see RFs::SessionPath.
  1.3020 +    In this case the session path must be set, otherwise this method will return EFalse.
  1.3021 +    For example: for the case "\\file1.txt" only the drive letter will be taken from the session path;
  1.3022 +                 for the case "file1.txt"   whole session path will be internally prepended to the "file1.txt" and whole path checked.
  1.3023 +    Note that in this case total length of the name in the aName parameter and the session path shall not exceed KMaxFileName characters.
  1.3024 +7. If TNameValidParam::iUseSesssionPath is set to EFalse, which is the default value, then
  1.3025 +   the session path is not used to fill in the missing parts of the name as stated above.
  1.3026 +   For example: for the case "file1.txt", session path will not be used to check the validity of the name. 
  1.3027 +@param aName    The path to be checked for validity. 
  1.3028 +                May specify a name alone, or an entire path specification, including drive letter. 
  1.3029 +                If a path is specified, all components are checked for validity.
  1.3030 +
  1.3031 +@param aParam     reference to the variable that on return can contain details of the error if any.
  1.3032 +				  While constructing an object of this type one could specify whether one wants to use the sessionPath for filling up missing parts of aName,
  1.3033 +				  or one would want to test aName as it is without prepending the sessionPath.
  1.3034 +				  By default the sessionPath is NOT used. 
  1.3035 +                    1. if the name and optional path in aName are valid, this method will return ETrue and TError::iError will contain ErrNone.
  1.3036 +                    2. if there is an illegal character in aName, this method will return EFalse and TError::iError will contain KErrBadCharacter.
  1.3037 +                       Also TError::iInvalidCharPos will indicate the position of the rightmost invalid character. 
  1.3038 +                    3. if there is no illegal characters in aName, but this is still not a valid name (like "") 
  1.3039 +                       this method will return EFalse and TError::iError will contain KErrBadCharacter, while iInvalidCharPos will be set to 0
  1.3040 +					4. if length of the name exceeds 256 characters, this method will return EFalse and TError::iError will contain KErrTooLong.
  1.3041 +					   if the optional sessionPath is used, then the length of the sessionPath is also used to determine whether the length exceeds 256 characters.
  1.3042 +@return ETrue, if the name is valid (conforms to the mentioned above criteria); EFalse otherwise.
  1.3043 +*/
  1.3044 +EFSRV_EXPORT_C TBool RFs::IsValidName(const TDesC& aName, TNameValidParam& aParam )
  1.3045 +	{
  1.3046 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3, MODULEUID, Handle(), aName);
  1.3047 +	TPckg<TNameValidParam> paramPckg(aParam);
  1.3048 +	TBool b;
  1.3049 +	if (SendReceive(EFsIsValidName,TIpcArgs(&aName,NULL,NULL,&paramPckg))!=KErrNone)
  1.3050 +		b = EFalse;
  1.3051 +	else
  1.3052 +		b = ETrue;
  1.3053 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsIsValidName3Return, MODULEUID, b, aParam.ErrorCode());
  1.3054 +	return b;
  1.3055 +	}
  1.3056 +
  1.3057 +
  1.3058 +
  1.3059 +
  1.3060 +EFSRV_EXPORT_C TInt RFs::GetDriveName(TInt aDrive,TDes& aDriveName) const
  1.3061 +/**
  1.3062 +Gets the name of a drive.
  1.3063 +
  1.3064 +Drive naming is optional. If the drive specified has not been assigned a name,
  1.3065 +this function returns a descriptor whose length is zero.
  1.3066 +
  1.3067 +@param aDrive     The drive number. Specify a drive in the range
  1.3068 +                  EDriveA to EDriveZ for drives A to Z, respectively.
  1.3069 +                  The default drive is the session default drive represented
  1.3070 +                  by KDefaultDrive.
  1.3071 +@param aDriveName On return, the drive name.
  1.3072 +
  1.3073 +@return KErrNone if successful, otherwise one of the other
  1.3074 +        system-wide error codes.
  1.3075 +
  1.3076 +@see TDriveNumber
  1.3077 +*/
  1.3078 +	{
  1.3079 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveName, MODULEUID, Handle(), aDrive);
  1.3080 +	TInt r = SendReceive(EFsGetDriveName,TIpcArgs(aDrive,&aDriveName));
  1.3081 +
  1.3082 +	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsGetDriveNameReturn, MODULEUID, r, aDriveName);
  1.3083 +	return r;
  1.3084 +	}
  1.3085 +
  1.3086 +
  1.3087 +
  1.3088 +
  1.3089 +EFSRV_EXPORT_C TInt RFs::SetDriveName(TInt aDrive,const TDesC& aDriveName)
  1.3090 +/**
  1.3091 +Sets the name of a drive.
  1.3092 +
  1.3093 +Drive naming is optional. Any drive can be assigned a name, and more than
  1.3094 +one drive can share the same name.
  1.3095 +
  1.3096 +@param aDrive     The drive number. Specify a drive in the range
  1.3097 +                  EDriveA to EDriveZ for drives A to Z, respectively.
  1.3098 +                  Specify KDefaultDrive for the session default drive.
  1.3099 +@param aDriveName The name of the drive, with a maximum of 256 characters.
  1.3100 +                  The name cannot contain the 6 characters < > : " / |
  1.3101 +
  1.3102 +@return KErrNone if successful;
  1.3103 +        KErrBadName, if the name contains illegal characters;
  1.3104 +        otherwise one of the other system-wide error codes.
  1.3105 +
  1.3106 +@capability DiskAdmin
  1.3107 +
  1.3108 +*/
  1.3109 +	{
  1.3110 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveName, MODULEUID, Handle(), aDrive, aDriveName);
  1.3111 +	TInt r = SendReceive(EFsSetDriveName,TIpcArgs(aDrive,&aDriveName));
  1.3112 +
  1.3113 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetDriveNameReturn, MODULEUID, r);
  1.3114 +	return r;
  1.3115 +	}
  1.3116 +
  1.3117 +
  1.3118 +
  1.3119 +
  1.3120 +EFSRV_EXPORT_C TInt RFs::LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStore)
  1.3121 +/**
  1.3122 +Sets the password for the media in the specified drive. 
  1.3123 +
  1.3124 +The media is not necessarily locked afterwards. Accessibility is determined 
  1.3125 +by the following rules:
  1.3126 +
  1.3127 + - The media may not become locked until power is removed (such as with MMC cards)
  1.3128 + - If the password is added to the password store (the aStore parameter is ETrue), the 
  1.3129 +   media will be automatically unlocked on the next access.
  1.3130 +
  1.3131 +@param aDrv   The drive.
  1.3132 +@param aOld   The existing password. If no password is set, this must be a zero-length descriptor.
  1.3133 +@param aNew   The new password.
  1.3134 +@param aStore ETrue if the new password is to be saved to the controller password store; 
  1.3135 +              EFalse if not.
  1.3136 +
  1.3137 +@return KErrNone if successful;
  1.3138 +        KErrNotSupported if the media does not support password locking.
  1.3139 +
  1.3140 +@capability DiskAdmin
  1.3141 +
  1.3142 +*/
  1.3143 +	{
  1.3144 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsLockDrive, MODULEUID, Handle(), aDrv, aStore);
  1.3145 +	TInt r = SendReceive(EFsLockDrive,TIpcArgs(aDrv,&aOld,&aNew,aStore));
  1.3146 +
  1.3147 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsLockDriveReturn, MODULEUID, r);
  1.3148 +	return r;
  1.3149 +	}
  1.3150 +
  1.3151 +
  1.3152 +
  1.3153 +
  1.3154 +EFSRV_EXPORT_C TInt RFs::UnlockDrive(TInt aDrive, const TMediaPassword &aPassword, TBool aStore)
  1.3155 +/**
  1.3156 +Unlocks the media in the specified drive.
  1.3157 +
  1.3158 +The password must be added to the MultiMedia card controller's password store
  1.3159 +so that the controller can subsequently issue the password without the user
  1.3160 +having to be prompted for it again.
  1.3161 +
  1.3162 +@param aDrive    The drive.
  1.3163 +@param aPassword The password.
  1.3164 +@param aStore    Specify ETrue to add the password to the
  1.3165 +                 controller's password store. 
  1.3166 +             
  1.3167 +@return KErrNone, if successful;
  1.3168 +        KErrAccessDenied, if the password is incorrect;
  1.3169 +        KErrAlreadyExists, if the card has already been unlocked;
  1.3170 +        KErrNotSupported, if the media does not support password locking.
  1.3171 +
  1.3172 +@capability DiskAdmin
  1.3173 +
  1.3174 +*/
  1.3175 +	{
  1.3176 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDrive, MODULEUID, Handle(), aDrive, aStore);
  1.3177 +	TInt r = SendReceive(EFsUnlockDrive,TIpcArgs(aDrive,&aPassword,aStore));
  1.3178 +
  1.3179 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsUnlockDriveReturn, MODULEUID, r);
  1.3180 +	return r;
  1.3181 +	}
  1.3182 +
  1.3183 +
  1.3184 +
  1.3185 +
  1.3186 +EFSRV_EXPORT_C TInt RFs::ClearPassword(TInt aDrv, const TMediaPassword &aPswd)
  1.3187 +/**
  1.3188 +Clears the password from the locked MultiMedia card in the specified drive.
  1.3189 +
  1.3190 +Clearing the password causes the MultiMedia card controller to set
  1.3191 +the password to null.
  1.3192 +
  1.3193 +@param aDrv  The drive.
  1.3194 +@param aPswd The current password, which is required to perform this
  1.3195 +             operation.
  1.3196 +             
  1.3197 +@return KErrNone, if successful;
  1.3198 +        KErrAccessDenied, if the password is wrong or the card is still locked;              
  1.3199 +        otherwise one of the other system-wide error codes.
  1.3200 +
  1.3201 +@capability DiskAdmin
  1.3202 +
  1.3203 +*/
  1.3204 +	{
  1.3205 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsClearPassword, MODULEUID, Handle(), aDrv);
  1.3206 +	TInt r = SendReceive(EFsClearPassword,TIpcArgs(aDrv,&aPswd));
  1.3207 +
  1.3208 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsClearPasswordReturn, MODULEUID, r);
  1.3209 +	return r;
  1.3210 +	}
  1.3211 +
  1.3212 +
  1.3213 +
  1.3214 +
  1.3215 +EFSRV_EXPORT_C TInt RFs::ErasePassword(TInt aDrv)
  1.3216 +/**
  1.3217 +Erase the password from the locked MultiMedia card in the specified drive.
  1.3218 +
  1.3219 +Used when the password is unknown, and may result in the media being erased.
  1.3220 +
  1.3221 +Successful execution of this call may result in leaving the media in unformatted state.
  1.3222 +Hence, it is recommended to format the Multimedia card after calling RFs::ErasePassword().
  1.3223 +
  1.3224 +@param aDrv  The drive.
  1.3225 +             
  1.3226 +@return KErrNone, if successful;
  1.3227 +        otherwise one of the other system-wide error codes.
  1.3228 +
  1.3229 +@capability DiskAdmin
  1.3230 +
  1.3231 +*/
  1.3232 +	{
  1.3233 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsErasePassword, MODULEUID, Handle(), aDrv);
  1.3234 +	TInt r = SendReceive(EFsErasePassword,TIpcArgs(aDrv));
  1.3235 +
  1.3236 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsErasePasswordReturn, MODULEUID, r);
  1.3237 +	return r;
  1.3238 +	}
  1.3239 +
  1.3240 +
  1.3241 +
  1.3242 +
  1.3243 +EFSRV_EXPORT_C void RFs::StartupInitComplete(TRequestStatus& aStat)
  1.3244 +/**
  1.3245 +Noifies the file server that startup initialisation is complete.
  1.3246 +
  1.3247 +@param aStat Request status object.
  1.3248 +*/
  1.3249 +//
  1.3250 +// Notify file server that startup initialisation has been completed
  1.3251 +//
  1.3252 +	{
  1.3253 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitComplete, MODULEUID, Handle(), &aStat);
  1.3254 +	aStat=KRequestPending;
  1.3255 +	RSessionBase::SendReceive(EFsStartupInitComplete,aStat);
  1.3256 +
  1.3257 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsStartupInitCompleteReturn, MODULEUID);
  1.3258 +	}
  1.3259 +
  1.3260 +
  1.3261 +
  1.3262 +
  1.3263 +EFSRV_EXPORT_C TInt RFs::SetLocalDriveMapping(const TDesC8& aMapping)
  1.3264 +//
  1.3265 +// Set the local drive mapping
  1.3266 +//
  1.3267 +	{
  1.3268 +	TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMapping, MODULEUID, Handle(), aMapping);
  1.3269 +
  1.3270 +	TInt r = SendReceive(EFsSetLocalDriveMapping,TIpcArgs(&aMapping));
  1.3271 +
  1.3272 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetLocalDriveMappingReturn, MODULEUID, r);
  1.3273 +	return r;
  1.3274 +	}
  1.3275 +
  1.3276 +
  1.3277 +/**
  1.3278 +    Finalise the given drive. This operation is intended to put the drive into the consistent state when it is
  1.3279 +    safe to remove it physically or switch the power off.
  1.3280 +
  1.3281 +    @param  aDriveNo    drive number
  1.3282 +    @param  aMode       describes the finalisation operation, see RFs::TFinaliseDrvMode enum
  1.3283 +
  1.3284 +    @return KErrNone on success,
  1.3285 +            KErrArgument if the function arguments are invalid
  1.3286 +            KErrInUse    if the drive has opened objects (files, directories etc.) and therefore can not be finalised
  1.3287 +            KErrCorrupt  if the drive is corrupt.
  1.3288 +            System wide error codes otherwise.
  1.3289 +
  1.3290 +    @capability DiskAdmin
  1.3291 +*/
  1.3292 +EFSRV_EXPORT_C TInt RFs::FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const
  1.3293 +    {
  1.3294 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrive, MODULEUID, Handle(), aDriveNo, aMode);
  1.3295 +    TInt r = SendReceive(EFsFinaliseDrive,TIpcArgs(aDriveNo, (TInt)aMode));
  1.3296 +
  1.3297 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDriveReturn, MODULEUID, r);
  1.3298 +	return r;
  1.3299 +    }
  1.3300 +
  1.3301 +
  1.3302 +/**
  1.3303 +    Makes the best effort to finalise all drives in the system. 
  1.3304 +    Effectively calls RFs::FinaliseDrive(..., EFinal_RW) to all present drives in the system. This makes impossible to 
  1.3305 +    analyse the error code if the finalisation of some fails.
  1.3306 +    It is much better to use RFs::FinaliseDrive(...) specifying concrete drive number and desired finalisation mode.
  1.3307 +
  1.3308 +    @return KErrNone, if successful; otherwise one of the other system-wide error codes.
  1.3309 +    @capability DiskAdmin
  1.3310 +*/
  1.3311 +EFSRV_EXPORT_C TInt RFs::FinaliseDrives()
  1.3312 +	{
  1.3313 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrives, MODULEUID, Handle());
  1.3314 +	TInt nRes;
  1.3315 +	TDriveList driveList;
  1.3316 +	TDriveInfo driveInfo;
  1.3317 +	
  1.3318 +	nRes=DriveList(driveList);
  1.3319 +	if(nRes != KErrNone)
  1.3320 +		{
  1.3321 +		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, nRes);
  1.3322 +	    return nRes; //-- unable to obtain drives list
  1.3323 +		}
  1.3324 +	
  1.3325 +	//-- walk through all drives in the system sending them "Finalise" request
  1.3326 +	for (TInt i=0; i<KMaxDrives; ++i)
  1.3327 +        {
  1.3328 +	    if(!driveList[i])
  1.3329 +	        continue;   //-- skip unexisting drive
  1.3330 +	    
  1.3331 +	    if(Drive(driveInfo, i) != KErrNone)
  1.3332 +	        continue;   //-- skip this drive, can't get information about it
  1.3333 +        
  1.3334 +        const TUint KDrvAttExclude = KDriveAttRom | KDriveAttRedirected; //-- the drive attributes to exlcude from the finalisation
  1.3335 +
  1.3336 +        if(driveInfo.iDriveAtt & KDrvAttExclude) 
  1.3337 +            continue;
  1.3338 +        	 
  1.3339 +	    nRes = FinaliseDrive(i, EFinal_RW);
  1.3340 +	    }
  1.3341 +	
  1.3342 +
  1.3343 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsFinaliseDrivesReturn, MODULEUID, KErrNone);
  1.3344 +	return 	KErrNone;
  1.3345 +	}
  1.3346 +
  1.3347 +
  1.3348 +
  1.3349 +EFSRV_EXPORT_C TInt RFs::SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const
  1.3350 +/**
  1.3351 +Dismount aOldFileSystemName and mount aNewFileSystemName in an atomic operation
  1.3352 +
  1.3353 +If swapping in the composite filesystem, and no mounts have been added to it,
  1.3354 +then ROFS is added to it by default.  The synchronous state of the composite filesystem
  1.3355 +will be used in preference to that of the old filesystem when it is mounted.
  1.3356 +
  1.3357 +@param aOldFileSystemName The filesystem name that is currently on the drive.
  1.3358 +@param aNewFileSystemName The filesystem name that is to be swapped onto the drive.
  1.3359 +@param aDrive The drive for which the filesystem is to be swapped.
  1.3360 +
  1.3361 +@return KErrNone if successful
  1.3362 +		KErrInUse if a dismount is pending on the drive
  1.3363 +		KErrNotSupported if swapping Z drive with something other then composite or if the drive is asynchronous
  1.3364 +		KErrAlreadyExists if swapping the composite filesystem, and it is already mounted
  1.3365 +		KErrNotFound If the filesystem name provided could not be found.
  1.3366 +		
  1.3367 +@capability DiskAdmin
  1.3368 +*/
  1.3369 +	{
  1.3370 +	TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystem, MODULEUID, Handle(), aOldFileSystemName, aNewFileSystemName, aDrive);
  1.3371 +	TInt r = SendReceive(EFsSwapFileSystem,TIpcArgs(&aNewFileSystemName,aDrive,&aOldFileSystemName));
  1.3372 +
  1.3373 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSwapFileSystemReturn, MODULEUID, r);
  1.3374 +	return r;
  1.3375 +	}
  1.3376 +
  1.3377 +
  1.3378 +EFSRV_EXPORT_C TInt RFs::AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const
  1.3379 +/**
  1.3380 +Adds a local drive to the composite filesystem.  This can only be used before 
  1.3381 +the composite filesystem is mounted.  The local drive is mounted with the
  1.3382 +filesystem provided.  If any local drive added is marked to be asynchronous,
  1.3383 +then the whole composite drive will be treated asynchronous.
  1.3384 +
  1.3385 +@param aFileSystemName The filesystem of the local drive to be added.
  1.3386 +@param aLocalDriveToMount The local drive to be added.
  1.3387 +@param aCompositeDrive The drive the composite filesystem will be mounted on.
  1.3388 +@param aSync If the filesystem added here is preferred to be synchronous.
  1.3389 +
  1.3390 +@return KErrNone if successful
  1.3391 +		KErrNotFound If the filesystem name provided could not be found.
  1.3392 +		KErrNotReady If the composite filesystem has not been initialised.
  1.3393 +		KErrNotSupported If the composite filesystem is already mounted or the parameters passed are unsupported
  1.3394 +		
  1.3395 +@capability DiskAdmin
  1.3396 +*/
  1.3397 +	{
  1.3398 +	TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMount, MODULEUID, 
  1.3399 +		Handle(), aFileSystemName, aLocalDriveToMount, aCompositeDrive, aSync);
  1.3400 +	TInt r = SendReceive(EFsAddCompositeMount,TIpcArgs(&aFileSystemName,aLocalDriveToMount,aCompositeDrive,aSync));
  1.3401 +
  1.3402 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddCompositeMountReturn, MODULEUID, r);
  1.3403 +	return r;
  1.3404 +	}
  1.3405 +
  1.3406 +
  1.3407 +EFSRV_EXPORT_C TInt RFs::ReserveDriveSpace(TInt aDriveNo, TInt aSpace)
  1.3408 +/**
  1.3409 +Reserves an area of a drive. It is intended that sensible (tm) apps will reserve a small
  1.3410 +area of disk for 'emergency' use in case of later out of disk situations. If the amount of 
  1.3411 +reserved space later needs to be readjusted, this method should be called again with 
  1.3412 +aSpace as the amount of extra space needed. 
  1.3413 +
  1.3414 +Once space has been reserved via this method, an application can use RFs::GetReserveAccess
  1.3415 +to gain access to the reserved area prior to executing disk space critical sections of code.
  1.3416 +After the section of code is complete, the application should release access to the reserved
  1.3417 +area.
  1.3418 +
  1.3419 +For internal drives, reserved space will be lost if a reboot occurs. For removeable drives,
  1.3420 +reserved space may be lost if there is a media change.
  1.3421 +
  1.3422 +Reserved space will be cleaned up automatically when the RFs is closed.
  1.3423 +
  1.3424 +Each drive has a max amount of space available to be reserved, and individual sessions also 
  1.3425 +have a max amount of space. These are defined in f32/sfile/sf_std.h as KMaxTotalDriveReserved
  1.3426 +and KMaxSessionDriveReserved respectively. Once space is reserved, it is only available to 
  1.3427 +the reserving session until that session releases the reserved space.
  1.3428 +
  1.3429 +@param aDriveNo Which drive to reserve space on
  1.3430 +
  1.3431 +@param aSpace Amount of space to reserve
  1.3432 +
  1.3433 +@return KErrNone if successful
  1.3434 +        KErrInUse if the session already has reserved access
  1.3435 +        KErrArgument if aSpace is invalid (greater than KMaxSessionDriveReserved, negative number, etc.)
  1.3436 +        KErrDiskFull if insufficient space is left on the drive to service the request
  1.3437 +        KErrTooBig if this request would overflow the available reserve (greater than KMaxTotalDriveReserved)
  1.3438 +        any of the possible error return codes from TDrive::Volume()
  1.3439 +*/
  1.3440 +	{
  1.3441 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpace, MODULEUID, Handle(), aDriveNo, aSpace);
  1.3442 +	TInt r = SendReceive(EFsReserveDriveSpace, TIpcArgs(aDriveNo, aSpace));
  1.3443 +
  1.3444 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReserveDriveSpaceReturn, MODULEUID, r);
  1.3445 +	return r;
  1.3446 +	}
  1.3447 +
  1.3448 +
  1.3449 +
  1.3450 +
  1.3451 +EFSRV_EXPORT_C TInt RFs::GetReserveAccess(TInt aDriveNo)
  1.3452 +/**
  1.3453 +Get exclusive access for this session to overwrite a specific disk area, which has previously
  1.3454 +been reserved via RFs::ReserveDriveSpace
  1.3455 +
  1.3456 +@param aDriveNo drive on which to get reserved access
  1.3457 +
  1.3458 +@return KErrNone if successful
  1.3459 +        KErrPermissionDenied if the drive has no spare reserved space
  1.3460 +*/
  1.3461 +	{
  1.3462 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccess, MODULEUID, Handle(), aDriveNo);
  1.3463 +	TInt r = SendReceive(EFsGetReserveAccess, TIpcArgs(aDriveNo));
  1.3464 +
  1.3465 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsGetReserveAccessReturn, MODULEUID, r);
  1.3466 +	return r;
  1.3467 +	}
  1.3468 +
  1.3469 +EFSRV_EXPORT_C TInt RFs::ReleaseReserveAccess(TInt aDriveNo)
  1.3470 +/**
  1.3471 +Release exclusive access for this session to overwrite a specific disk area.
  1.3472 +
  1.3473 +@param aDriveNo drive on which to release reserved access
  1.3474 +
  1.3475 +@return KErrNone (always returned)
  1.3476 +
  1.3477 +*/
  1.3478 +	{
  1.3479 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccess, MODULEUID, Handle(), aDriveNo);
  1.3480 +	TInt r = SendReceive(EFsReleaseReserveAccess, TIpcArgs(aDriveNo));
  1.3481 +
  1.3482 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsReleaseReserveAccessReturn, MODULEUID, r);
  1.3483 +	return r;
  1.3484 +	}
  1.3485 +
  1.3486 +
  1.3487 +
  1.3488 +
  1.3489 +/**
  1.3490 +    Controls file system dismounting on the specified drive, the way of control depends on the parameter TNotifyDismountMode. 
  1.3491 +    
  1.3492 +    This API allows interested parties to:
  1.3493 +        1.  Subscribe for notification of file system dismounting events.
  1.3494 +            This allows subscribers to commit their data to the media prior to the file system being dismounted.
  1.3495 +            See TNotifyDismountMode::EFsDismountRegisterClient
  1.3496 +
  1.3497 +        2.  Make a graceful attempt to dismount the file system by notifying the subscribers about a pending file system dismount
  1.3498 +            and waiting until all subscribers have finished processing the notification and have signaled that they are ready. 
  1.3499 +            If all clients don't respond in a reasonable time, the dismount request may be cancelled, followed by a forced dismount.
  1.3500 +            If some client does not subscribe for dismounting notification and keeps handles opened, then after the file system dismounting all these
  1.3501 +            handles will become invalid, any subsequent attempts to use them will result in KErrDismounted, and they should be closed(e.g. RFile::Close()). 
  1.3502 +            See TNotifyDismountMode::EFsDismountNotifyClients
  1.3503 +
  1.3504 +        3.  Dismount the file system by force even if there are opened handles (files, directories) on the volume being dismounted. 
  1.3505 +            Any clients that kept handles opened, after forced file system dismounting will have them invalidated. And any further attempts to use 
  1.3506 +            these handles will result in KErrDismounted, and they should be closed(e.g. RFile::Close()). 
  1.3507 +            See TNotifyDismountMode::EFsDismountForceDismount
  1.3508 +
  1.3509 +        * If there are clamped files on the volume, the file system dismounting will not happen until these files are unclamped.     
  1.3510 +           
  1.3511 +
  1.3512 +    The use case scenario:
  1.3513 +    A 'Master' application that wants to dismount the file system on some drive 'aDrive'
  1.3514 +    'Client1' and 'Client2' applications interested in file system dismount event notifications, because they need to commit their data before the file system is dismounted.
  1.3515 +        
  1.3516 +        1.  'Client1' and 'Client2' subscribe to the FS dismount notification using EFsDismountRegisterClient and start waiting on the request status objects.
  1.3517 +        2.  'Master' decides to dismount the file system on the drive 'aDrive'.
  1.3518 +            2.1 Graceful attempt: 'Master' calls RFs::NotifyDismount() with EFsDismountNotifyClients and starts waiting on 'aStat' for some time until all 'Client1' and 'Client2' respond or timeout occurs.
  1.3519 +        
  1.3520 +        3.  'Client1' and 'Client2' have their 'aStat' completed as the result of the 'Master' calling EFsDismountNotifyClients.
  1.3521 +            3.1 'Client1' and 'Client2' flush data and close file handles.
  1.3522 +            3.2 as soon as 'Client1' and 'Client2' decide that they are ready for the pending FS dismount, they signal the 'Master' that they are ready by calling RFs::AllowDismount()
  1.3523 +
  1.3524 +        4.  As soon as _all_ subscribed clients ('Client1' and 'Client2') have called RFs::AllowDismount(), the file system on drive 'aDrive' is 
  1.3525 +            dismounted and 'Master' has 'aStat' completed.
  1.3526 +
  1.3527 +        If, for example, 'Client2' hasn't responded in a reasonable time by calling RFs::AllowDismount(), the 'Master' can cancel the pending 'aStat' and
  1.3528 +        dismount the file system by force by calling this API with EFsDismountForceDismount. 
  1.3529 +        In this case all subsequent attempts by 'Client2' to use its opened handles will result in KErrDismounted; these handles should be closed.
  1.3530 +
  1.3531 +
  1.3532 +
  1.3533 +    @param aDriveNo The drive on which to request dismount
  1.3534 +    @param aMode    specifies the behaviour of the notification API
  1.3535 +    @param aStat    Asynchronous request state.
  1.3536 +*/
  1.3537 +EFSRV_EXPORT_C void RFs::NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode /*=EFsDismountRegisterClient*/) const
  1.3538 +	{
  1.3539 +	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismount, MODULEUID, Handle(), aDrive, &aStat, aMode);
  1.3540 +	aStat = KRequestPending;
  1.3541 +	RSessionBase::SendReceive(EFsNotifyDismount, TIpcArgs(aDrive,aMode,&aStat), aStat);
  1.3542 +	// This call is to synchronise with the driver thread as the corresponding cancel function (NotifyDismountCancel)
  1.3543 +	// is synchronous, so it can complete before this notify request has even been added to TDismountNotifyQue.
  1.3544 +	// This call guarantees that the notify request has been added to queue.
  1.3545 +	SendReceive(EFsSynchroniseDriveThread, TIpcArgs(aDrive));
  1.3546 +
  1.3547 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountReturn, MODULEUID);
  1.3548 +	}
  1.3549 +
  1.3550 +
  1.3551 +
  1.3552 +
  1.3553 +/**
  1.3554 +    Cancels the oustanding dismount notifier, completing with KErrCancel.
  1.3555 + 
  1.3556 +    @param aStat The request status object associated with the request to be cancelled.
  1.3557 +
  1.3558 +    @see RFs::NotifyDismount
  1.3559 +*/
  1.3560 +EFSRV_EXPORT_C void RFs::NotifyDismountCancel(TRequestStatus& aStat) const
  1.3561 +	{
  1.3562 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1, MODULEUID, Handle(), &aStat);
  1.3563 +	
  1.3564 +	if (aStat == KRequestPending)
  1.3565 +		SendReceive(EFsNotifyDismountCancel, TIpcArgs(&aStat));
  1.3566 +
  1.3567 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel1Return, MODULEUID);
  1.3568 +	}
  1.3569 +
  1.3570 +
  1.3571 +
  1.3572 +/**
  1.3573 +    Cancels all oustanding dismount notifiers for this session, completing with KErrCancel.
  1.3574 +
  1.3575 +    @see RFs::NotifyDismount
  1.3576 +*/
  1.3577 +EFSRV_EXPORT_C void RFs::NotifyDismountCancel() const
  1.3578 +	{
  1.3579 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2, MODULEUID, Handle());
  1.3580 +
  1.3581 +	SendReceive(EFsNotifyDismountCancel, TIpcArgs(NULL));
  1.3582 +
  1.3583 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsNotifyDismountCancel2Return, MODULEUID);
  1.3584 +	}
  1.3585 +
  1.3586 +
  1.3587 +
  1.3588 +
  1.3589 +/**
  1.3590 +    Used by a client to indicate that it is safe to dismount the file system. This should be called after receiving a pending media removal notification.
  1.3591 +
  1.3592 +    Not calling this does not guarantee that the dismount will not occur as the application requesting the dismount may decide to forcibly dismount
  1.3593 +    after a given timeout period.
  1.3594 +
  1.3595 +    @param aDriveNo The drive on which to allow the dismount.
  1.3596 +
  1.3597 +    @return KErrNone if successful
  1.3598 +
  1.3599 +    @see RFs::NotifyDismount
  1.3600 +*/
  1.3601 +EFSRV_EXPORT_C TInt RFs::AllowDismount(TInt aDrive) const
  1.3602 +	{
  1.3603 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismount, MODULEUID, Handle(), aDrive);
  1.3604 +	TInt r = SendReceive(EFsAllowDismount, TIpcArgs(aDrive));
  1.3605 +
  1.3606 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAllowDismountReturn, MODULEUID, r);
  1.3607 +	return r;
  1.3608 +	}
  1.3609 +
  1.3610 +EFSRV_EXPORT_C TInt RFs::SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const
  1.3611 +/**
  1.3612 +@publishedPartner
  1.3613 +@release
  1.3614 +
  1.3615 +Only can be called in estart. Licensees could use this function to configure
  1.3616 +file server at startup through their own version of estart.
  1.3617 +
  1.3618 +Currently only loader thread priority can be specified.
  1.3619 +
  1.3620 +@param aCommand Command indicating what aspect of file server should be configured.
  1.3621 +       aParam1 Command specific parameter.
  1.3622 +       aParam2 Command specific parameter.
  1.3623 +
  1.3624 +@return KErrNone if successful, KErrPermissionDenied if called outside estart
  1.3625 +*/
  1.3626 +    {
  1.3627 +	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfiguration, MODULEUID, Handle(), aCommand, aParam1, aParam2);
  1.3628 +    TInt r = SendReceive(EFsSetStartupConfiguration, TIpcArgs(aCommand,aParam1,aParam2));
  1.3629 +
  1.3630 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetStartupConfigurationReturn, MODULEUID, r);
  1.3631 +	return r;
  1.3632 +    }
  1.3633 +
  1.3634 +
  1.3635 +EFSRV_EXPORT_C TInt RFs::SetNotifyChange(TBool aNotifyChange)
  1.3636 +/**
  1.3637 +Enables/Disables change notification on a per-session basis.  Change notification is enabled
  1.3638 +by default, and can be disabled using this API.  Disabling change notification will result in
  1.3639 +clients of the file server not being notified of events such as directory/file changes.
  1.3640 +  
  1.3641 +@param aNotifyChange ETrue to enable change notifications, EFalse to disable.
  1.3642 +
  1.3643 +@return KErrNone if successful.
  1.3644 +
  1.3645 +@capability DiskAdmin
  1.3646 +        
  1.3647 +@see RFs::NotifyChange
  1.3648 + */
  1.3649 +	{
  1.3650 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChange, MODULEUID, Handle(), aNotifyChange);
  1.3651 +	TInt r = SendReceive(EFsSetSessionFlags, TIpcArgs(aNotifyChange ? EFsSessionNotifyChange: 0, aNotifyChange ? 0 : EFsSessionNotifyChange));
  1.3652 +
  1.3653 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsSetNotifyChangeReturn, MODULEUID, r);
  1.3654 +	return r;
  1.3655 +	}
  1.3656 +
  1.3657 +
  1.3658 +TInt RFs::Unclamp(const RFileClamp& aHandle)
  1.3659 +/**
  1.3660 +Makes available for paging-out the media space occupied by the file identified by
  1.3661 +the supplied handle.
  1.3662 +  
  1.3663 +@param aHandle handle to the file on the media.
  1.3664 +
  1.3665 +@return KErrNone if successful.
  1.3666 +
  1.3667 +@capability ???
  1.3668 +        
  1.3669 +@see RFile::Clamp
  1.3670 + */
  1.3671 +	{
  1.3672 +	TPckg<RFileClamp> pkHandle(aHandle);
  1.3673 +	return SendReceive(EFsUnclamp, TIpcArgs(& pkHandle));
  1.3674 +	}
  1.3675 +
  1.3676 +EFSRV_EXPORT_C TInt RFs::InitialisePropertiesFile(const TPtrC8& aPtr) const
  1.3677 +/**
  1.3678 +Sets the F32 properties file - Can only be called from the ESTART process
  1.3679 +
  1.3680 +@param aPtr A descriptor pointing to an INI file in ROM.
  1.3681 +
  1.3682 +@return KErrNone if successful.
  1.3683 +
  1.3684 +@capability KDiskAdmin
  1.3685 +*/
  1.3686 +	{
  1.3687 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFile, MODULEUID, Handle(), aPtr.Ptr(), aPtr.Length());
  1.3688 +	TInt r = SendReceive(EFsInitialisePropertiesFile, TIpcArgs(aPtr.Ptr(), aPtr.Length(), ETrue));
  1.3689 +
  1.3690 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsInitialisePropertiesFileReturn, MODULEUID, r);
  1.3691 +	return r;
  1.3692 +	}
  1.3693 +
  1.3694 +EFSRV_EXPORT_C TInt RFs::QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const
  1.3695 +/**
  1.3696 +@internalTechnology
  1.3697 +Queries specific information on volumes by commands. Available commands is defined by TQueryVolumeInfoExtCmd.
  1.3698 +
  1.3699 +@param aDriveNo The drive on which to query information.
  1.3700 +@param aCommand A command to specify which information is under query
  1.3701 +@param aInfo A TPckgBuf<> to carry returned results.
  1.3702 +
  1.3703 +@return KErrNone if successful; otherwise another system-wide error code is returned.
  1.3704 +        
  1.3705 +@see TQueryVolumeInfoExtCmd
  1.3706 +@see TVolumeIOParamInfo
  1.3707 + */
  1.3708 +	{
  1.3709 +	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExt, MODULEUID, Handle(), aDrive, aCommand);
  1.3710 +	TInt r = SendReceive(EFsQueryVolumeInfoExt, TIpcArgs(aDrive, aCommand, &aInfo));
  1.3711 +
  1.3712 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsQueryVolumeInfoExtReturn, MODULEUID, r);
  1.3713 +	return r;
  1.3714 +	}
  1.3715 +
  1.3716 +
  1.3717 +EFSRV_EXPORT_C TInt RFs::VolumeIOParam(TInt aDrive, TVolumeIOParamInfo& aParamInfo) const
  1.3718 +/**
  1.3719 +This function queries a set of I/O parameters on the specified volume, this includes the block size of underlying media,
  1.3720 +cluster size of the mounted file system and the recommended read/write buffer sizes. 
  1.3721 +
  1.3722 +The volume information is retuned through aParamInfo. Even if VolumeIOParam() returns successful, errors 
  1.3723 +can effect the return value of each field within aParamInfo.
  1.3724 +
  1.3725 +@param aDrive A drive number, specifies which volume to query.
  1.3726 +@param aParamInfo A TVolumeIOParamInfo containing the volume parameters.
  1.3727 +
  1.3728 +@return KErrNone if successful; otherwise, another system wide error code is returned.
  1.3729 +*/
  1.3730 +	{
  1.3731 +	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParam, MODULEUID, Handle(), aDrive);
  1.3732 +
  1.3733 +	TInt r = KErrNone;
  1.3734 +
  1.3735 +	if (!IsValidDrive(aDrive))
  1.3736 +		r = KErrArgument;
  1.3737 +	
  1.3738 +	if (r == KErrNone)
  1.3739 +		{
  1.3740 +		TPckgBuf<TVolumeIOParamInfo> infoPckg;
  1.3741 +		r = QueryVolumeInfoExt(aDrive, EIOParamInfo, infoPckg);
  1.3742 +		if (r == KErrNone)
  1.3743 +			aParamInfo = infoPckg();
  1.3744 +		}
  1.3745 +
  1.3746 +	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFsVolumeIOParamReturn, MODULEUID, 
  1.3747 +		r, aParamInfo.iBlockSize, aParamInfo.iClusterSize, aParamInfo.iRecReadBufSize, aParamInfo.iRecWriteBufSize);
  1.3748 +	return r;
  1.3749 +	}
  1.3750 +
  1.3751 +
  1.3752 +/**
  1.3753 +    This function queries the sub type of the file system mounted on the specified volume. For example, 'FAT16' of the Fat file system. 
  1.3754 +    TFSName is recommended as the type for aName when using this function.
  1.3755 +
  1.3756 +    NOTE: For the file systems without a sub type (e.g. ROM file system), the  the file system name is returned (For example, 'Rom').
  1.3757 +    Examples:
  1.3758 +        "FAT"   file system; the subtypes can be "fat12", "fat16" or "fat32"
  1.3759 +        "ROFS"  file system; the subtype will be "ROFS"
  1.3760 +
  1.3761 +    Note also that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. 
  1.3762 +    "fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF())
  1.3763 +    shall be used to deal with the names.
  1.3764 +
  1.3765 +
  1.3766 +    @param  aDrive  drive number, specifies which volume to query.
  1.3767 +    @param  aName   descriptor containing the returned sub type name or file system name.
  1.3768 +
  1.3769 +    @return KErrNone if successful; KErrNotSuppoted if sub type is not supported; 
  1.3770 +		    otherwise another system-wide error code is returned.
  1.3771 +
  1.3772 +    @see TFSName
  1.3773 +*/
  1.3774 +EFSRV_EXPORT_C TInt RFs::FileSystemSubType(TInt aDrive, TDes& aName) const
  1.3775 +	{
  1.3776 +	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubType, MODULEUID, Handle(), aDrive, aName);
  1.3777 +
  1.3778 +	TInt r = KErrNone;
  1.3779 +
  1.3780 +	if (!IsValidDrive(aDrive))
  1.3781 +		r = KErrArgument;
  1.3782 +		
  1.3783 +	if (r == KErrNone)
  1.3784 +		{
  1.3785 +		TPckgBuf<TFSName> namePckg;
  1.3786 +		r = QueryVolumeInfoExt(aDrive, EFileSystemSubType, namePckg);
  1.3787 +		if (r == KErrNone || r == KErrNotSupported)
  1.3788 +			aName = namePckg();
  1.3789 +		}
  1.3790 +
  1.3791 +	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubTypeReturn, MODULEUID, r);
  1.3792 +	return r;
  1.3793 +	}
  1.3794 +
  1.3795 +EXPORT_C TInt RFs::AddProxyDrive(const TDesC& aFileName)
  1.3796 +/**
  1.3797 +Loads the specified extension.
  1.3798 +
  1.3799 +@param aFileName The file name of the extension
  1.3800 +
  1.3801 +@return KErrNone, if successful; otherwise one of the other system wide error codes.
  1.3802 +*/
  1.3803 +	{
  1.3804 +	RLoader loader;
  1.3805 +	TInt r = loader.Connect();
  1.3806 +	if (r==KErrNone)
  1.3807 +		{
  1.3808 +		r = loader.SendReceive(ELoadFSProxyDrive, TIpcArgs(0, &aFileName, 0));
  1.3809 +		loader.Close();
  1.3810 +		}
  1.3811 +	return r;
  1.3812 +	}
  1.3813 +
  1.3814 +
  1.3815 +EXPORT_C TInt RFs::RemoveProxyDrive(const TDesC& aExtensionName)
  1.3816 +/**
  1.3817 +Removes the specified extension.
  1.3818 +
  1.3819 +@param aExtensionName The fullname of the extension, as returned from
  1.3820 +                      a call to ExtensionName().
  1.3821 +
  1.3822 +@return KErrNone, if successful;
  1.3823 +	KErrInUse if there are still drives mounted that are using it
  1.3824 +       KErrNotFound, if aExtensionName is not found;
  1.3825 +       otherwise one of the other system-wide error codes.
  1.3826 +*/
  1.3827 +	{
  1.3828 +	return(SendReceive(EFsRemoveProxyDrive,TIpcArgs(&aExtensionName)));
  1.3829 +	}
  1.3830 +
  1.3831 +/**
  1.3832 +Initialises a proxy drive.
  1.3833 +
  1.3834 +@param aProxyDriveNumber drive number that will be used to mount the proxy drive
  1.3835 +@param aName name of the proxy drive extension
  1.3836 +@param anInfo initialisation information to be passed to the proxy drive extension to initialise the drive
  1.3837 +
  1.3838 +@return If succesful the internal drive number used to represent the drive (equivalent to a local drive 
  1.3839 +		number for normal drives) This number is obtained dynmically. The number will range between KMaxLocalDrives
  1.3840 +		and KMaxDrives. 
  1.3841 +		KErrInUse if aProxyDriveNumber is in use or if there are not proxy drive numbers left
  1.3842 +		KErrArgument if aProxyDriveNumber or aName are invalid 
  1.3843 +		Any other system wide error code.
  1.3844 +		
  1.3845 +
  1.3846 +*/
  1.3847 +EXPORT_C TInt RFs::DoMountProxyDrive(const TIpcArgs& ipcArgs)
  1.3848 +	{
  1.3849 +	return SendReceive(EFsMountProxyDrive, ipcArgs);
  1.3850 +	}
  1.3851 +
  1.3852 +
  1.3853 +EXPORT_C TInt RFs::DismountProxyDrive(const TUint aProxyDriveNumber)
  1.3854 +/**
  1.3855 +Dismounts a proxy drive.
  1.3856 +
  1.3857 +@param aProxyDriveNumber drive number that will be used to mount the proxy drive
  1.3858 +@param aName name of the proxy drive extension
  1.3859 +@param anInfo initialisation information to be passed to the proxy drive extension to initialise the drive
  1.3860 +
  1.3861 +@return If succesful the internal drive number used to represent the drive (equivalent to a local drive 
  1.3862 +		number for normal drives) This number is obtained dynmically. The number will range between KMaxLocalDrives
  1.3863 +		and KMaxDrives. 
  1.3864 +		KErrInUse if aProxyDriveNumber is in use or if there are not proxy drive numbers left
  1.3865 +		KErrArgument if aProxyDriveNumber or aName are invalid 
  1.3866 +		Any other system wide error code.
  1.3867 +		
  1.3868 +
  1.3869 +*/
  1.3870 +	{
  1.3871 +	return SendReceive(EFsDismountProxyDrive,TIpcArgs(aProxyDriveNumber));
  1.3872 +	}
  1.3873 +
  1.3874 +EFSRV_EXPORT_C void RFs::Close()
  1.3875 +	{
  1.3876 +	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFsClose, MODULEUID, Handle());
  1.3877 +	RFTRACE_CLOSE;
  1.3878 +
  1.3879 +	RSessionBase::Close();
  1.3880 +
  1.3881 +	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFsCloseReturn, MODULEUID);
  1.3882 +	}
  1.3883 +
  1.3884 +