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