|
1 /* |
|
2 * Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Remote File System Plug-in implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CRSFWFSMOUNTCB_H |
|
20 #define CRSFWFSMOUNTCB_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <f32fsys.h> |
|
24 #include "rsfwsession.h" |
|
25 #include "rsfwinterface.h" |
|
26 |
|
27 class CRsfwFileSystem; |
|
28 |
|
29 // CLASS DECLARATIONS |
|
30 |
|
31 /** |
|
32 * Classes that a plug-in file system must implement. A plug-in |
|
33 * filesystem must implement CFileSystem, which is a factory class for |
|
34 * a file system. That class must create objects derived from CMountCB, |
|
35 * CFileCB, CDirCB and CFormatCB. These are defined in f32fsys.h |
|
36 * |
|
37 * @lib eremotefs.fsy |
|
38 * @since Series 60 3.2 |
|
39 */ |
|
40 class CRsfwFsMountCB : public CMountCB |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Static constructor. |
|
46 */ |
|
47 static CRsfwFsMountCB* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CRsfwFsMountCB(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 |
|
57 /** |
|
58 * Renames a file. |
|
59 * @since Series 60 3.2 |
|
60 * @param aDirFid fid of the parent directory of the file to be renamed |
|
61 * @param aSourceName A reference to a descriptor containing the name |
|
62 * of the file to be renamed. |
|
63 * @param aNewName A reference to a descriptor containing the new full entry |
|
64 * name for the entry to be renamed. |
|
65 * @return |
|
66 */ |
|
67 void RenameFidL( TFid aDirFid, |
|
68 const TDesC& aSourceName, |
|
69 const TDesC& aNewName ); |
|
70 |
|
71 |
|
72 /** |
|
73 * Returnes a handle to the Remote File Engine session |
|
74 * @since Series 60 3.1 |
|
75 * @return a session handle. |
|
76 */ |
|
77 RRsfwSession* RSessionL(); |
|
78 |
|
79 |
|
80 public: // Functions from base classes |
|
81 |
|
82 /** |
|
83 * From CMountCB Sets the mount control block properties. |
|
84 * @since Series 60 3.2 |
|
85 * @param aForceMount Indicates whether the properties of a corrupt |
|
86 * volume should be stored. |
|
87 * @return |
|
88 */ |
|
89 void MountL( TBool aForceMount ); |
|
90 |
|
91 /** |
|
92 * From CMountCB Checks whether the mount control block represents the current mount on |
|
93 * the associated drive. |
|
94 * @since Series 60 3.2 |
|
95 * @return KErrNone if the mount represented by this object is found to be |
|
96 the current mount; |
|
97 KErrGeneral if this object is found not to represent |
|
98 the current mount; |
|
99 otherwise one of the other sytem wide error codes. |
|
100 */ |
|
101 TInt ReMount( ); |
|
102 |
|
103 /** |
|
104 * From CMountCB Carries out any clean-up necessary for a volume dismount. |
|
105 * @since Series 60 3.2 |
|
106 * @return |
|
107 */ |
|
108 void Dismounted( ); |
|
109 |
|
110 /** |
|
111 * From CMountCB Gets volume information. |
|
112 * @since Series 60 3.2 |
|
113 * @param aVolume On return, a reference to the filled volume |
|
114 * information object. |
|
115 * @return |
|
116 */ |
|
117 void VolumeL( TVolumeInfo& aVolume ) const; |
|
118 |
|
119 |
|
120 /** |
|
121 * From CMountCB Sets the volume name for the mount. |
|
122 * @since Series 60 3.2 |
|
123 * @param aName A reference to a descriptor containing the new volume name. |
|
124 * @return |
|
125 */ |
|
126 void SetVolumeL( TDes& aName ); |
|
127 |
|
128 /** |
|
129 * From CMountCB Creates a new directory on the mount. |
|
130 * @since Series60 3.2 |
|
131 * @param aName A reference to a descriptor containing the full name of |
|
132 the directory to be created. |
|
133 * @return |
|
134 */ |
|
135 void MkDirL( const TDesC& aName ); |
|
136 |
|
137 /** |
|
138 * From CMountCB Removes the directory specified by aName from the volume. |
|
139 * @since Series60 3.2 |
|
140 * @param aName A reference to a descriptor containing the full name of |
|
141 the directory to be removed. |
|
142 * @return |
|
143 */ |
|
144 void RmDirL( const TDesC& aName ); |
|
145 |
|
146 /** |
|
147 * From CMountCB Deletes the specified file from the mount. |
|
148 * @since Series60 3.2 |
|
149 * @param aName A reference to a descriptor containing the full path name |
|
150 of the file that will be removed. |
|
151 * @return |
|
152 */ |
|
153 void DeleteL( const TDesC& aName ); |
|
154 |
|
155 /** |
|
156 * From CMountCB Renames or moves a single file or directory on the mount. |
|
157 * @since Series60 3.2 |
|
158 * @param anOldName A reference to a descriptor containing the full entry |
|
159 * name of the entry to be renamed. |
|
160 * @param anNewName A reference to a descriptor containing the new full entry |
|
161 * name for the entry to be renamed. |
|
162 * @return |
|
163 */ |
|
164 void RenameL( const TDesC& anOldName, |
|
165 const TDesC& aNewName ); |
|
166 |
|
167 /** |
|
168 * From CMountCB Replaces one file on the mount with another. |
|
169 * @since Series60 3.2 |
|
170 * @param anOldName A reference to a descriptor containing the full file name |
|
171 * of the file to replace the file specified by anNewName |
|
172 * @param anNewName A reference to a descriptor containing the new full file |
|
173 * name for the entry to be replaced. |
|
174 * @return |
|
175 */ |
|
176 void ReplaceL( const TDesC& anOldName, |
|
177 const TDesC& aNewName ); |
|
178 |
|
179 |
|
180 /** |
|
181 * From CMountCB Gets the entry details for the specified file or directory. |
|
182 * @since Series60 3.2 |
|
183 * @param aName A reference to a descriptor containing the full name of |
|
184 * the entry whose details are required. |
|
185 * @param anEntry On return, a reference to the filled entry object. |
|
186 * @return |
|
187 */ |
|
188 void EntryL( const TDesC& aName, |
|
189 TEntry& anEntry ) const; |
|
190 |
|
191 /** |
|
192 * From CMountCB Sets entry details for a specified file or directory. |
|
193 * @since Series60 3.2 |
|
194 * @param aName A reference to a descriptor containing the full name of |
|
195 * the entry to be updated. |
|
196 * @param aTime A reference to the time object holding the new universal |
|
197 * modified time for aName. |
|
198 * @param aSetAttMask Attribute mask for setting the entry's attributes. |
|
199 * @param aClearAttMask Attribute mask for clearing the entry's attributes. |
|
200 * @return |
|
201 */ |
|
202 void SetEntryL( const TDesC& aName, |
|
203 const TTime& aTime, |
|
204 TUint aMask, |
|
205 TUint aVal ); |
|
206 |
|
207 /** |
|
208 * From CMountCB Opens a new or existing file on the mount. |
|
209 * @since Series 60 3.2 |
|
210 * @param aName The full name of the file that will be opened. |
|
211 * @param aMode The file share mode. The following share modes are available: |
|
212 * EFileShareExclusive; |
|
213 * EFileShareReadersOnly; |
|
214 * EFileShareAny; |
|
215 * EFileStream; |
|
216 * EFileStreamText; |
|
217 * EFileRead; |
|
218 * EFileWrite. |
|
219 * @param anOpen Indicates how the file will be opened. It can be one of |
|
220 * the following: |
|
221 * EFileOpen; |
|
222 * EFileCreate; |
|
223 * EFileReplace. |
|
224 * @param aFile Pointer to the file control block which will, on success, |
|
225 * represent the open file. |
|
226 * @return |
|
227 */ |
|
228 void FileOpenL( const TDesC& aName, |
|
229 TUint aMode, |
|
230 TFileOpen anOpen, |
|
231 CFileCB* aFile ); |
|
232 |
|
233 /** |
|
234 * From CMountCB Opens a directory on the mount. |
|
235 * @since Series 60 3.2 |
|
236 * @param aName A reference to a descriptor containing the full name of |
|
237 the directory that will be opened. |
|
238 * @param aDir Points to a directory control block which will, on success, |
|
239 represent the open directory. |
|
240 * @return |
|
241 */ |
|
242 void DirOpenL( const TDesC& aName, |
|
243 CDirCB* aDir ); |
|
244 |
|
245 /** |
|
246 * From CMountCB Gets the short name of the file or directory with |
|
247 * the given full name. |
|
248 * @since Series 60 3.2 |
|
249 * @param aLongName A reference to a descriptor containing the full name |
|
250 * of the entry. |
|
251 * @param aShortName On return, a reference to a descriptor containing |
|
252 * the short name of the entry. |
|
253 * @return |
|
254 */ |
|
255 void GetShortNameL( const TDesC& aLongName, |
|
256 TDes& aShortName ); |
|
257 |
|
258 /** |
|
259 * From CMountCB Gets the long name of the file or directory associated with |
|
260 * the given short name. |
|
261 * @since Series 60 3.2 |
|
262 * @param aShorName A reference to a descriptor containing the short name |
|
263 * of the entry. |
|
264 * @param aLongName On return, a reference to a descriptor containing |
|
265 * the long name of the entry. |
|
266 * @return |
|
267 */ |
|
268 void GetLongNameL( const TDesC& aShortName, |
|
269 TDes& aLongName ); |
|
270 |
|
271 /** |
|
272 * From CMountCB Reads a specified section of the file, regardless of the file's lock state. |
|
273 * @since Series 60 3.2 |
|
274 * @param aName A reference to a descriptor containing the full name of |
|
275 * the file to be read from |
|
276 * @param aPos The byte position to start reading from. |
|
277 * @param aTrg A pointer to the buffer into which data is to be read. |
|
278 * @param aLength The length of data to be read, in bytes. |
|
279 * @param aMessage Client message. |
|
280 * @return |
|
281 */ |
|
282 void ReadSectionL( const TDesC& aName, |
|
283 TInt aPos,TAny* aTrg, |
|
284 TInt aLength, |
|
285 const RMessagePtr2& aMessage ); |
|
286 |
|
287 /** |
|
288 * From CMountCB Reads the specified length of data from the specified position on |
|
289 * the volume directly into the client thread. |
|
290 * @since Series 60 3.2 |
|
291 * @param aPos Start position in the volume for the read operation, |
|
292 * in bytes. |
|
293 * @param aLength The number of bytes to be read. |
|
294 * @param aTrg A pointer to the buffer into which data is to be read. |
|
295 * @param anOffset The offset at which to start adding data to the read buffer. |
|
296 * @param aMessage Client message. |
|
297 * @return |
|
298 */ |
|
299 void RawReadL( TInt64 aPos, |
|
300 TInt aLength, |
|
301 const TAny* aTrg, |
|
302 TInt anOffset, |
|
303 const RMessagePtr2& aMessage ) const; |
|
304 |
|
305 /** |
|
306 * From CMountCB Writes a specified length of data from the client thread to the volume |
|
307 * at the specified position. |
|
308 * @since Series 60 3.2 |
|
309 * @param aPos Start position in the volume for the write operation, |
|
310 * in bytes. |
|
311 * @param aLength The number of bytes to be written. |
|
312 * @param aSrc Pointer to the buffer from which data will be written. |
|
313 * @param anOffset The offset in the buffer at which to start writing data. |
|
314 * @param aMessage Client message. |
|
315 * @return |
|
316 */ |
|
317 void RawWriteL( TInt64 aPos, |
|
318 TInt aLength, |
|
319 const TAny* aSrc, |
|
320 TInt anOffset, |
|
321 const RMessagePtr2& aMessage ); |
|
322 |
|
323 /** |
|
324 Checks the integrity of the file system on the volume and returns an |
|
325 appropriate error value. |
|
326 |
|
327 @return KErrNone if the file system is stable; otherwise one of |
|
328 the other system wide error codes. |
|
329 */ |
|
330 TInt CheckDisk(); |
|
331 |
|
332 private: |
|
333 |
|
334 /** |
|
335 * C++ default constructor. |
|
336 */ |
|
337 CRsfwFsMountCB(); |
|
338 |
|
339 |
|
340 /** |
|
341 * Gets entry details for a file or directory |
|
342 * @since Series 60 3.2 |
|
343 * @param aName Name of the file or directory. |
|
344 * @param anEntry On success, contains the entry details. |
|
345 * @return |
|
346 */ |
|
347 void RemoteFsEntryL( const TDesC& aName, |
|
348 TEntry& anEntry ); |
|
349 |
|
350 /** |
|
351 * Fetches fid for a file or directory. |
|
352 * @since Series 60 3.2 |
|
353 * @param aPath The full path of the file or directory. |
|
354 * @param aNodeType Type of the node (i.e. file or directory). |
|
355 * @return |
|
356 */ |
|
357 TFid FetchFidL( const TDesC& aPath, |
|
358 TUint aNodeType ); |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 public: // Data |
|
364 // Server to which this mount is connected. |
|
365 // The pointer is stored as volumename to CMountCB, |
|
366 // which takes of the desc. ownership and deletes it. |
|
367 HBufC* iServerName; |
|
368 |
|
369 // File Server session used to access the local cache. |
|
370 RFs iFsSession; |
|
371 |
|
372 private: // Data |
|
373 // Pointer to filesystem object. |
|
374 CRsfwFileSystem* iRemoteFs; |
|
375 |
|
376 // Session to Remote File Engine |
|
377 RRsfwSession* iSession; |
|
378 |
|
379 // Root Fid, can be different for different mounts |
|
380 TFid iRootFid; |
|
381 }; |
|
382 |
|
383 #endif // CRSFWFSMOUNTCB_H |
|
384 |
|
385 // End of File |
|
386 |