userlibandfileserver/fileserver/sfat/sl_fsy.cpp
changeset 15 4122176ea935
parent 0 a41df078684a
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
    13 // Description:
    13 // Description:
    14 // f32\sfat\sl_fsy.cpp
    14 // f32\sfat\sl_fsy.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
       
    18 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    19 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    20 //!!
       
    21 //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
       
    22 //!!
       
    23 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    24 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    25 
    18 #include "sl_std.h"
    26 #include "sl_std.h"
    19 #include <e32hal.h>
    27 #include <e32hal.h>
    20 
    28 
    21 CFatFileSystem* CFatFileSystem::New()
    29 CFatFileSystem* CFatFileSystem::New()
    22 //
    30 //
    23 // Create a FatFileSystem 
    31 // Create a FatFileSystem 
    24 //
    32 //
    25 	{
    33     {
    26 	CFatFileSystem* fatfsys=new CFatFileSystem();
    34     CFatFileSystem* fatfsys=new CFatFileSystem();
    27 	if (fatfsys==NULL)
    35     if (fatfsys==NULL)
    28 		return(NULL);
    36         return(NULL);
    29 
    37 
    30 	return fatfsys;
    38     return fatfsys;
    31 	}
    39     }
    32 
    40 
    33 
    41 
    34 CFatFileSystem::CFatFileSystem() : iUseLocalTimeIfRemovable(EFalse)
    42 CFatFileSystem::CFatFileSystem() : iUseLocalTimeIfRemovable(EFalse)
    35 //
    43 //
    36 // Construct the file system
    44 // Construct the file system
    37 //
    45 //
    38 	{
    46     {
    39 	}	
    47     }   
    40 
    48 
    41 CFatFileSystem::~CFatFileSystem()
    49 CFatFileSystem::~CFatFileSystem()
    42 //
    50 //
    43 // Destructor
    51 // Destructor
    44 //
    52 //
    45 	{
    53     {
    46 	}
    54     }
    47 
    55 
    48 TInt CFatFileSystem::Install()
    56 TInt CFatFileSystem::Install()
    49 //
    57 //
    50 // Install the file system
    58 // Install the file system
    51 //
    59 //
    52 	{
    60     {
    53 	iVersion=TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber);
    61     iVersion=TVersion(KF32MajorVersionNumber,KF32MinorVersionNumber,KF32BuildVersionNumber);
    54 
    62 
    55 	// Read in setting from the config file to possibly make file server 
    63     // Read in setting from the config file to possibly make file server 
    56  	// use local time.
    64     // use local time.
    57  	_LIT8(KFatConfigSection, "FatConfig");
    65     _LIT8(KFatConfigSection, "FatConfig");
    58  	_LIT8(KLocalTimeIfRemovable, "LocalTimeIfRemovable");
    66     _LIT8(KLocalTimeIfRemovable, "LocalTimeIfRemovable");
    59  	F32Properties::GetBool(KFatConfigSection, KLocalTimeIfRemovable, iUseLocalTimeIfRemovable);
    67     F32Properties::GetBool(KFatConfigSection, KLocalTimeIfRemovable, iUseLocalTimeIfRemovable);
    60 
    68 
    61 	return(SetName(&KFileSystemName_FAT));
    69     return(SetName(&KFileSystemName_FAT));
    62 	}
    70     }
    63 
    71 
    64 CMountCB* CFatFileSystem::NewMountL() const
    72 CMountCB* CFatFileSystem::NewMountL() const
    65 //
    73 //
    66 // Create a new mount control block.
    74 // Create a new mount control block.
    67 //
    75 //
    68 	{
    76     {
    69 
    77 
    70 	return(CFatMountCB::NewL());
    78     return(CFatMountCB::NewL());
    71 	}
    79     }
    72 
    80 
    73 CFileCB* CFatFileSystem::NewFileL() const
    81 CFileCB* CFatFileSystem::NewFileL() const
    74 //
    82 //
    75 // Create a new file.
    83 // Create a new file.
    76 //
    84 //
    77 	{
    85     {
    78 
    86 
    79 	return(new(ELeave) CFatFileCB());
    87     return(new(ELeave) CFatFileCB());
    80 	}
    88     }
    81 
    89 
    82 CDirCB* CFatFileSystem::NewDirL() const
    90 CDirCB* CFatFileSystem::NewDirL() const
    83 //
    91 //
    84 // Create a new directory lister.
    92 // Create a new directory lister.
    85 //
    93 //
    86 	{
    94     {
    87 
    95 
    88 	return(CFatDirCB::NewL());
    96     return(CFatDirCB::NewL());
    89 	}
    97     }
    90 
    98 
    91 CFormatCB* CFatFileSystem::NewFormatL() const
    99 CFormatCB* CFatFileSystem::NewFormatL() const
    92 //
   100 //
    93 // Create a new media formatter.
   101 // Create a new media formatter.
    94 //
   102 //
    95 	{
   103     {
    96 
   104 
    97 	return (new(ELeave) CFatFormatCB());
   105     return (new(ELeave) CFatFormatCB());
    98 	}
   106     }
    99 
   107 
   100 TInt CFatFileSystem::DefaultPath(TDes& aPath) const
   108 TInt CFatFileSystem::DefaultPath(TDes& aPath) const
   101 //
   109 //
   102 // Return the initial default path.
   110 // Return the initial default path.
   103 //
   111 //
   104 	{
   112     {
   105 
   113 
   106 	aPath=_L("?:\\");
   114     aPath=_L("?:\\");
   107 	aPath[0] = (TUint8) RFs::GetSystemDriveChar();
   115     aPath[0] = (TUint8) RFs::GetSystemDriveChar();
   108 	return(KErrNone);
   116     return(KErrNone);
   109 	}
   117     }
   110 
   118 
   111 
   119 
   112 void CFatFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const
   120 void CFatFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const
   113 //
   121 //
   114 // Return the drive info. iBatteryState are already set.
   122 // Return the drive info. iBatteryState are already set.
   115 //
   123 //
   116 	{
   124     {
   117 
   125 
   118 	if(!IsValidLocalDriveMapping(aDriveNumber))
   126     if(!IsValidLocalDriveMapping(aDriveNumber))
   119 		return;
   127         return;
   120 
   128 
   121     TLocalDriveCapsV2Buf localDriveCaps;
   129     TLocalDriveCapsV2Buf localDriveCaps;
   122 	
   130     
   123 	TInt r = KErrNone;
   131     TInt r = KErrNone;
   124 
   132 
   125 	// is the drive local?
   133     // is the drive local?
   126 	if (!IsProxyDrive(aDriveNumber))
   134     if (!IsProxyDrive(aDriveNumber))
   127 		{
   135         {
   128 		// if not valid local drive, use default values in localDriveCaps
   136         // if not valid local drive, use default values in localDriveCaps
   129 		// if valid local drive and not locked, use TBusLocalDrive::Caps() values
   137         // if valid local drive and not locked, use TBusLocalDrive::Caps() values
   130 		// if valid drive and locked, hard-code attributes
   138         // if valid drive and locked, hard-code attributes
   131 		r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps);
   139         r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps);
   132 		}
   140         }
   133 	else  // this need to be made a bit nicer
   141     else  // this need to be made a bit nicer
   134 		{   
   142         {   
   135 		CExtProxyDrive* pD = GetProxyDrive(aDriveNumber);
   143         CExtProxyDrive* pD = GetProxyDrive(aDriveNumber);
   136 		if(pD)
   144         if(pD)
   137 			r = pD->Caps(localDriveCaps);
   145             r = pD->Caps(localDriveCaps);
   138 		else
   146         else
   139 			r = KErrNotReady;	// What should the behaviour really be here?
   147             r = KErrNotReady;   // What should the behaviour really be here?
   140 		}
   148         }
   141 
   149 
   142 	if (r != KErrLocked )
   150     if (r != KErrLocked )
   143 		{
   151         {
   144 		anInfo.iMediaAtt=localDriveCaps().iMediaAtt;
   152         anInfo.iMediaAtt=localDriveCaps().iMediaAtt;
   145 		}
   153         }
   146 	else
   154     else
   147 		{
   155         {
   148 		anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword;
   156         anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword;
   149 		}
   157         }
   150 
   158 
   151 	anInfo.iType=localDriveCaps().iType;
   159     anInfo.iType=localDriveCaps().iType;
   152 	anInfo.iDriveAtt=localDriveCaps().iDriveAtt;
   160     anInfo.iDriveAtt=localDriveCaps().iDriveAtt;
   153 	}
   161     }
   154 
   162 
   155 
   163 
   156 TBool CFatFileSystem::IsExtensionSupported() const
   164 TBool CFatFileSystem::IsExtensionSupported() const
   157 //
   165 //
   158 //
   166 //
   159 //
   167 //
   160 	{
   168     {
   161 	return(ETrue);
   169     return(ETrue);
   162 	}
   170     }
   163 
   171 
   164 TBool CFatFileSystem::GetUseLocalTime() const
   172 TBool CFatFileSystem::GetUseLocalTime() const
   165 	{
   173     {
   166 	return iUseLocalTimeIfRemovable;
   174     return iUseLocalTimeIfRemovable;
   167 	}
   175     }
   168 
   176 
   169 void CFatFileSystem::SetUseLocalTime(TBool aFlag)
   177 void CFatFileSystem::SetUseLocalTime(TBool aFlag)
   170 	{
   178     {
   171 	iUseLocalTimeIfRemovable = aFlag;
   179     iUseLocalTimeIfRemovable = aFlag;
   172 	}
   180     }
   173 
   181 
   174 /**
   182 /**
   175 Reports whether the specified interface is supported - if it is,
   183 Reports whether the specified interface is supported - if it is,
   176 the supplied interface object is modified to it
   184 the supplied interface object is modified to it
   177 
   185 
   184 TInt CFatFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput)
   192 TInt CFatFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput)
   185     {
   193     {
   186     switch(aInterfaceId)
   194     switch(aInterfaceId)
   187         {
   195         {
   188         case CFileSystem::EProxyDriveSupport: // The FAT Filesystem supports proxy drives
   196         case CFileSystem::EProxyDriveSupport: // The FAT Filesystem supports proxy drives
   189 			return KErrNone;
   197             return KErrNone;
   190 
   198 
   191         default:
   199         default:
   192             return(CFileSystem::GetInterface(aInterfaceId, aInterface, aInput));
   200             return(CFileSystem::GetInterface(aInterfaceId, aInterface, aInput));
   193         }
   201         }
   194     }
   202     }