sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\sfat\sl_fsy.cpp sl@0: // sl@0: // sl@0: sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sl@0: //!! sl@0: //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it sl@0: //!! sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sl@0: //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! sl@0: sl@0: #include "sl_std.h" sl@0: #include sl@0: sl@0: CFatFileSystem* CFatFileSystem::New() sl@0: // sl@0: // Create a FatFileSystem sl@0: // sl@0: { sl@0: CFatFileSystem* fatfsys=new CFatFileSystem(); sl@0: if (fatfsys==NULL) sl@0: return(NULL); sl@0: sl@0: return fatfsys; sl@0: } sl@0: sl@0: sl@0: CFatFileSystem::CFatFileSystem() : iUseLocalTimeIfRemovable(EFalse) sl@0: // sl@0: // Construct the file system sl@0: // sl@0: { sl@0: } sl@0: sl@0: CFatFileSystem::~CFatFileSystem() sl@0: // sl@0: // Destructor sl@0: // sl@0: { sl@0: } sl@0: sl@0: TInt CFatFileSystem::Install() sl@0: // sl@0: // Install the file system sl@0: // sl@0: { sl@0: iVersion=TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber); sl@0: sl@0: // Read in setting from the config file to possibly make file server sl@0: // use local time. sl@0: _LIT8(KFatConfigSection, "FatConfig"); sl@0: _LIT8(KLocalTimeIfRemovable, "LocalTimeIfRemovable"); sl@0: F32Properties::GetBool(KFatConfigSection, KLocalTimeIfRemovable, iUseLocalTimeIfRemovable); sl@0: sl@0: return(SetName(&KFileSystemName_FAT)); sl@0: } sl@0: sl@0: CMountCB* CFatFileSystem::NewMountL() const sl@0: // sl@0: // Create a new mount control block. sl@0: // sl@0: { sl@0: sl@0: return(CFatMountCB::NewL()); sl@0: } sl@0: sl@0: CFileCB* CFatFileSystem::NewFileL() const sl@0: // sl@0: // Create a new file. sl@0: // sl@0: { sl@0: sl@0: return(new(ELeave) CFatFileCB()); sl@0: } sl@0: sl@0: CDirCB* CFatFileSystem::NewDirL() const sl@0: // sl@0: // Create a new directory lister. sl@0: // sl@0: { sl@0: sl@0: return(CFatDirCB::NewL()); sl@0: } sl@0: sl@0: CFormatCB* CFatFileSystem::NewFormatL() const sl@0: // sl@0: // Create a new media formatter. sl@0: // sl@0: { sl@0: sl@0: return (new(ELeave) CFatFormatCB()); sl@0: } sl@0: sl@0: TInt CFatFileSystem::DefaultPath(TDes& aPath) const sl@0: // sl@0: // Return the initial default path. sl@0: // sl@0: { sl@0: sl@0: aPath=_L("?:\\"); sl@0: aPath[0] = (TUint8) RFs::GetSystemDriveChar(); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: sl@0: void CFatFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const sl@0: // sl@0: // Return the drive info. iBatteryState are already set. sl@0: // sl@0: { sl@0: sl@0: if(!IsValidLocalDriveMapping(aDriveNumber)) sl@0: return; sl@0: sl@0: TLocalDriveCapsV2Buf localDriveCaps; sl@0: sl@0: TInt r = KErrNone; sl@0: sl@0: // is the drive local? sl@0: if (!IsProxyDrive(aDriveNumber)) sl@0: { sl@0: // if not valid local drive, use default values in localDriveCaps sl@0: // if valid local drive and not locked, use TBusLocalDrive::Caps() values sl@0: // if valid drive and locked, hard-code attributes sl@0: r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps); sl@0: } sl@0: else // this need to be made a bit nicer sl@0: { sl@0: CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); sl@0: if(pD) sl@0: r = pD->Caps(localDriveCaps); sl@0: else sl@0: r = KErrNotReady; // What should the behaviour really be here? sl@0: } sl@0: sl@0: if (r != KErrLocked ) sl@0: { sl@0: anInfo.iMediaAtt=localDriveCaps().iMediaAtt; sl@0: } sl@0: else sl@0: { sl@0: anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword; sl@0: } sl@0: sl@0: anInfo.iType=localDriveCaps().iType; sl@0: anInfo.iDriveAtt=localDriveCaps().iDriveAtt; sl@0: } sl@0: sl@0: sl@0: TBool CFatFileSystem::IsExtensionSupported() const sl@0: // sl@0: // sl@0: // sl@0: { sl@0: return(ETrue); sl@0: } sl@0: sl@0: TBool CFatFileSystem::GetUseLocalTime() const sl@0: { sl@0: return iUseLocalTimeIfRemovable; sl@0: } sl@0: sl@0: void CFatFileSystem::SetUseLocalTime(TBool aFlag) sl@0: { sl@0: iUseLocalTimeIfRemovable = aFlag; sl@0: } sl@0: sl@0: /** sl@0: Reports whether the specified interface is supported - if it is, sl@0: the supplied interface object is modified to it sl@0: sl@0: @param aInterfaceId The interface of interest sl@0: @param aInterface The interface object sl@0: @return KErrNone if the interface is supported, otherwise KErrNotFound sl@0: sl@0: @see CFileSystem::GetInterface() sl@0: */ sl@0: TInt CFatFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput) sl@0: { sl@0: switch(aInterfaceId) sl@0: { sl@0: case CFileSystem::EProxyDriveSupport: // The FAT Filesystem supports proxy drives sl@0: return KErrNone; sl@0: sl@0: default: sl@0: return(CFileSystem::GetInterface(aInterfaceId, aInterface, aInput)); sl@0: } sl@0: }