|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedAll |
|
19 @released |
|
20 */ |
|
21 |
|
22 #if !defined(__F32FILE_H__) |
|
23 #define __F32FILE_H__ |
|
24 |
|
25 #if !defined(__E32BASE_H__) |
|
26 #include <e32base.h> |
|
27 #endif |
|
28 |
|
29 #if !defined(__E32SVR_H__) |
|
30 #include <e32svr.h> |
|
31 #endif |
|
32 |
|
33 #include <e32ldr.h> |
|
34 |
|
35 |
|
36 /** |
|
37 @publishedAll |
|
38 @released |
|
39 |
|
40 The session default drive. |
|
41 */ |
|
42 const TInt KDefaultDrive=KMaxTInt; |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 /** |
|
48 @publishedAll |
|
49 @released |
|
50 |
|
51 Indicates a drive letter which is not in use. |
|
52 |
|
53 This is useful when scanning a drive list to find which drives are available. |
|
54 */ |
|
55 const TInt KDriveAbsent=0x00; |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 /** |
|
61 @publishedAll |
|
62 @released |
|
63 |
|
64 The default value for the number of message slots passed to RFs::Connect(). |
|
65 |
|
66 @see RFs::Connect |
|
67 */ |
|
68 const TInt KFileServerDefaultMessageSlots=-1; |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 /** |
|
74 @publishedAll |
|
75 @released |
|
76 |
|
77 The size of the array of TEntry items contained in a TEntryArray object. |
|
78 |
|
79 @see TEntryArray |
|
80 @see TEntry |
|
81 */ |
|
82 const TInt KEntryArraySize=(0x200*sizeof(TText)); |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 /** |
|
88 @publishedAll |
|
89 @released |
|
90 |
|
91 The character used to separate directories in the path name. |
|
92 */ |
|
93 const TInt KPathDelimiter='\\'; |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 /** |
|
99 @publishedAll |
|
100 @released |
|
101 |
|
102 The character used to separate the drive letter from the path. |
|
103 */ |
|
104 const TInt KDriveDelimiter=':'; |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 /** |
|
110 @publishedAll |
|
111 @released |
|
112 |
|
113 The character used to separate the filename from the extension. |
|
114 */ |
|
115 const TInt KExtDelimiter='.'; |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 /** |
|
121 @publishedAll |
|
122 @released |
|
123 |
|
124 The maximum number of available drives. |
|
125 */ |
|
126 const TInt KMaxDrives=26; |
|
127 |
|
128 |
|
129 /** |
|
130 @publishedAll |
|
131 @released |
|
132 |
|
133 The maximum number of available proxy drives. |
|
134 */ |
|
135 const TInt KMaxProxyDrives=KMaxDrives-KMaxLocalDrives; |
|
136 |
|
137 |
|
138 /** |
|
139 @publishedAll |
|
140 @released |
|
141 |
|
142 Defines a modifiable buffer descriptor to contain a drive list. |
|
143 |
|
144 The descriptor has maximum length KMaxDrives, sufficient to contain |
|
145 all possible drive letters. |
|
146 |
|
147 @see RFs::DriveList |
|
148 @see KMaxDrives |
|
149 */ |
|
150 typedef TBuf8<KMaxDrives> TDriveList; |
|
151 |
|
152 |
|
153 |
|
154 /** |
|
155 @publishedAll |
|
156 @released |
|
157 |
|
158 The maximum length of a drivename. |
|
159 |
|
160 Sufficient for a drive letter and colon. |
|
161 */ |
|
162 const TInt KMaxDriveName=0x02; |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 /** |
|
168 @publishedAll |
|
169 @released |
|
170 |
|
171 Defines a modifiable buffer descriptor to contain a drive name. |
|
172 |
|
173 A drive name comprises a drive letter (A through Z) and a colon. |
|
174 KMaxDriveName (2 bytes) is sufficient for a drive letter and colon. |
|
175 |
|
176 @see TDriveUnit::Name |
|
177 @see KMaxDriveName |
|
178 */ |
|
179 typedef TBuf<KMaxDriveName> TDriveName; |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 /** |
|
185 @publishedAll |
|
186 @released |
|
187 |
|
188 The maximum length of a file system name or file system sub type name. |
|
189 32 characters is sufficient for a file system or sub type name. |
|
190 */ |
|
191 const TInt KMaxFSNameLength=0x0020; |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 /** |
|
197 @publishedAll |
|
198 @released |
|
199 |
|
200 Defines a modifiable buffer descriptor to contain a file system or file system sub type name. |
|
201 |
|
202 @see KMaxFSNameLength |
|
203 */ |
|
204 typedef TBuf<KMaxFSNameLength> TFSName; |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 /** |
|
210 @publishedAll |
|
211 @released |
|
212 |
|
213 File/directory attribute: any file without the hidden or system attribute. |
|
214 */ |
|
215 const TUint KEntryAttNormal=0x0000; |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 /** |
|
221 @publishedAll |
|
222 @released |
|
223 |
|
224 File/directory attribute: read-only file or directory. |
|
225 */ |
|
226 const TUint KEntryAttReadOnly=0x0001; |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 /** |
|
232 @publishedAll |
|
233 @released |
|
234 |
|
235 File/directory attribute: hidden file or directory. |
|
236 */ |
|
237 const TUint KEntryAttHidden=0x0002; |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 /** |
|
243 @publishedAll |
|
244 @released |
|
245 |
|
246 File/directory attribute: system file. |
|
247 */ |
|
248 const TUint KEntryAttSystem=0x0004; |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 /** |
|
254 @publishedAll |
|
255 @released |
|
256 |
|
257 File/directory attribute: volume name directory. |
|
258 */ |
|
259 const TUint KEntryAttVolume=0x0008; |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 /** |
|
265 @publishedAll |
|
266 @released |
|
267 |
|
268 File/directory attribute: a directory without the hidden or system attribute. |
|
269 */ |
|
270 const TUint KEntryAttDir=0x0010; |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 /** |
|
276 @publishedAll |
|
277 @released |
|
278 |
|
279 File/directory attribute: an archive file. |
|
280 */ |
|
281 const TUint KEntryAttArchive=0x0020; |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 /** |
|
287 @publishedAll |
|
288 @released |
|
289 |
|
290 File/directory attribute: ROM eXecute In Place file |
|
291 */ |
|
292 const TUint KEntryAttXIP=0x0080; |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 /** |
|
298 @publishedAll |
|
299 @released |
|
300 |
|
301 This file attribute bit is set if the file exists only on a remote file |
|
302 system and is not locally cached. |
|
303 |
|
304 Due to the potential high-latency of remote file systems, applications |
|
305 (or users of applications) may make use of this bit to modify their |
|
306 behaviour when working with remote files. |
|
307 |
|
308 This is a read-only attribute, so any attempt to set this attribute will |
|
309 will be ignored. |
|
310 */ |
|
311 const TUint KEntryAttRemote=0x0100; |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 /** |
|
317 @publishedAll |
|
318 @released |
|
319 |
|
320 The range of entry attributes reserved for file-system specific meanings. |
|
321 File systems may assign meaning to these bits, but their definition will |
|
322 not be supported nor maintained by Symbian. |
|
323 |
|
324 All other file attribute bits are reserved for use by Symbian. |
|
325 |
|
326 The following table summarises the assignment of attribute bits: |
|
327 |
|
328 0 - KEntryAttReadOnly |
|
329 1 - KEntryAttHidden |
|
330 2 - KEntryAttSystem |
|
331 3 - KEntryAttVolume |
|
332 |
|
333 4 - KEntryAttDir |
|
334 6 - KEntryAttArchive |
|
335 7 - KEntryAttXIP |
|
336 |
|
337 8 - KEntryAttRemote |
|
338 9 - Reserved |
|
339 10 - Reserved |
|
340 11 - Reserved |
|
341 |
|
342 12 - Reserved |
|
343 13 - Reserved |
|
344 14 - Reserved |
|
345 15 - Reserved |
|
346 |
|
347 16 - File System Specific |
|
348 17 - File System Specific |
|
349 18 - File System Specific |
|
350 19 - File System Specific |
|
351 |
|
352 20 - File System Specific |
|
353 22 - File System Specific |
|
354 22 - File System Specific |
|
355 23 - File System Specific |
|
356 |
|
357 24 - KEntryAttPacked |
|
358 25 - Reserved |
|
359 26 - Reserved |
|
360 27 - KEntryAttMatchExclude |
|
361 |
|
362 28 - KEntryAttAllowUid |
|
363 29 - Reserved |
|
364 30 - KEntryAttMatchExclusive |
|
365 31 - Reserved |
|
366 */ |
|
367 const TUint KEntryAttMaskFileSystemSpecific=0x00FF0000; |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 /** |
|
373 @publishedAll |
|
374 @released |
|
375 |
|
376 Bit mask for matching file and directory entries. |
|
377 |
|
378 This mask ensures that directories and hidden and |
|
379 system files are matched. |
|
380 |
|
381 (Note that KEntryAttNormal matches all entry types except directories, hidden |
|
382 and system entries). |
|
383 |
|
384 @see RFs::GetDir |
|
385 */ |
|
386 const TUint KEntryAttMatchMask=(KEntryAttHidden|KEntryAttSystem|KEntryAttDir); |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 /** |
|
393 @publishedAll |
|
394 @released |
|
395 |
|
396 Bit mask for matching file and directory entries. |
|
397 |
|
398 This is used when all entry types, including hidden and system files, |
|
399 but excluding the volume entry are to be matched. |
|
400 |
|
401 @see RFs::GetDir |
|
402 */ |
|
403 const TUint KEntryAttMaskSupported=0x3f; |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 /** |
|
409 @publishedAll |
|
410 @released |
|
411 |
|
412 Bit mask for matching file and directory entries. |
|
413 |
|
414 This is used for exclusive matching. When OR'ed with one or more file attribute |
|
415 constants, for example, KEntryAttNormal, it ensures that only the files with |
|
416 those attributes are matched. |
|
417 When OR’ed with KEntryAttDir, directories only (not hidden or system) are matched. |
|
418 |
|
419 @see KEntryAttDir |
|
420 @see KEntryAttNormal |
|
421 @see RFs::GetDir |
|
422 */ |
|
423 const TUint KEntryAttMatchExclusive=0x40000000; |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 /** |
|
429 @publishedAll |
|
430 @released |
|
431 |
|
432 Bit mask for feature manager file entries. |
|
433 |
|
434 It is used in order to identify each ROM feature set data file |
|
435 uniquely in the mount order of ROM sections. |
|
436 |
|
437 */ |
|
438 const TUint KEntryAttUnique=0x01000000; |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 /** |
|
444 @publishedAll |
|
445 @released |
|
446 |
|
447 Bit mask for matching file and directory entries. |
|
448 |
|
449 It is used to exclude files or directories with certain attributes from |
|
450 directory listings. This bitmask has the opposite effect |
|
451 to KEntryAttMatchExclusive. For example: |
|
452 |
|
453 @code |
|
454 KEntryAttMatchExclude|KEntryAttReadOnly |
|
455 @endcode |
|
456 |
|
457 excludes all read only entries from the directory listing. |
|
458 |
|
459 @code |
|
460 KEntryAttMatchExclusive|KEntryAttReadOnly |
|
461 @endcode |
|
462 lists only read only entries. |
|
463 |
|
464 @see KEntryAttMatchExclusive |
|
465 @see RFs::GetDir |
|
466 */ |
|
467 const TUint KEntryAttMatchExclude=0x08000000; |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 /** |
|
473 @publishedAll |
|
474 @released |
|
475 |
|
476 Bit mask for matching file and directory entries. |
|
477 |
|
478 Bit mask flag used when UID information should be included in the directory |
|
479 entry listing. |
|
480 |
|
481 @see RFs::GetDir |
|
482 */ |
|
483 const TUint KEntryAttAllowUid=0x10000000; |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 /** |
|
489 @publishedAll |
|
490 @released |
|
491 |
|
492 Indicates that a TEntry (that is generally returned from a TEntryArray) is |
|
493 stored in packed format where the iSizeHigh and iReserved fields follow the |
|
494 valid characters of the name string. Before accessing the aforementioned |
|
495 members, the entry must be unpacked. |
|
496 |
|
497 */ |
|
498 const TUint KEntryAttPacked = 0x01000000; |
|
499 |
|
500 |
|
501 /** |
|
502 @publishedAll |
|
503 @released |
|
504 */ |
|
505 const TUint KMaxMapsPerCall = 0x8; |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 enum TNotifyType |
|
511 /** |
|
512 @publishedAll |
|
513 @released |
|
514 |
|
515 A set of change notification flags. |
|
516 |
|
517 These flags indicate the kind of change that should result in notification. |
|
518 |
|
519 This is useful for programs that maintain displays of file lists that |
|
520 must be dynamically updated. |
|
521 |
|
522 @see RFs::NotifyChange |
|
523 @see RFs |
|
524 @see RFile |
|
525 @see RRawDisk |
|
526 */ |
|
527 { |
|
528 /** |
|
529 Any change, including mounting and unmounting drives. |
|
530 */ |
|
531 ENotifyAll=0x01, |
|
532 |
|
533 |
|
534 /** |
|
535 Addition or deletion of a directory entry, or changing or formatting a disk. |
|
536 */ |
|
537 ENotifyEntry=0x02, |
|
538 |
|
539 |
|
540 /** |
|
541 Change resulting from file requests: |
|
542 RFile::Create(), RFile::Replace(), RFile::Rename(), RFs::Delete(), |
|
543 RFs::Replace(), and RFs::Rename(). |
|
544 */ |
|
545 ENotifyFile=0x04, |
|
546 |
|
547 |
|
548 /** |
|
549 Change resulting from directory requests: |
|
550 RFs::MkDir(), RFs::RmDir(), and RFs::Rename(). |
|
551 */ |
|
552 ENotifyDir=0x08, |
|
553 |
|
554 |
|
555 /** |
|
556 Change resulting from: RFs::SetEntry(), RFile::Set(), RFile::SetAtt(), |
|
557 RFile::SetModified() and RFile::SetSize() requests. |
|
558 */ |
|
559 ENotifyAttributes=0x10, |
|
560 |
|
561 |
|
562 /** |
|
563 Change resulting from the RFile::Write() request. |
|
564 */ |
|
565 ENotifyWrite=0x20, |
|
566 |
|
567 |
|
568 /** |
|
569 Change resulting from the RRawDisk::Write() request. |
|
570 */ |
|
571 ENotifyDisk=0x40 |
|
572 }; |
|
573 |
|
574 enum TNotifyDismountMode |
|
575 /** |
|
576 @publishedAll |
|
577 @released |
|
578 |
|
579 Notification modes for safe media removal notification API |
|
580 |
|
581 @see RFs::NotifyDismount |
|
582 */ |
|
583 { |
|
584 /** |
|
585 Used by a client to register for notification of pending dismount. |
|
586 - This is the default behaviour for RFs::NotifyDismount |
|
587 */ |
|
588 EFsDismountRegisterClient=0x01, |
|
589 |
|
590 /** |
|
591 Used to notify clients of a pending dismount. |
|
592 */ |
|
593 EFsDismountNotifyClients=0x02, |
|
594 |
|
595 /** |
|
596 Used to forcibly dismount the file system without notifying clients. |
|
597 */ |
|
598 EFsDismountForceDismount=0x03, |
|
599 }; |
|
600 |
|
601 |
|
602 enum TFileCacheFlags |
|
603 /** |
|
604 @publishedAll |
|
605 @released |
|
606 |
|
607 Flags used to enable file server drive-specific caching |
|
608 */ |
|
609 { |
|
610 /** |
|
611 Enable read caching - if file explicitly opened in EFileReadBuffered mode |
|
612 */ |
|
613 EFileCacheReadEnabled = 0x01, |
|
614 |
|
615 /** |
|
616 Enable read caching for all files, regardless of file open mode |
|
617 */ |
|
618 EFileCacheReadOn = 0x02, |
|
619 |
|
620 /** |
|
621 Enable read-ahead caching - if file explicitly opened in EFileReadAheadOn mode |
|
622 */ |
|
623 EFileCacheReadAheadEnabled = 0x04, |
|
624 |
|
625 /** |
|
626 Enable read-ahead caching, regardless of file open mode |
|
627 */ |
|
628 EFileCacheReadAheadOn = 0x08, |
|
629 |
|
630 /** |
|
631 Enable write caching, if file explicitly opened in EFileWriteBuffered mode |
|
632 */ |
|
633 EFileCacheWriteEnabled = 0x10, |
|
634 |
|
635 /** |
|
636 Enable write caching for all files, regardless of file open mode |
|
637 */ |
|
638 EFileCacheWriteOn = 0x20, |
|
639 }; |
|
640 |
|
641 /** |
|
642 @publishedAll |
|
643 @released |
|
644 |
|
645 Commands to query specific volume information. |
|
646 |
|
647 @see TVolumeIOParamInfo |
|
648 */ |
|
649 enum TQueryVolumeInfoExtCmd |
|
650 { |
|
651 /** |
|
652 Queries the sub type of the file system mounted on a specified volume. |
|
653 For example, FAT12, FAT16 or FAT32. |
|
654 */ |
|
655 EFileSystemSubType, |
|
656 |
|
657 /** |
|
658 Queries the I/O parameters of a specificed volume. |
|
659 This includes the block size, the cluster size and the recommended read and write sizes for the media. |
|
660 */ |
|
661 EIOParamInfo, |
|
662 |
|
663 /** |
|
664 This command determines whether the volume is synchronous or asynchronous. |
|
665 A boolean value is returned within the buffer defined as TPckgBuf<TBool>. |
|
666 ETrue for Synchronous and EFalse for Asynchronous. |
|
667 */ |
|
668 EIsDriveSync, |
|
669 |
|
670 /** |
|
671 Query if the given drive is finalised. See RFs::FinaliseDrive() |
|
672 Not all file systems may support this query. |
|
673 A boolean value is returned within the buffer defined as TPckgBuf<TBool>. |
|
674 ETrue value means that the drive is finalised |
|
675 */ |
|
676 EIsDriveFinalised, |
|
677 }; |
|
678 |
|
679 /** |
|
680 @publishedAll |
|
681 @released |
|
682 |
|
683 Volume IO parameter information. |
|
684 |
|
685 This class is used to return IO parameter information for a specified volume. |
|
686 |
|
687 The volume parameter information holds recommended buffer sizes for the creation of efficient buffers for |
|
688 reading and writing. |
|
689 |
|
690 @see RFs::VolumeIOParam() |
|
691 */ |
|
692 class TVolumeIOParamInfo |
|
693 { |
|
694 public: |
|
695 /** |
|
696 The size of a block in bytes. |
|
697 |
|
698 Reads and writes that are aligned on block boundaries are up to twice as fast as when |
|
699 mis-aligned. |
|
700 |
|
701 Read and write operations on certain underlying media is done in blocks. |
|
702 A write operation that modifies only part of a block is less efficient, in general, than |
|
703 one that modifies an entire block. Data throughput degrades linearly for reads and writes in smaller |
|
704 sized units. |
|
705 */ |
|
706 TInt iBlockSize; |
|
707 /** |
|
708 The size in bytes of a single disk cluster. |
|
709 |
|
710 Read and write operations that are aligned on cluster boundaries are more efficient. |
|
711 |
|
712 The file system organises and allocates the file data on the disk in clusters where each cluster is |
|
713 one or more blocks. Files that are not zero length occupy at least one cluster of the disk, |
|
714 so large numbers of very small files use up more disk space than expected. |
|
715 */ |
|
716 TInt iClusterSize; |
|
717 /** |
|
718 The recommended buffer size for optimised reading performance. |
|
719 |
|
720 The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor. |
|
721 The buffer size is then added to the estart.txt file |
|
722 |
|
723 The figure is included in the estart.txt file along with the drive number and the variable name. |
|
724 The example below shows the required format: |
|
725 |
|
726 [DriveC] |
|
727 RecReadBufSize 8192 |
|
728 |
|
729 When no value is provided, value KErrNotSupported is returned. |
|
730 */ |
|
731 TInt iRecReadBufSize; |
|
732 /** |
|
733 The recommended buffer size for optimised writing performance. |
|
734 |
|
735 The given buffer size is based on sensible benchmark testing results produced by the mobile device vendor. |
|
736 The buffer size is then added to the estart.txt file |
|
737 |
|
738 The figure is included in the estart.txt file along with the drive number and the variable name. |
|
739 The example below shows the required format: |
|
740 |
|
741 [DriveC] |
|
742 RecWriteBufSize 16384 |
|
743 |
|
744 When no value is provided, value KErrNotSupported is returned. |
|
745 */ |
|
746 TInt iRecWriteBufSize; |
|
747 |
|
748 |
|
749 /** |
|
750 The maximum file size that is supported by the file system mounted on this volume. |
|
751 Not all file system may provide this parameter; The value KMaxTUint64 (0xffffffffffffffff) means that this particular file system hasn't |
|
752 provided this information. |
|
753 */ |
|
754 TUint64 iMaxSupportedFileSize; |
|
755 |
|
756 private: |
|
757 /* |
|
758 Reserved space for future use |
|
759 */ |
|
760 TInt iReserved[2]; |
|
761 }; |
|
762 |
|
763 enum TDriveNumber |
|
764 /** |
|
765 @publishedAll |
|
766 @released |
|
767 |
|
768 The drive number enumeration. |
|
769 */ |
|
770 { |
|
771 EDriveA, EDriveB, EDriveC, EDriveD, EDriveE, |
|
772 EDriveF, EDriveG, EDriveH, EDriveI, EDriveJ, |
|
773 EDriveK, EDriveL, EDriveM, EDriveN, EDriveO, |
|
774 EDriveP, EDriveQ, EDriveR, EDriveS, EDriveT, |
|
775 EDriveU, EDriveV, EDriveW, EDriveX, EDriveY, |
|
776 EDriveZ |
|
777 }; |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 enum TEntryKey |
|
783 /** |
|
784 @publishedAll |
|
785 @released |
|
786 |
|
787 Flags indicating the order in which directory entries are to be sorted. |
|
788 |
|
789 @see RFs::GetDir |
|
790 @see CDirScan::SetScanDataL |
|
791 @see CDir::Sort |
|
792 */ |
|
793 { |
|
794 /** |
|
795 The default; no sorting takes place |
|
796 */ |
|
797 ESortNone=0, |
|
798 |
|
799 |
|
800 /** |
|
801 Sort according to alphabetic order of file and directory name. |
|
802 |
|
803 This setting is mutually exclusive with ESortByExt, ESortBySize, |
|
804 ESortByDate and ESortByUid. |
|
805 */ |
|
806 ESortByName, |
|
807 |
|
808 |
|
809 /** |
|
810 Sort according to alphabetic order of file extension. |
|
811 |
|
812 Files without an extension take precedence over files with an extension. |
|
813 For files with the same extension or without an extension, the default is |
|
814 to sort by name. |
|
815 |
|
816 This setting is mutually exclusive with ESortByName, ESortBySize, |
|
817 ESortByDate and ESortByUid. |
|
818 */ |
|
819 ESortByExt, |
|
820 |
|
821 |
|
822 /** |
|
823 Sort according to file size. |
|
824 |
|
825 This setting is mutually exclusive with ESortByName, ESortByExt, |
|
826 ESortByDate and ESortByUid. |
|
827 */ |
|
828 ESortBySize, |
|
829 |
|
830 |
|
831 /** |
|
832 Sort according to files' last modified time and date. |
|
833 |
|
834 By default, most recent last. |
|
835 |
|
836 This setting is mutually exclusive with ESortByName, ESortByExt, |
|
837 ESortBySize and ESortByUid. |
|
838 */ |
|
839 ESortByDate, |
|
840 |
|
841 |
|
842 /** |
|
843 Sort according to file UID. |
|
844 |
|
845 This setting is mutually exclusive with ESortByName, ESortByExt, |
|
846 ESortBySize and ESortByDate. |
|
847 */ |
|
848 ESortByUid, |
|
849 |
|
850 |
|
851 /** |
|
852 Qualifies the sort order; if set, directories are listed in the order in |
|
853 which they occur. |
|
854 |
|
855 This is the default. |
|
856 |
|
857 This flag is mutually exclusive with EDirsFirst and EDirslast. |
|
858 */ |
|
859 EDirsAnyOrder=0, |
|
860 |
|
861 |
|
862 /** |
|
863 Qualifies the sort order; if set, directories come before files in sort order. |
|
864 |
|
865 This flag is mutually exclusive with EDirsAnyOrder and EDirsLast. |
|
866 */ |
|
867 EDirsFirst=0x100, |
|
868 |
|
869 |
|
870 /** |
|
871 Qualifies the sort order; if set, files come before directories in sort order. |
|
872 |
|
873 This flag is mutually exclusive with EDirsAnyOrder and EDirsFirst. |
|
874 */ |
|
875 EDirsLast=0x200, |
|
876 |
|
877 |
|
878 /** |
|
879 Qualifies the sort order; files are sorted in ascending order, i.e. from A to Z. |
|
880 This is the default behaviour. |
|
881 |
|
882 This flag is mutually exclusive with EDescending and EDirDescending. |
|
883 */ |
|
884 EAscending=0, |
|
885 |
|
886 |
|
887 /** |
|
888 Qualifies the sort order; files are sorted in descending order, i.e. from Z to A. |
|
889 |
|
890 This flag is mutually exclusive with EAscending and EDirDescending. |
|
891 */ |
|
892 EDescending=0x400, |
|
893 |
|
894 |
|
895 /** |
|
896 Qualifies the sort order; directories are sorted in descending order, i.e. from Z to A. |
|
897 |
|
898 This flag shall be used in combination with either EDirsFirst or EDirsLast. |
|
899 This flag is mutually exclusive with EAscending and EDescending. |
|
900 */ |
|
901 EDirDescending=0x800 |
|
902 }; |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 enum TFileMode |
|
908 /** |
|
909 @publishedAll |
|
910 @released |
|
911 |
|
912 Access and share modes available when opening a file. |
|
913 |
|
914 The access mode indicates whether the file is opened just for reading or |
|
915 for writing. |
|
916 |
|
917 The share mode indicates whether other RFile objects can access the |
|
918 open file, and whether this access is read only. |
|
919 |
|
920 Use EFileShareReadersOrWriters if a client does not care whether the file has |
|
921 been previously opened for ReadOnly or Read/Write access. |
|
922 |
|
923 If EFileShareReadersOrWriters is not used, then a client needs to cooperate with |
|
924 other clients in order to open the file with the correct share mode, either |
|
925 EFileShareReadersOnly or EFileShareAny, depending on the share mode used when |
|
926 the file was originally opened. |
|
927 |
|
928 To open a file for reading and writing with read and write shared access, |
|
929 use: |
|
930 |
|
931 @code |
|
932 _LIT(KFilename, "filename.ext"); |
|
933 RFile file; |
|
934 file.Open(theFs, KFilename, EFileShareAny|EFileWrite); |
|
935 @endcode |
|
936 |
|
937 If another instance of RFile tries to open this file in EFileShareExclusive |
|
938 or EFileShareReadersOnly mode, access is denied. However, it can be opened |
|
939 in EFileShareAny mode or EFileShareReadersOrWriters mode. |
|
940 |
|
941 If a file is opened with EFileShareReadersOrWriters, and the file is opened for |
|
942 sharing by another client, then the file share mode is promoted to the new share |
|
943 mode. When the file handle is closed then the share mode is demoted back to |
|
944 EFileShareReadersOrWriters. |
|
945 |
|
946 @code |
|
947 |
|
948 Table of FileShare promotion rules |
|
949 ---------------------------------- |
|
950 |
|
951 Client A Client B Resultant Share Mode |
|
952 -------- -------- -------------------- |
|
953 ReadersOnly ReadersOnly ReadersOnly |
|
954 ReadersOnly ReadersOrWriters|EFileRead ReadersOnly |
|
955 ReadersOnly ReadersOrWriters|EFileWrite INCOMPATIBLE |
|
956 ReadersOnly Any INCOMPATIBLE |
|
957 |
|
958 ReadersOrWriters|EFileRead ReadersOnly ReadersOnly |
|
959 ReadersOrWriters|EFileRead ReadersOrWriters|EFileRead ReadersOrWriters |
|
960 ReadersOrWriters|EFileRead ReadersOrWriters|EFileWrite ReadersOrWriters |
|
961 ReadersOrWriters|EFileRead Any Any |
|
962 |
|
963 ReadersOrWriters|EFileWrite ReadersOnly INCOMPATIBLE |
|
964 ReadersOrWriters|EFileWrite ReadersOrWriters|EFileRead ReadersOrWriters |
|
965 ReadersOrWriters|EFileWrite ReadersOrWriters|EFileWrite ReadersOrWriters |
|
966 ReadersOrWriters|EFileWrite Any Any |
|
967 |
|
968 Any ReadersOnly INCOMPATIBLE |
|
969 Any ReadersOrWriters|EFileRead Any |
|
970 Any ReadersOrWriters|EFileWrite Any |
|
971 Any Any Any |
|
972 @endcode |
|
973 |
|
974 Use the following guidance notes for selecting FileShare mode with shared RFile objects: |
|
975 |
|
976 EFileShareAny |
|
977 - Use this mode to request both read and write access when another client needs |
|
978 to write to the file and respective client access to the file is coordinated. |
|
979 - To open a file for non-exclusive write, use EFileShareAny | EFileWrite. |
|
980 - It is recommended that either EFileShareAny or EFileShareAny | EFileRead are |
|
981 not used. These combinations will block users attempting to use the |
|
982 EFileShareReadersOnly mode even if all the EFileShareAny handles do not have |
|
983 the EFileWrite bit set as the EFileRead and EFileWrite bits have no affect on |
|
984 sharing. Use either EFileShareReadersOnly or EFileShareReadersOrWriters. |
|
985 |
|
986 EFileShareReadersOrWriters |
|
987 - Use this mode when it does not matter if another file writes to the file and |
|
988 file access can not be coordinated as other clients are unknown. |
|
989 - To open a file for shared read access whilst permitting writers, use |
|
990 EFileShareReadersOrWriters | EFileRead. |
|
991 |
|
992 - For write access with unrestricted share mode, |
|
993 EFileShareReadersOrWriters | EFileWrite may be used however |
|
994 EFilesShareAny | EFileWrite is preferred. |
|
995 |
|
996 EFileShareReadersOnly |
|
997 - Use this mode to get read access to the file and deny write access for any |
|
998 other handles on this file. |
|
999 - To open a file for shared read access whilst disallowing writers use |
|
1000 EFileShareReadersOnly. |
|
1001 |
|
1002 |
|
1003 Files may be opened in text or binary mode. Native Symbian OS application |
|
1004 files are nearly all binary, (so they will usually be opened in binary mode). |
|
1005 However, they can be opened in text mode (to support testing, and to make them |
|
1006 compatible with text formats on remote systems). |
|
1007 Symbian OS native text format uses CR-LF (ASCII 0x0d, 0x0a) to denote the end of |
|
1008 a line. When reading, however, any combination of CR, LF, LF-CR or CR-LF is |
|
1009 recognised as the end of a line. Where a remote file system uses a different |
|
1010 format, it is the responsibility of the installable file system to present |
|
1011 an interface for text files which conforms with this format. |
|
1012 |
|
1013 The share mode may be OR’ed with either EFileStream or EFileStreamText. |
|
1014 |
|
1015 Additionally, it may be OR’ed with either EFileRead or EFileWrite. |
|
1016 */ |
|
1017 { |
|
1018 /** |
|
1019 Exclusive access for the program opening the file. |
|
1020 |
|
1021 No other program can access the file until it is closed. |
|
1022 If another program is already accessing the file in any share mode, then |
|
1023 an attempt to open it with an EFileShareExclusive will fail. |
|
1024 */ |
|
1025 EFileShareExclusive, |
|
1026 |
|
1027 |
|
1028 /** |
|
1029 Read-only sharing. |
|
1030 |
|
1031 This means that the file may only be accessed for reading. |
|
1032 A file cannot be opened using a share mode of EFileShareReadersOnly with |
|
1033 an EFileWrite flag. |
|
1034 */ |
|
1035 EFileShareReadersOnly, |
|
1036 |
|
1037 |
|
1038 /** |
|
1039 Shared access for reading and writing. |
|
1040 |
|
1041 This means that other programs may share access to the file for reading |
|
1042 and writing with the program which opened the file. |
|
1043 |
|
1044 When using this mode, the program is expecting another program to be able |
|
1045 to write to the file, so is not compatible with EFileShareReadersOnly. |
|
1046 */ |
|
1047 EFileShareAny, |
|
1048 |
|
1049 |
|
1050 /** |
|
1051 Shared access for reading and writing. |
|
1052 |
|
1053 This means that other programs may share access to the file for reading |
|
1054 and writing with the program which opened the file. |
|
1055 |
|
1056 When using this mode, the program does not care if another program has |
|
1057 the file open for read or write access. |
|
1058 */ |
|
1059 EFileShareReadersOrWriters, |
|
1060 |
|
1061 |
|
1062 /** |
|
1063 For files to be opened in binary mode. |
|
1064 */ |
|
1065 EFileStream=0, |
|
1066 |
|
1067 |
|
1068 /** |
|
1069 For files to be opened in text mode. |
|
1070 */ |
|
1071 EFileStreamText=0x100, |
|
1072 |
|
1073 |
|
1074 /** |
|
1075 The file may be read from but not written to. |
|
1076 */ |
|
1077 EFileRead=0, |
|
1078 |
|
1079 |
|
1080 /** |
|
1081 The file may be read from and written to |
|
1082 |
|
1083 Cannot be combined with a share mode of EFileShareReadersOnly. |
|
1084 */ |
|
1085 EFileWrite=0x200, |
|
1086 |
|
1087 /** |
|
1088 Specifies that an asynchronous read request should not be completed |
|
1089 until all requested data becomes available. |
|
1090 |
|
1091 Cannot be combined with the EFileShareExclusive or EFileShareReadersOnly |
|
1092 share modes as this will prohibit a writer from updating the file. |
|
1093 */ |
|
1094 EFileReadAsyncAll=0x400, |
|
1095 |
|
1096 /** |
|
1097 Enables write buffering |
|
1098 */ |
|
1099 EFileWriteBuffered =0x00000800, |
|
1100 |
|
1101 /** |
|
1102 Disables write buffering |
|
1103 */ |
|
1104 EFileWriteDirectIO =0x00001000, |
|
1105 |
|
1106 /** |
|
1107 Enables read buffering |
|
1108 */ |
|
1109 EFileReadBuffered =0x00002000, |
|
1110 |
|
1111 /** |
|
1112 Disables read buffering |
|
1113 */ |
|
1114 EFileReadDirectIO =0x00004000, |
|
1115 |
|
1116 /** |
|
1117 Enables read ahead. |
|
1118 */ |
|
1119 EFileReadAheadOn =0x00008000, |
|
1120 |
|
1121 /** |
|
1122 Disables read ahead. |
|
1123 */ |
|
1124 EFileReadAheadOff =0x00010000, |
|
1125 |
|
1126 /** |
|
1127 Enable delete on close |
|
1128 */ |
|
1129 EDeleteOnClose =0x00020000, |
|
1130 |
|
1131 /** |
|
1132 Enables operations on large files. |
|
1133 |
|
1134 @internalTechnology |
|
1135 |
|
1136 */ |
|
1137 EFileBigFile =0x00040000 |
|
1138 |
|
1139 }; |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 /** |
|
1145 @publishedAll |
|
1146 @released |
|
1147 |
|
1148 Bit mask provided for retrieving a file's share mode. |
|
1149 |
|
1150 @see TFileMode |
|
1151 */ |
|
1152 const TUint KFileShareMask=0xff; |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 enum TFormatMode |
|
1158 /** |
|
1159 @publishedAll |
|
1160 @released |
|
1161 |
|
1162 The format method. |
|
1163 */ |
|
1164 { |
|
1165 /** |
|
1166 Indicates a high density floppy disk to be formatted. |
|
1167 |
|
1168 Obsolete. |
|
1169 |
|
1170 Can be ORed with EFullFormat or EQuickFormat, but does not |
|
1171 have any effect. |
|
1172 */ |
|
1173 EHighDensity, |
|
1174 |
|
1175 |
|
1176 /** |
|
1177 Indicates a low density floppy disk to be formatted. |
|
1178 |
|
1179 Obsolete. |
|
1180 |
|
1181 Can be ORed with EFullFormat or EQuickFormat, but does not |
|
1182 have any effect. |
|
1183 */ |
|
1184 ELowDensity, |
|
1185 |
|
1186 |
|
1187 /** |
|
1188 Performs a full format, erasing whole media content and creating |
|
1189 new file system layout. |
|
1190 |
|
1191 This is the default mode. |
|
1192 */ |
|
1193 EFullFormat=0, |
|
1194 |
|
1195 |
|
1196 /** |
|
1197 Performs a quick media format, erasing only required minimum media content. |
|
1198 For example, for FAT file system it resets FAT and root directory content. |
|
1199 Also preserves bad sectors if there are some on the volume. |
|
1200 */ |
|
1201 EQuickFormat=0x100, |
|
1202 |
|
1203 |
|
1204 /** |
|
1205 Indicates a custom formatting mode. In this mode some optional file system |
|
1206 specific parameters may be passed to RFormat::Open(). |
|
1207 |
|
1208 @see TLDFormatInfo |
|
1209 @see TInt RFormat::Open(RFs &aFs, const TDesC &aName, TUint aFormatMode, TInt &aCount, const TDesC8 &anInfo); |
|
1210 */ |
|
1211 ESpecialFormat=0x200, |
|
1212 |
|
1213 /** |
|
1214 Forced erase of locked media |
|
1215 */ |
|
1216 EForceErase=0x400, |
|
1217 |
|
1218 /** |
|
1219 This flag enables formatting the volume even if it has files or directories opened on it. |
|
1220 If this flag is specified, the volume will be forcedly dismounted before performing media formatting. |
|
1221 |
|
1222 Even with this flag the RFormat::Open() can fail with KErrInUse in following cases: |
|
1223 1. if there are clamped files on the volume. |
|
1224 2. there are opened "disk access" objects, like RFormat or RRawDisk on the volume. |
|
1225 */ |
|
1226 EForceFormat = 0x800, |
|
1227 |
|
1228 }; |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 enum TSeek |
|
1234 /** |
|
1235 @publishedAll |
|
1236 @released |
|
1237 |
|
1238 Flags indicating the destination of a seek operation. |
|
1239 |
|
1240 File locations are specified as a 32-bit signed integer, |
|
1241 allowing offsets of ?GB from the origin of the seek. |
|
1242 |
|
1243 @see RFile::Seek |
|
1244 */ |
|
1245 { |
|
1246 /** |
|
1247 This can only be used for file systems with execute-in-place facilities, |
|
1248 such as the ROM file system: the offset specifies the absolute address of |
|
1249 the data. |
|
1250 */ |
|
1251 ESeekAddress, |
|
1252 |
|
1253 |
|
1254 /** |
|
1255 Destination is the start of file. |
|
1256 */ |
|
1257 ESeekStart, |
|
1258 |
|
1259 |
|
1260 /** |
|
1261 Destination is the current position in file. |
|
1262 */ |
|
1263 ESeekCurrent, |
|
1264 |
|
1265 |
|
1266 /** |
|
1267 Destination is the end of file. |
|
1268 */ |
|
1269 ESeekEnd |
|
1270 }; |
|
1271 |
|
1272 /** |
|
1273 @publishedAll |
|
1274 @released |
|
1275 |
|
1276 */ |
|
1277 class TBlockMapEntry : public TBlockMapEntryBase |
|
1278 { |
|
1279 public: |
|
1280 IMPORT_C TBlockMapEntry(); |
|
1281 IMPORT_C void SetNumberOfBlocks( TUint aNumberOfBlocks ); |
|
1282 IMPORT_C void SetStartBlock( TUint aStartBlock ); |
|
1283 }; |
|
1284 |
|
1285 /** |
|
1286 @publishedAll |
|
1287 @released |
|
1288 |
|
1289 */ |
|
1290 typedef TBuf8<KMaxMapsPerCall*sizeof(TBlockMapEntry)> TBlockArrayDes; |
|
1291 |
|
1292 struct SBlockMapInfo : public SBlockMapInfoBase |
|
1293 { |
|
1294 TBlockArrayDes iMap; |
|
1295 }; |
|
1296 |
|
1297 /** |
|
1298 @publishedAll |
|
1299 @released |
|
1300 */ |
|
1301 enum TBlockMapUsage |
|
1302 { |
|
1303 /* */ |
|
1304 EBlockMapUsagePaging, |
|
1305 /* */ |
|
1306 ETestDebug |
|
1307 }; |
|
1308 |
|
1309 class TEntry |
|
1310 /** |
|
1311 @publishedAll |
|
1312 @released |
|
1313 |
|
1314 Encapsulates an entry in a directory, which can be another (nested) directory, |
|
1315 a file or a volume label. |
|
1316 |
|
1317 Each directory entry has a name which is relative to its owning directory |
|
1318 and a type, which is indicated by its unique identifier (UID). |
|
1319 |
|
1320 An entry can be interrogated for the following properties: |
|
1321 |
|
1322 1. the kind of entry: stored in the entry UIDs, stored in iType |
|
1323 |
|
1324 2. the entry attributes, stored in iAtt |
|
1325 |
|
1326 3. the size of entry |
|
1327 |
|
1328 4. the time the entry was last modified. |
|
1329 |
|
1330 @see RDir |
|
1331 @see RFs::Entry |
|
1332 @see RFs::SetEntry |
|
1333 @see CfileBase::CurrentEntry |
|
1334 */ |
|
1335 { |
|
1336 public: |
|
1337 IMPORT_C TEntry(); |
|
1338 IMPORT_C TEntry(const TEntry& aEntry); |
|
1339 IMPORT_C TEntry& operator=(const TEntry& aEntry); |
|
1340 IMPORT_C TBool IsReadOnly() const; |
|
1341 IMPORT_C TBool IsHidden() const; |
|
1342 IMPORT_C TBool IsSystem() const; |
|
1343 IMPORT_C TBool IsDir() const; |
|
1344 IMPORT_C TBool IsArchive() const; |
|
1345 inline const TUid& operator[](TInt anIndex) const; |
|
1346 inline TBool IsUidPresent(TUid aUid) const; |
|
1347 inline TBool IsTypeValid() const; |
|
1348 inline TUid MostDerivedUid() const; |
|
1349 IMPORT_C TInt64 FileSize() const; |
|
1350 inline void SetFileSize(TInt64 aFileSize); |
|
1351 |
|
1352 private: |
|
1353 inline void Copy(const TEntry& aEntry); |
|
1354 inline void Unpack(); |
|
1355 |
|
1356 public: |
|
1357 /** |
|
1358 The individual bits within this byte indicate which attributes |
|
1359 have been set. |
|
1360 |
|
1361 @see KEntryAttNormal |
|
1362 @see KEntryAttReadOnly |
|
1363 @see KEntryAttHidden |
|
1364 @see KEntryAttSystem |
|
1365 */ |
|
1366 TUint iAtt; |
|
1367 |
|
1368 |
|
1369 /** |
|
1370 The size of the file in bytes. |
|
1371 For files larger that 2G it must be cast to TUint in order to avoid looking like negative signed. |
|
1372 */ |
|
1373 TInt iSize; |
|
1374 |
|
1375 |
|
1376 /** |
|
1377 The local time of last modification. |
|
1378 */ |
|
1379 TTime iModified; |
|
1380 |
|
1381 |
|
1382 /** |
|
1383 The file's UIDtype |
|
1384 */ |
|
1385 TUidType iType; |
|
1386 |
|
1387 |
|
1388 /** |
|
1389 The name of the file relative to the owning directory, |
|
1390 with a maximum of KMaxFileName characters. |
|
1391 |
|
1392 @see KMaxFileName |
|
1393 */ |
|
1394 TBufC<KMaxFileName> iName; |
|
1395 |
|
1396 private: |
|
1397 TUint32 iSizeHigh; |
|
1398 /** |
|
1399 Reserved for future expansion |
|
1400 */ |
|
1401 TUint32 iReserved; |
|
1402 }; |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 class RDir; |
|
1408 class TEntryArray |
|
1409 /** |
|
1410 @publishedAll |
|
1411 @released |
|
1412 |
|
1413 Array of directory entries. |
|
1414 |
|
1415 It contains the results of a call to RDir::Read(): it will contain all |
|
1416 the TEntry items in the directory. Thus, a directory can be read in |
|
1417 a single call, minimising client/server communication overheads. |
|
1418 |
|
1419 @see TEntry |
|
1420 @see RDir::Read |
|
1421 */ |
|
1422 { |
|
1423 public: |
|
1424 IMPORT_C TEntryArray(); |
|
1425 IMPORT_C TInt Count() const; |
|
1426 IMPORT_C const TEntry& operator[](TInt anIndex) const; |
|
1427 private: |
|
1428 TInt iCount; |
|
1429 TInt iIndex; |
|
1430 const TEntry* iPos; |
|
1431 TBuf8<KEntryArraySize> iBuf; |
|
1432 friend class RDir; |
|
1433 friend class RFs; |
|
1434 friend class TRawEntryArray; |
|
1435 }; |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 class TDriveInfo |
|
1441 /** |
|
1442 @publishedAll |
|
1443 @released |
|
1444 |
|
1445 Contains drive information. |
|
1446 |
|
1447 @see RFs::Drive |
|
1448 */ |
|
1449 { |
|
1450 public: |
|
1451 /** |
|
1452 The type of media mounted on the drive. |
|
1453 */ |
|
1454 TMediaType iType; |
|
1455 |
|
1456 |
|
1457 /** |
|
1458 Indicates whether the drive supports a battery, and if so, its state. |
|
1459 */ |
|
1460 TBatteryState iBattery; |
|
1461 |
|
1462 |
|
1463 /** |
|
1464 The drive attributes. |
|
1465 |
|
1466 @see KDriveAttLocal |
|
1467 @see KDriveAttRom |
|
1468 @see KDriveAttRedirected |
|
1469 @see KDriveAttSubsted |
|
1470 @see KDriveAttInternal |
|
1471 @see KDriveAttRemovable |
|
1472 */ |
|
1473 TUint iDriveAtt; |
|
1474 |
|
1475 |
|
1476 /** |
|
1477 The attributes of the media mounted on the drive. |
|
1478 |
|
1479 @see KMediaAttVariableSize |
|
1480 @see KMediaAttDualDensity |
|
1481 @see KMediaAttFormattable |
|
1482 @see KMediaAttWriteProtected |
|
1483 @see KMediaAttLockable |
|
1484 @see KMediaAttLocked |
|
1485 */ |
|
1486 TUint iMediaAtt; |
|
1487 private: |
|
1488 /** |
|
1489 Reserved for future expansion |
|
1490 */ |
|
1491 TUint32 iReserved; |
|
1492 }; |
|
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 class TVolumeInfo |
|
1498 /** |
|
1499 @publishedAll |
|
1500 @released |
|
1501 |
|
1502 Contains information about a volume mounted on a drive. Use RFs::Drive() if only |
|
1503 the drive information is required. |
|
1504 |
|
1505 If a drive supports removable media it may contain different volumes over time. |
|
1506 |
|
1507 Volume information is made up of information concerning the drive on which it is mounted, |
|
1508 which can also be accessed through RFs::Drive(), and the volume information, this is made |
|
1509 up of the size of the volume, the free space, its unique identifying number and a name. |
|
1510 |
|
1511 TVolumeInfo is initialised by RFs::Volume(). |
|
1512 |
|
1513 @see RFs::Volume() |
|
1514 @see RFs::Drive() |
|
1515 */ |
|
1516 { |
|
1517 public: |
|
1518 IMPORT_C TVolumeInfo(); |
|
1519 |
|
1520 /** |
|
1521 Information about the drive on which the volume is mounted. |
|
1522 |
|
1523 @see TDriveInfo |
|
1524 */ |
|
1525 TDriveInfo iDrive; |
|
1526 |
|
1527 |
|
1528 /** |
|
1529 The volume’s unique identifying number. |
|
1530 */ |
|
1531 TUint iUniqueID; |
|
1532 |
|
1533 |
|
1534 /** |
|
1535 The maximum size of the volume in bytes. The current amount of memory |
|
1536 in use plus the amount of free memory. |
|
1537 */ |
|
1538 TInt64 iSize; |
|
1539 |
|
1540 |
|
1541 /** |
|
1542 The amount of free space on the volume in bytes. |
|
1543 */ |
|
1544 TInt64 iFree; |
|
1545 |
|
1546 |
|
1547 /** |
|
1548 Name of the volume, with a maximum of KMaxFileName characters. |
|
1549 |
|
1550 This field is optional. |
|
1551 |
|
1552 @see KMaxFileName |
|
1553 */ |
|
1554 TBufC<KMaxFileName> iName; |
|
1555 |
|
1556 /** |
|
1557 Flags which define the default file-caching behaviour for this volume |
|
1558 |
|
1559 @see TFileCacheFlags |
|
1560 */ |
|
1561 TFileCacheFlags iFileCacheFlags; |
|
1562 |
|
1563 /** |
|
1564 @prototype |
|
1565 @internalTechnology |
|
1566 Internal flag, used in the case of non-blocking getting volume information. |
|
1567 @see RFs::Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) |
|
1568 |
|
1569 If this flag is set, it means that the volume information will be obtained |
|
1570 asynchronously. More specific, on return iFree will reflect the _current_ amount of free space on volume at the moment of |
|
1571 RFs::Volume() call, not the exact final value. This is because in this case getting volume information will be asynchronous, |
|
1572 and the client will not be suspended until the mount finish calculating free space. At present appicable to FAT32 file system only. |
|
1573 */ |
|
1574 TUint8 iVolSizeAsync : 1; |
|
1575 |
|
1576 private: |
|
1577 /** |
|
1578 Reserved for future expansion |
|
1579 */ |
|
1580 TUint8 i8Reserved1; |
|
1581 TUint16 i16Reserved1; |
|
1582 TUint32 i32Reserved1; |
|
1583 TUint32 i32Reserved2; |
|
1584 }; |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 class TDriveUnit |
|
1590 /** |
|
1591 @publishedAll |
|
1592 @released |
|
1593 |
|
1594 Drive numbers and letters. |
|
1595 |
|
1596 A drive may be represented by either an integer between zero and twenty five |
|
1597 inclusive, or by a buffer descriptor containing a character between "A" and "Z" |
|
1598 inclusive, followed by a colon. |
|
1599 This class encapsulates both representations. |
|
1600 An instance of this class is constructed specifying either the drive number |
|
1601 or the drive letter and may be converted between the two representations. |
|
1602 */ |
|
1603 { |
|
1604 public: |
|
1605 inline TDriveUnit() {}; |
|
1606 IMPORT_C TDriveUnit(TInt aDrive); |
|
1607 IMPORT_C TDriveUnit(const TDesC& aDrive); |
|
1608 IMPORT_C TDriveUnit& operator=(TInt aDrive); |
|
1609 IMPORT_C TDriveUnit& operator=(const TDesC& aDrive); |
|
1610 inline operator TInt() const; |
|
1611 IMPORT_C TDriveName Name() const; |
|
1612 private: |
|
1613 TInt iDrive; |
|
1614 }; |
|
1615 |
|
1616 |
|
1617 |
|
1618 |
|
1619 class RFs; |
|
1620 // |
|
1621 class TParseBase |
|
1622 /** |
|
1623 @publishedAll |
|
1624 @released |
|
1625 |
|
1626 Base class for file name parsing. |
|
1627 |
|
1628 You first need to set up the path to be parsed using either a TParse, TParsePtr |
|
1629 or TParsePtrC object. |
|
1630 |
|
1631 The interrogation and extraction functions in this class allow you to test |
|
1632 whether a component has been specified in the pathname, and if so, |
|
1633 to extract it. If a component is not present in the pathname, |
|
1634 the extraction function returns an empty string. |
|
1635 |
|
1636 This class also allows directories to be added to, and popped from the path. |
|
1637 |
|
1638 Notes: |
|
1639 |
|
1640 1. the filename modification functions cannot be used by the TParsePtrC class. |
|
1641 |
|
1642 2. navigation using .. and . is not supported. |
|
1643 |
|
1644 @see TParse |
|
1645 @see TParsePtr |
|
1646 @see TParsePtrC |
|
1647 */ |
|
1648 { |
|
1649 private: |
|
1650 struct SField {TUint8 pos;TUint8 len;TUint8 present;TUint8 filler;}; |
|
1651 enum TField {EDrive,EPath,EName,EExt,EMaxFields}; |
|
1652 enum TWild {EWildName=0x01,EWildExt=0x02,EWildEither=0x04,EIsRoot=0x08,EWildIsKMatchOne=0x10,EWildIsKMatchAny=0x20}; |
|
1653 public: |
|
1654 IMPORT_C TParseBase(); |
|
1655 IMPORT_C TInt PopDir(); |
|
1656 IMPORT_C TInt AddDir(const TDesC& aName); |
|
1657 IMPORT_C const TDesC& FullName() const; |
|
1658 IMPORT_C TPtrC Drive() const; |
|
1659 IMPORT_C TPtrC Path() const; |
|
1660 IMPORT_C TPtrC DriveAndPath() const; |
|
1661 IMPORT_C TPtrC Name() const; |
|
1662 IMPORT_C TPtrC Ext() const; |
|
1663 IMPORT_C TPtrC NameAndExt() const; |
|
1664 IMPORT_C TBool DrivePresent() const; |
|
1665 IMPORT_C TBool PathPresent() const; |
|
1666 IMPORT_C TBool NamePresent() const; |
|
1667 IMPORT_C TBool ExtPresent() const; |
|
1668 IMPORT_C TBool NameOrExtPresent() const; |
|
1669 IMPORT_C TBool IsRoot() const; |
|
1670 IMPORT_C TBool IsWild() const; |
|
1671 IMPORT_C TBool IsKMatchOne() const; |
|
1672 IMPORT_C TBool IsKMatchAny() const; |
|
1673 IMPORT_C TBool IsNameWild() const; |
|
1674 IMPORT_C TBool IsExtWild() const; |
|
1675 protected: |
|
1676 virtual TDes& NameBuf() = 0; // Reference to derived class descriptor containing the filename. |
|
1677 virtual const TDesC& NameBufC() const = 0; // const reference to derived class descriptor containing the filename. |
|
1678 TInt Set(const TDesC* aName,const TDesC* aRelated,const TDesC* aDefault,TBool allowWild); |
|
1679 private: |
|
1680 TInt ParseDrive(TLex& aName,TBool& aDone); |
|
1681 TInt ParsePath(TLex& aName,TBool& aDone); |
|
1682 TInt ParseName(TLex& aName,TBool& aDone); |
|
1683 TInt ParseExt(TLex& aName,TBool& aDone); |
|
1684 protected: |
|
1685 TInt16 iMod; // Non-zero indicates File name modification functionality is enabled. |
|
1686 private: |
|
1687 TInt16 iWild; |
|
1688 SField iField[EMaxFields]; |
|
1689 }; |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 class TParsePtr : public TParseBase |
|
1695 /** |
|
1696 @publishedAll |
|
1697 @released |
|
1698 |
|
1699 Parses filenames using less space on the stack than TParse. |
|
1700 |
|
1701 Stores a reference to a filename, unlike TParse, which uses |
|
1702 a 512 byte TFileName object as an internal buffer to store |
|
1703 a copy of the filename. |
|
1704 The filename's components (drive, path, etc.) can be retrieved using |
|
1705 the functions provided by the base class, TParseBase. |
|
1706 This class should be used in preference to TParse when minimising stack |
|
1707 usage is a priority. |
|
1708 |
|
1709 @see TParse |
|
1710 @see TFileName |
|
1711 */ |
|
1712 { |
|
1713 public: |
|
1714 IMPORT_C TParsePtr(TDes& aName); |
|
1715 protected: |
|
1716 IMPORT_C TDes& NameBuf(); |
|
1717 IMPORT_C const TDesC& NameBufC() const; |
|
1718 private: |
|
1719 TPtr iNameBuf; |
|
1720 }; |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 class TParsePtrC : public TParseBase |
|
1726 /** |
|
1727 @publishedAll |
|
1728 @released |
|
1729 |
|
1730 Parses, but cannot modify, filenames using less space on the stack than TParse. |
|
1731 |
|
1732 Stores a reference to a filename, unlike TParse, which uses |
|
1733 a 512 byte TFileName object as an internal buffer to store |
|
1734 a copy of the filename. |
|
1735 The filename's components (drive, path, etc.) can be retrieved using |
|
1736 the functions provided by the base class, TParseBase. |
|
1737 Note that because the filename cannot be modified through this class, |
|
1738 the base class functions PopDir() and AddDir() cannot be called, because |
|
1739 a panic will be raised. |
|
1740 |
|
1741 @see TParse |
|
1742 @see TFileName |
|
1743 */ |
|
1744 { |
|
1745 public: |
|
1746 IMPORT_C TParsePtrC(const TDesC& aName); |
|
1747 protected: |
|
1748 IMPORT_C TDes& NameBuf(); |
|
1749 IMPORT_C const TDesC& NameBufC() const; |
|
1750 private: |
|
1751 TPtrC iNameBuf; |
|
1752 }; |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 class TParse : public TParseBase |
|
1758 /** |
|
1759 @publishedAll |
|
1760 @released |
|
1761 |
|
1762 Parses filenames. |
|
1763 |
|
1764 The class uses the full filename structure supported by Symbian OS. |
|
1765 |
|
1766 TParse works by using the Set() function to set up the filename to be parsed. |
|
1767 Then, various getter functions defined in the base class, TParseBase, such as: |
|
1768 FullName(), Drive(), Path(), DriveAndPath(), Name(), Ext() and NameAndExt() |
|
1769 may be used to retrieve path components. |
|
1770 |
|
1771 There are a number of restrictions to valid path components, which are |
|
1772 described in guide documentation. |
|
1773 */ |
|
1774 { |
|
1775 public: |
|
1776 IMPORT_C TParse(); |
|
1777 IMPORT_C TInt Set(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault); |
|
1778 IMPORT_C TInt SetNoWild(const TDesC& aName,const TDesC* aRelated,const TDesC* aDefault); |
|
1779 protected: |
|
1780 IMPORT_C TDes& NameBuf(); |
|
1781 IMPORT_C const TDesC& NameBufC() const; |
|
1782 private: |
|
1783 TFileName iNameBuf; |
|
1784 }; |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 class CDir : public CBase |
|
1790 /** |
|
1791 @publishedAll |
|
1792 @released |
|
1793 |
|
1794 Array of directory entries that has been read into memory from the file system. |
|
1795 |
|
1796 It can be read and sorted by user programs, but cannot be created by them. |
|
1797 */ |
|
1798 { |
|
1799 public: |
|
1800 IMPORT_C virtual ~CDir(); |
|
1801 IMPORT_C TInt Count() const; |
|
1802 IMPORT_C const TEntry& operator[](TInt anIndex) const; |
|
1803 IMPORT_C TInt Sort(TUint aEntrySortKey); |
|
1804 protected: |
|
1805 IMPORT_C CDir(); |
|
1806 IMPORT_C static CDir* NewL(); |
|
1807 IMPORT_C void AddL(const TEntry& anEntry); |
|
1808 IMPORT_C void ExtractL(TBool aRemove,CDir*& aDir); |
|
1809 IMPORT_C void Compress(); |
|
1810 protected: |
|
1811 CArrayPakFlat<TEntry>* iArray; |
|
1812 friend class RFs; |
|
1813 friend class TOpenFileScan; |
|
1814 }; |
|
1815 |
|
1816 |
|
1817 #if defined SYMBIAN_PRIVATE_EFSRV |
|
1818 #define EFSRV_EXPORT_C |
|
1819 #define EFSRV_IMPORT_C |
|
1820 #else |
|
1821 #define EFSRV_EXPORT_C EXPORT_C |
|
1822 #define EFSRV_IMPORT_C IMPORT_C |
|
1823 #endif |
|
1824 |
|
1825 |
|
1826 class RFs : public RSessionBase |
|
1827 /** |
|
1828 @publishedAll |
|
1829 @released |
|
1830 |
|
1831 A handle to a file server session. |
|
1832 |
|
1833 A program or thread may have arbitrarily many sessions open simultaneously. |
|
1834 |
|
1835 Use this class for all file system manipulation, including: |
|
1836 |
|
1837 1. adding, removing, moving and renaming files and directories |
|
1838 |
|
1839 2. inspecting and changing file attributes and directory entry details. |
|
1840 These include the time and date when the file or directory was last |
|
1841 written to, its size and various attribute flags such as read-only, |
|
1842 hidden, archive or system. |
|
1843 |
|
1844 3. finding a file’s real name; if the file system on which it is stored |
|
1845 has to "mangle" the name into a shorter format |
|
1846 |
|
1847 4. getting directory listings |
|
1848 |
|
1849 5. maintaining a default path; unlike some other systems, there is a single |
|
1850 system default path, rather than one for each drive: the default path |
|
1851 consists of a drive and a path specification. |
|
1852 |
|
1853 6. performing context-sensitive parses using TParse objects, and |
|
1854 the session path |
|
1855 |
|
1856 7. obtaining information on drives and volumes |
|
1857 |
|
1858 8. formatting and labelling volumes |
|
1859 |
|
1860 9. obtaining a list of valid drives |
|
1861 |
|
1862 10. emulating the DOS subst command, which allows any directory to appear |
|
1863 as if it were a separate drive |
|
1864 |
|
1865 11. requesting notification of when significant change occurs. |
|
1866 This can be used for programs which maintain file lists, but must |
|
1867 update those lists when change occurs. |
|
1868 |
|
1869 12. finding the version number of the file server |
|
1870 |
|
1871 13. resource counting to ensure that all resources are closed when |
|
1872 the session terminates. |
|
1873 |
|
1874 This class is not intended for user derivation. |
|
1875 |
|
1876 The following restrictions apply when a path is specified: |
|
1877 |
|
1878 1. its total length must not exceed 256 characters |
|
1879 |
|
1880 2. wildcards cannot be used in the drive or in any directory name, |
|
1881 although they may be allowed in the filename and extension. |
|
1882 |
|
1883 3. double backslashes are not allowed in the path. |
|
1884 |
|
1885 4. the following characters must not be included anywhere in the path: < > " / | |
|
1886 |
|
1887 5. a colon may only be included between the drive and path |
|
1888 |
|
1889 6. no directory name or filename plus extension may consist solely |
|
1890 of space characters, or of a single or double dot. |
|
1891 |
|
1892 7. spaces between the drive, if specified, and the first directory in |
|
1893 the path are illegal, although there may be spaces between other |
|
1894 path components, for instance between directories. |
|
1895 */ |
|
1896 { |
|
1897 public: |
|
1898 EFSRV_IMPORT_C TInt Connect(TInt aMessageSlots=KFileServerDefaultMessageSlots); |
|
1899 EFSRV_IMPORT_C void Close(); |
|
1900 EFSRV_IMPORT_C TVersion Version() const; |
|
1901 EFSRV_IMPORT_C TInt AddFileSystem(const TDesC& aFileName) const; |
|
1902 EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const; |
|
1903 EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,TInt aDrive, TBool aIsSync) const; |
|
1904 EFSRV_IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,TInt aDrive,TBool& aIsMountSuccess) const; |
|
1905 EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive); |
|
1906 EFSRV_IMPORT_C TInt MountFileSystem(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive, TBool aIsSync); |
|
1907 EFSRV_IMPORT_C TInt MountFileSystemAndScan(const TDesC& aFileSystemName,const TDesC& aExtensionName,TInt aDrive,TBool& aIsMountSuccess) const; |
|
1908 EFSRV_IMPORT_C TInt DismountFileSystem(const TDesC& aFileSystemName,TInt aDrive) const; |
|
1909 EFSRV_IMPORT_C TInt RemoveFileSystem(const TDesC& aFileSystemName) const; |
|
1910 EFSRV_IMPORT_C TInt FileSystemName(TDes& aName,TInt aDrive) const; |
|
1911 EFSRV_IMPORT_C TInt AddExtension(const TDesC& aFileName); |
|
1912 EFSRV_IMPORT_C TInt MountExtension(const TDesC& aExtensionName,TInt aDrive); |
|
1913 EFSRV_IMPORT_C TInt DismountExtension(const TDesC& aExtensionName,TInt aDrive); |
|
1914 EFSRV_IMPORT_C TInt RemoveExtension(const TDesC& aExtensionName); |
|
1915 EFSRV_IMPORT_C TInt ExtensionName(TDes& aExtensionName,TInt aDrive,TInt aPos); |
|
1916 EFSRV_IMPORT_C TInt RemountDrive(TInt aDrive,const TDesC8* aMountInfo=NULL,TUint aFlags=0); |
|
1917 EFSRV_IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat); |
|
1918 EFSRV_IMPORT_C void NotifyChange(TNotifyType aType,TRequestStatus& aStat,const TDesC& aPathName); |
|
1919 EFSRV_IMPORT_C void NotifyChangeCancel(); |
|
1920 EFSRV_IMPORT_C void NotifyChangeCancel(TRequestStatus& aStat); |
|
1921 EFSRV_IMPORT_C void NotifyDiskSpace(TInt64 aThreshold,TInt aDrive,TRequestStatus& aStat); |
|
1922 EFSRV_IMPORT_C void NotifyDiskSpaceCancel(TRequestStatus& aStat); |
|
1923 EFSRV_IMPORT_C void NotifyDiskSpaceCancel(); |
|
1924 EFSRV_IMPORT_C TInt DriveList(TDriveList& aList) const; |
|
1925 EFSRV_IMPORT_C TInt DriveList(TDriveList& aList, TUint aFlags) const; |
|
1926 EFSRV_IMPORT_C TInt Drive(TDriveInfo& anInfo,TInt aDrive=KDefaultDrive) const; |
|
1927 EFSRV_IMPORT_C TInt Volume(TVolumeInfo& aVol,TInt aDrive=KDefaultDrive) const; |
|
1928 EFSRV_IMPORT_C void Volume(TVolumeInfo& aVol,TInt aDrive, TRequestStatus& aStat) const; |
|
1929 EFSRV_IMPORT_C TInt SetVolumeLabel(const TDesC& aName,TInt aDrive=KDefaultDrive); |
|
1930 EFSRV_IMPORT_C TInt Subst(TDes& aPath,TInt aDrive=KDefaultDrive) const; |
|
1931 EFSRV_IMPORT_C TInt SetSubst(const TDesC& aPath,TInt aDrive=KDefaultDrive); |
|
1932 EFSRV_IMPORT_C TInt RealName(const TDesC& aName,TDes& aResult) const; |
|
1933 EFSRV_IMPORT_C TInt GetMediaSerialNumber(TMediaSerialNumber& aSerialNum, TInt aDrive); |
|
1934 EFSRV_IMPORT_C TInt SessionPath(TDes& aPath) const; |
|
1935 EFSRV_IMPORT_C TInt SetSessionPath(const TDesC& aPath); |
|
1936 EFSRV_IMPORT_C TInt Parse(const TDesC& aName,TParse& aParse) const; |
|
1937 EFSRV_IMPORT_C TInt Parse(const TDesC& aName,const TDesC& aRelated,TParse& aParse) const; |
|
1938 EFSRV_IMPORT_C TInt MkDir(const TDesC& aPath); |
|
1939 EFSRV_IMPORT_C TInt MkDirAll(const TDesC& aPath); |
|
1940 EFSRV_IMPORT_C TInt RmDir(const TDesC& aPath); |
|
1941 EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList) const; |
|
1942 EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList) const; |
|
1943 EFSRV_IMPORT_C TInt GetDir(const TDesC& aName,const TUidType& anEntryUid,TUint anEntrySortKey,CDir*& aFileList) const; |
|
1944 EFSRV_IMPORT_C TInt Delete(const TDesC& aName); |
|
1945 EFSRV_IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName); |
|
1946 EFSRV_IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName); |
|
1947 EFSRV_IMPORT_C TInt Att(const TDesC& aName,TUint& aAttValue) const; |
|
1948 EFSRV_IMPORT_C TInt SetAtt(const TDesC& aName,TUint aSetAttMask,TUint aClearAttMask); |
|
1949 EFSRV_IMPORT_C TInt Modified(const TDesC& aName,TTime& aTime) const; |
|
1950 EFSRV_IMPORT_C TInt SetModified(const TDesC& aName,const TTime& aTime); |
|
1951 EFSRV_IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const; |
|
1952 EFSRV_IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); |
|
1953 private: |
|
1954 EFSRV_IMPORT_C TInt ReadFileSection_RESERVED(const TDesC& aName,TInt aPos,TDes8& aDes,TInt aLength) const; |
|
1955 public: |
|
1956 EFSRV_IMPORT_C static TBool IsValidDrive(TInt aDrive); |
|
1957 EFSRV_IMPORT_C static TInt CharToDrive(TChar aChar,TInt& aDrive); |
|
1958 EFSRV_IMPORT_C static TInt DriveToChar(TInt aDrive,TChar& aChar); |
|
1959 EFSRV_IMPORT_C static TBool IsRomAddress(TAny* aAny); |
|
1960 EFSRV_IMPORT_C static TDriveNumber GetSystemDrive(); |
|
1961 EFSRV_IMPORT_C static TChar GetSystemDriveChar(); |
|
1962 EFSRV_IMPORT_C TInt SetSystemDrive(TDriveNumber aSystemDrive); |
|
1963 EFSRV_IMPORT_C void ResourceCountMarkStart() const; |
|
1964 EFSRV_IMPORT_C void ResourceCountMarkEnd() const; |
|
1965 EFSRV_IMPORT_C TInt ResourceCount() const; |
|
1966 EFSRV_IMPORT_C TInt IsFileOpen(const TDesC& aFile,TBool& anAnswer) const; |
|
1967 EFSRV_IMPORT_C TInt CheckDisk(const TDesC& aDrive) const; |
|
1968 EFSRV_IMPORT_C TInt ScanDrive(const TDesC& aDrive) const; |
|
1969 EFSRV_IMPORT_C TInt GetShortName(const TDesC& aLongName,TDes& aShortName) const; |
|
1970 EFSRV_IMPORT_C TInt GetLongName(const TDesC& aShortName,TDes& aLongName) const; |
|
1971 EFSRV_IMPORT_C TBool GetNotifyUser(); |
|
1972 EFSRV_IMPORT_C void SetNotifyUser(TBool aValue); |
|
1973 EFSRV_IMPORT_C TUint8* IsFileInRom(const TDesC& aFileName) const; |
|
1974 EFSRV_IMPORT_C TBool IsValidName(const TDesC& anEntryName) const; |
|
1975 EFSRV_IMPORT_C TBool IsValidName(const TDesC& aFileName,TText& aBadChar) const; |
|
1976 EFSRV_IMPORT_C TInt GetDriveName(TInt aDrive,TDes& aDriveName) const; |
|
1977 EFSRV_IMPORT_C TInt SetDriveName(TInt aDrive,const TDesC& aDriveName); |
|
1978 EFSRV_IMPORT_C TInt LoaderHeapFunction(TInt aFunction, TAny *aArg1=NULL, TAny *aArg2=NULL); |
|
1979 IMPORT_C TInt SetErrorCondition(TInt anError,TInt aCount=0); |
|
1980 EFSRV_IMPORT_C TInt SetDebugRegister(TInt aVal); |
|
1981 EFSRV_IMPORT_C TInt SetAllocFailure(TInt aAllocNum); |
|
1982 EFSRV_IMPORT_C void DebugNotify(TInt aDrive,TUint aNotifyType,TRequestStatus& aStat); |
|
1983 EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand); |
|
1984 EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1); |
|
1985 EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TDes8& aParam1,TDes8& aParam2); |
|
1986 EFSRV_IMPORT_C TInt ControlIo(TInt aDrive,TInt aCommand,TAny* aParam1,TAny* aParam2); |
|
1987 EFSRV_IMPORT_C TInt LockDrive(TInt aDrv, const TMediaPassword &aOld, const TMediaPassword &aNew, TBool aStr); |
|
1988 EFSRV_IMPORT_C TInt UnlockDrive(TInt aDrv, const TMediaPassword &Pswd, TBool aStr); |
|
1989 EFSRV_IMPORT_C TInt ClearPassword(TInt aDrv, const TMediaPassword &aPswd); |
|
1990 EFSRV_IMPORT_C TInt ErasePassword(TInt aDrv); |
|
1991 EFSRV_IMPORT_C TInt SetSessionToPrivate(TInt aDrive); |
|
1992 EFSRV_IMPORT_C TInt PrivatePath(TDes& aPath); |
|
1993 EFSRV_IMPORT_C TInt CreatePrivatePath(TInt aDrive); |
|
1994 EFSRV_IMPORT_C void StartupInitComplete(TRequestStatus& aStat); |
|
1995 EFSRV_IMPORT_C TInt SetLocalDriveMapping(const TDesC8& aMapping); |
|
1996 |
|
1997 EFSRV_IMPORT_C TInt FinaliseDrives(); |
|
1998 |
|
1999 /** specifies drive finalisation modes */ |
|
2000 enum TFinaliseDrvMode |
|
2001 { |
|
2002 EFinal_RW, ///< after successful finalisation the drive remains writable and will become "not finalised" after the first write operation. |
|
2003 EFinal_RO, ///< after successful finalisation the drive becomes read-only |
|
2004 EForceUnfinalise///< @internalComponent mark the drive as "not finalised" can result in KErrAbort if the dive is in inconsistent state. |
|
2005 }; |
|
2006 |
|
2007 EFSRV_IMPORT_C TInt FinaliseDrive(TInt aDriveNo, TFinaliseDrvMode aMode) const; |
|
2008 |
|
2009 EFSRV_IMPORT_C TInt SwapFileSystem(const TDesC& aOldFileSystemName,const TDesC& aNewFileSystemName,TInt aDrive) const; |
|
2010 EFSRV_IMPORT_C TInt ReserveDriveSpace(TInt aDriveNo, TInt aSpace); |
|
2011 EFSRV_IMPORT_C TInt GetReserveAccess(TInt aDriveNo); |
|
2012 EFSRV_IMPORT_C TInt ReleaseReserveAccess(TInt aDriveNo); |
|
2013 |
|
2014 EFSRV_IMPORT_C TInt AddPlugin(const TDesC& aFileName) const; |
|
2015 EFSRV_IMPORT_C TInt RemovePlugin(const TDesC& aPluginName) const; |
|
2016 EFSRV_IMPORT_C TInt PluginName(TDes& aPluginName,TInt aDrive,TInt aPos); |
|
2017 |
|
2018 EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName) const; |
|
2019 EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive) const; |
|
2020 EFSRV_IMPORT_C TInt MountPlugin(const TDesC& aPluginName,TInt aDrive, TInt aPos) const; |
|
2021 |
|
2022 EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName) const; |
|
2023 EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive) const; |
|
2024 EFSRV_IMPORT_C TInt DismountPlugin(const TDesC& aPluginName,TInt aDrive,TInt aPos) const; |
|
2025 |
|
2026 EFSRV_IMPORT_C void NotifyDismount(TInt aDrive, TRequestStatus& aStat, TNotifyDismountMode aMode=EFsDismountRegisterClient) const; |
|
2027 EFSRV_IMPORT_C void NotifyDismountCancel(TRequestStatus& aStat) const; |
|
2028 EFSRV_IMPORT_C void NotifyDismountCancel() const; |
|
2029 EFSRV_IMPORT_C TInt AllowDismount(TInt aDrive) const; |
|
2030 EFSRV_IMPORT_C TInt SetStartupConfiguration(TInt aCommand,TAny* aParam1,TAny* aParam2) const; |
|
2031 EFSRV_IMPORT_C TInt AddCompositeMount(const TDesC& aFileSystemName,TInt aLocalDriveToMount,TInt aCompositeDrive, TBool aSync) const; |
|
2032 EFSRV_IMPORT_C TInt SetNotifyChange(TBool aNotifyChange); |
|
2033 EFSRV_IMPORT_C TInt QueryVolumeInfoExt(TInt aDrive, TQueryVolumeInfoExtCmd aCommand, TDes8& aInfo) const; |
|
2034 EFSRV_IMPORT_C TInt VolumeIOParam(TInt aDriveNo, TVolumeIOParamInfo& aParamInfo) const; |
|
2035 EFSRV_IMPORT_C TInt FileSystemSubType(TInt aDriveNo, TDes& aName) const; |
|
2036 EFSRV_IMPORT_C TInt InitialisePropertiesFile(const TPtrC8& aPtr) const; |
|
2037 |
|
2038 IMPORT_C TInt AddProxyDrive(const TDesC& aFileName); |
|
2039 IMPORT_C TInt RemoveProxyDrive(const TDesC& aDriveName); |
|
2040 |
|
2041 template <class T0,class T1> inline TInt MountProxyDrive(const TUint aDrive, const TDesC& aName, T0 a0, T1 a1) |
|
2042 { return(DoMountProxyDrive(TIpcArgs(aDrive, &aName, a0, a1))); }; |
|
2043 IMPORT_C TInt DismountProxyDrive(const TUint aDrive); |
|
2044 |
|
2045 TInt Unclamp(const RFileClamp& aHandle); |
|
2046 |
|
2047 EFSRV_IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const; |
|
2048 |
|
2049 /** |
|
2050 This class is used to for returning meaningful error code values to users of RFs::IsValidName(const TDesC& ,TNameValidParam& ) |
|
2051 @see TError |
|
2052 */ |
|
2053 class TNameValidParam |
|
2054 { |
|
2055 public: |
|
2056 /** Initialises the members of the class. By default iUseSessionPath is set to EFalse, however one could set it to ETrue.*/ |
|
2057 inline TNameValidParam(TBool aUseSessionPath = EFalse); |
|
2058 |
|
2059 /** possible error codes */ |
|
2060 enum TError |
|
2061 { |
|
2062 ErrNone, ///< no error. |
|
2063 ErrBadCharacter, ///< aName contains a bad character; and its position is in iInvalidCharPos. |
|
2064 ErrBadName, ///< aName isn't a valid file or directory name. |
|
2065 ErrNameTooLong ///< aName length or aName + session path length (see iUseSessionPath) is longer than 256 characters. |
|
2066 }; |
|
2067 |
|
2068 inline TError ErrorCode() const; |
|
2069 inline void UseSessionPath(TBool aUseSessionPath); |
|
2070 inline TUint InvalidCharPos() const; |
|
2071 friend class TFsIsValidName; |
|
2072 private: |
|
2073 TError iError; ///< the reason why aName is invalid, see TError |
|
2074 TBool iUseSessionPath; ///< if ETrue, and if aName isn't fully specified, missing parts will be taken from the session path |
|
2075 TUint iInvalidCharPos; ///< may contain invalid character position if error is ErrBadCharacter,else 0. |
|
2076 }; |
|
2077 EFSRV_IMPORT_C TBool IsValidName(const TDesC& aName, TNameValidParam& aParam ); |
|
2078 |
|
2079 /** Special enumerator values for the SupportedFileSystemName() API */ |
|
2080 enum |
|
2081 { |
|
2082 KRootFileSystem = 0x00800000, ///< specifies "root" file system. The result will be the same as for FileSystemName() API call |
|
2083 KFirstChildFileSystem = 0 ///< specifies the first child file system number, the second will be KFirstChildFileSystem+1 etc. |
|
2084 }; |
|
2085 |
|
2086 EFSRV_IMPORT_C TInt SupportedFileSystemName(TDes& aName, TInt aDrive, TInt aFsEnumerator) const; |
|
2087 |
|
2088 protected: |
|
2089 TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
2090 |
|
2091 private: |
|
2092 void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,CDir*& aDirList,RDir& aDir) const; |
|
2093 void GetDirL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; |
|
2094 void GetDirL(const TDesC& aMatchName,const TUidType& aUidType,TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; |
|
2095 void DoGetDirL(TUint anEntrySortKey,CDir*& anEntryList,RDir& aDir) const; |
|
2096 TInt GetOpenFileList(TInt& aSessionNum,TInt& aLocalPos,TThreadId& aThreadId,TEntryArray& anArray) const; |
|
2097 |
|
2098 IMPORT_C TInt DoMountProxyDrive(const TIpcArgs& ipcArgs); |
|
2099 |
|
2100 friend class TOpenFileScan; |
|
2101 friend class RFsPlugin; |
|
2102 }; |
|
2103 |
|
2104 |
|
2105 //------------------------------------------------------------------------------------------------------------------- |
|
2106 |
|
2107 /** |
|
2108 |
|
2109 Base class for volume formatting parameters. This class package buffer, TVolFormatParamBuf or |
|
2110 packaged buffer of the derived class can be passed to the RFormat::Open() in order to provide |
|
2111 file system-specific formatting parameters. |
|
2112 Each file system that supports such formatting parameters shall have this class specialisation (e.g. TVolFormatParam_FAT) |
|
2113 All classes, derived from this one must have the same size as the base class. |
|
2114 In order to use formatting parameters the format mode shall have ESpecialFormat bit flag set. |
|
2115 |
|
2116 |
|
2117 @see RFormat::Open(RFs&,const TDesC&,TUint,TInt& ,const TDesC8& anInfo); |
|
2118 @see TVolFormatParamBuf |
|
2119 |
|
2120 @publishedAll |
|
2121 @released |
|
2122 */ |
|
2123 class TVolFormatParam |
|
2124 { |
|
2125 public: |
|
2126 inline TVolFormatParam(); |
|
2127 inline void Init(); |
|
2128 |
|
2129 inline void SetFileSystemName(const TDesC& aFsName); |
|
2130 |
|
2131 static inline TUint32 CalcFSNameHash(const TDesC& aFsName); |
|
2132 inline TUint32 FSNameHash() const; |
|
2133 |
|
2134 inline TBool SomeParamsSet() const; |
|
2135 |
|
2136 |
|
2137 protected: |
|
2138 |
|
2139 |
|
2140 enum {KMaxDataSlots = 64}; ///< the size of data array iData |
|
2141 |
|
2142 inline void SetVal(TUint aIndex, TUint32 aVal); |
|
2143 inline TUint32 GetVal(TUint aIndex) const; |
|
2144 |
|
2145 |
|
2146 public: |
|
2147 enum {KUId = 0x820116A2}; ///< this value shell be in iUid field to identify this class object |
|
2148 |
|
2149 /** |
|
2150 This class tree UID. Used to distinguish the object of this class from TLDFormatInfo and other possible data structures. |
|
2151 For this and derived classes this field must be KUId. This field offset in the class must be 0 |
|
2152 */ |
|
2153 const TUint32 iUId; |
|
2154 |
|
2155 private: |
|
2156 TUint32 iFSysNameHash; ///< Up-cased file system name hash (crc32) used to designate the file system. 0 means "not set" |
|
2157 TBool iParamsSet : 1; ///< ETrue if any parameter was set (SetVal() called). Gets reset to EFalse by Init() |
|
2158 TUint32 iData[KMaxDataSlots]; ///< used as a pool for various data. The derived classes are free to use it by SetVal()/GetVal() |
|
2159 }; |
|
2160 |
|
2161 __ASSERT_COMPILE(_FOFF(TVolFormatParam, iUId) == 0); |
|
2162 __ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo)); |
|
2163 |
|
2164 |
|
2165 /** package buffer for the objects of class TVolFormatParamBuf */ |
|
2166 typedef TPckgBuf<TVolFormatParam> TVolFormatParamBuf; |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2172 /** |
|
2173 @publishedAll |
|
2174 @released |
|
2175 |
|
2176 Creates and opens a file, and performs all operations on a single open file. |
|
2177 |
|
2178 These include: |
|
2179 |
|
2180 - reading from and writing to the file |
|
2181 |
|
2182 - seeking to a position within the file |
|
2183 |
|
2184 - locking and unlocking within the file |
|
2185 |
|
2186 - setting file attributes |
|
2187 |
|
2188 Before using any of these services, a connection to a file server session must |
|
2189 have been made, and the file must be open. |
|
2190 |
|
2191 Opening Files: |
|
2192 |
|
2193 - use Open() to open an existing file for reading or writing; an error is |
|
2194 returned if it does not already exist. |
|
2195 To open an existing file for reading only, use Open() with an access mode of |
|
2196 EFileRead, and a share mode of EFileShareReadersOnly. |
|
2197 |
|
2198 - use Create() to create and open a new file for writing; an error is returned |
|
2199 if it already exists. |
|
2200 |
|
2201 - use Replace() to open a file for writing, replacing any existing file of |
|
2202 the same name if one exists, or creating a new file if one does not exist. |
|
2203 Note that if a file exists, its length is reset to zero. |
|
2204 |
|
2205 - use Temp() to create and open a temporary file with a unique name, |
|
2206 for writing and reading. |
|
2207 |
|
2208 When opening a file, you must specify the file server session to use for |
|
2209 operations with that file. If you do not close the file explicitly, it is |
|
2210 closed when the server session associated with it is closed. |
|
2211 |
|
2212 Reading and Writing: |
|
2213 |
|
2214 There are several variants of both Read() and Write(). |
|
2215 The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented |
|
2216 by variants allowing the descriptor length to be overridden, or the seek |
|
2217 position of the first byte to be specified, or asynchronous completion, |
|
2218 or any combination. |
|
2219 |
|
2220 Reading transfers data from a file to a descriptor, and writing transfers |
|
2221 data from a descriptor to a file. In all cases, the file data is treated |
|
2222 as binary and byte descriptors are used (TDes8, TDesC8). |
|
2223 |
|
2224 @see TDes8 |
|
2225 @see TDesC8 |
|
2226 */ |
|
2227 #else |
|
2228 /** |
|
2229 @publishedAll |
|
2230 @released |
|
2231 |
|
2232 Creates and opens a file, and performs all operations on a single open file. |
|
2233 |
|
2234 These include: |
|
2235 |
|
2236 - reading from and writing to the file |
|
2237 |
|
2238 - seeking to a position within the file |
|
2239 |
|
2240 - locking and unlocking within the file |
|
2241 |
|
2242 - setting file attributes |
|
2243 |
|
2244 Before using any of these services, a connection to a file server session must |
|
2245 have been made, and the file must be open. |
|
2246 |
|
2247 Opening Files: |
|
2248 |
|
2249 - use Open() to open an existing file for reading or writing; an error is |
|
2250 returned if it does not already exist. |
|
2251 To open an existing file for reading only, use Open() with an access mode of |
|
2252 EFileRead, and a share mode of EFileShareReadersOnly. |
|
2253 |
|
2254 - use Create() to create and open a new file for writing; an error is returned |
|
2255 if it already exists. |
|
2256 |
|
2257 - use Replace() to open a file for writing, replacing any existing file of |
|
2258 the same name if one exists, or creating a new file if one does not exist. |
|
2259 Note that if a file exists, its length is reset to zero. |
|
2260 |
|
2261 - use Temp() to create and open a temporary file with a unique name, |
|
2262 for writing and reading. |
|
2263 |
|
2264 When opening a file, you must specify the file server session to use for |
|
2265 operations with that file. If you do not close the file explicitly, it is |
|
2266 closed when the server session associated with it is closed. |
|
2267 |
|
2268 Reading and Writing: |
|
2269 |
|
2270 There are several variants of both Read() and Write(). |
|
2271 The basic Read(TDes8& aDes) and Write(const TDesC8& aDes) are supplemented |
|
2272 by variants allowing the descriptor length to be overridden, or the seek |
|
2273 position of the first byte to be specified, or asynchronous completion, |
|
2274 or any combination. |
|
2275 |
|
2276 Reading transfers data from a file to a descriptor, and writing transfers |
|
2277 data from a descriptor to a file. In all cases, the file data is treated |
|
2278 as binary and byte descriptors are used (TDes8, TDesC8). |
|
2279 |
|
2280 RFile class supports operations on files of size less than or equal to 2GB - 1. |
|
2281 If the file size is greater than 2GB - 1 (large file), use of class RFile64 is |
|
2282 recommended for following operations: |
|
2283 1. Opening a large file |
|
2284 2. Creating a file which can grow beyond 2GB - 1 by size |
|
2285 3. Creating a temporary file which can grow beyond 2GB - 1 by size |
|
2286 4. Replacing an existing file after which it can grow beyond 2GB - 1 by size |
|
2287 5. Adopting a large file handle from client |
|
2288 6. Adopting a large file handle from server |
|
2289 7. Adopting a large file handle from another process |
|
2290 8. Read from a position greater than 2GB - 1 |
|
2291 9. Writing to a file by which the size can grow beyond 2GB - 1 |
|
2292 10. Seek to a position greater than 2GB - 1 |
|
2293 11. Setting a size greater than 2GB - 1 |
|
2294 12. Querying the file size (greater than 2GB - 1) |
|
2295 13. Locking and unlocking a position and length that is beyond 2GB - 1 |
|
2296 |
|
2297 @see TDes8 |
|
2298 @see TDesC8 |
|
2299 |
|
2300 @see RFile64 |
|
2301 |
|
2302 */ |
|
2303 |
|
2304 #endif |
|
2305 |
|
2306 |
|
2307 class RFile : public RSubSessionBase |
|
2308 { |
|
2309 public: |
|
2310 EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
2311 EFSRV_IMPORT_C void Close(); |
|
2312 EFSRV_IMPORT_C TInt Create(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
2313 EFSRV_IMPORT_C TInt Replace(RFs& aFs,const TDesC& aName,TUint aFileMode); |
|
2314 EFSRV_IMPORT_C TInt Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode); |
|
2315 EFSRV_IMPORT_C TInt Read(TDes8& aDes) const; |
|
2316 EFSRV_IMPORT_C void Read(TDes8& aDes,TRequestStatus& aStatus) const; |
|
2317 EFSRV_IMPORT_C TInt Read(TDes8& aDes,TInt aLength) const; |
|
2318 EFSRV_IMPORT_C void Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
2319 EFSRV_IMPORT_C TInt Read(TInt aPos,TDes8& aDes) const; |
|
2320 EFSRV_IMPORT_C void Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const; |
|
2321 EFSRV_IMPORT_C TInt Read(TInt aPos,TDes8& aDes,TInt aLength) const; |
|
2322 EFSRV_IMPORT_C void Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const; |
|
2323 EFSRV_IMPORT_C void ReadCancel(TRequestStatus& aStatus) const; |
|
2324 EFSRV_IMPORT_C void ReadCancel() const; |
|
2325 EFSRV_IMPORT_C TInt Write(const TDesC8& aDes); |
|
2326 EFSRV_IMPORT_C void Write(const TDesC8& aDes,TRequestStatus& aStatus); |
|
2327 EFSRV_IMPORT_C TInt Write(const TDesC8& aDes,TInt aLength); |
|
2328 EFSRV_IMPORT_C void Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
2329 EFSRV_IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes); |
|
2330 EFSRV_IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus); |
|
2331 EFSRV_IMPORT_C TInt Write(TInt aPos,const TDesC8& aDes,TInt aLength); |
|
2332 EFSRV_IMPORT_C void Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus); |
|
2333 EFSRV_IMPORT_C TInt Lock(TInt aPos,TInt aLength) const; |
|
2334 EFSRV_IMPORT_C TInt UnLock(TInt aPos,TInt aLength) const; |
|
2335 EFSRV_IMPORT_C TInt Seek(TSeek aMode,TInt& aPos) const; |
|
2336 EFSRV_IMPORT_C TInt Flush(); |
|
2337 EFSRV_IMPORT_C void Flush(TRequestStatus& aStatus); |
|
2338 EFSRV_IMPORT_C TInt Size(TInt& aSize) const; |
|
2339 EFSRV_IMPORT_C TInt SetSize(TInt aSize); |
|
2340 EFSRV_IMPORT_C TInt Att(TUint& aAttValue) const; |
|
2341 EFSRV_IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask); |
|
2342 EFSRV_IMPORT_C TInt Modified(TTime& aTime) const; |
|
2343 EFSRV_IMPORT_C TInt SetModified(const TTime& aTime); |
|
2344 EFSRV_IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); |
|
2345 EFSRV_IMPORT_C TInt ChangeMode(TFileMode aNewMode); |
|
2346 EFSRV_IMPORT_C TInt Rename(const TDesC& aNewName); |
|
2347 EFSRV_IMPORT_C TInt Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const; |
|
2348 EFSRV_IMPORT_C TInt Adopt(RFs& aFs, TInt aHandle); |
|
2349 EFSRV_IMPORT_C TInt AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex); |
|
2350 EFSRV_IMPORT_C TInt AdoptFromServer(TInt aFsHandle, TInt aFileHandle); |
|
2351 EFSRV_IMPORT_C TInt AdoptFromCreator(TInt aFsIndex, TInt aFileHandleIndex); |
|
2352 EFSRV_IMPORT_C TInt Name(TDes& aName) const; |
|
2353 EFSRV_IMPORT_C TInt TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const; |
|
2354 EFSRV_IMPORT_C TInt TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const; |
|
2355 EFSRV_IMPORT_C TInt TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const; |
|
2356 EFSRV_IMPORT_C TInt Duplicate(const RFile& aFile, TOwnerType aType=EOwnerProcess); |
|
2357 EFSRV_IMPORT_C TInt FullName(TDes& aName) const; |
|
2358 EFSRV_IMPORT_C TInt BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos=-1, TInt aBlockMapusage=EBlockMapUsagePaging) const; |
|
2359 TInt Clamp(RFileClamp& aHandle); |
|
2360 |
|
2361 protected: |
|
2362 // RSubSessionBase overrides |
|
2363 TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
2364 void CloseSubSession(TInt aFunction); |
|
2365 TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
2366 |
|
2367 TInt DuplicateHandle(TInt& aSubSessionHandle) const; |
|
2368 |
|
2369 friend class RFilePlugin; |
|
2370 }; |
|
2371 |
|
2372 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2373 #include <f32file64.h> |
|
2374 #endif |
|
2375 |
|
2376 class RDir : public RSubSessionBase |
|
2377 /** |
|
2378 @publishedAll |
|
2379 @released |
|
2380 |
|
2381 Reads the entries contained in a directory. |
|
2382 |
|
2383 You must first open the directory, specifying an attribute mask which is used |
|
2384 by Read() calls to filter the entry types required. Then, use one of |
|
2385 the Read() functions to read the filtered entries. When the operation |
|
2386 is complete, the directory should be closed using Close() |
|
2387 |
|
2388 There are two types of Read(): one works with a single entry at a time, |
|
2389 requiring programs to iterate through the entries explicitly. |
|
2390 The other works with an entire TEntryArray, allowing multiple entries to be |
|
2391 read in one call. |
|
2392 As well as making application program logic somewhat simpler, this type |
|
2393 uses fewer calls to the server, and is more efficient. |
|
2394 |
|
2395 Each type of Read() can be performed either synchronously or asynchronously. |
|
2396 |
|
2397 It may be more convenient to use RFs::GetDir() than the Read() calls supported |
|
2398 by this class. |
|
2399 RFs::GetDir() has the advantage that it allows a directory’s entries to be |
|
2400 sorted in various ways. |
|
2401 However, it does not provide asynchronous as well as synchronous variants |
|
2402 and does not allow entries to be read individually. |
|
2403 |
|
2404 @see RFs |
|
2405 */ |
|
2406 { |
|
2407 public: |
|
2408 EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,const TUidType& aUidType); |
|
2409 EFSRV_IMPORT_C TInt Open(RFs& aFs,const TDesC& aMatchName,TUint anAttMask); |
|
2410 EFSRV_IMPORT_C void Close(); |
|
2411 EFSRV_IMPORT_C TInt Read(TEntryArray& anArray) const; |
|
2412 EFSRV_IMPORT_C void Read(TEntryArray& anArray,TRequestStatus& aStatus) const; |
|
2413 EFSRV_IMPORT_C TInt Read(TEntry& anEntry) const; |
|
2414 EFSRV_IMPORT_C void Read(TPckg<TEntry>& anEntry,TRequestStatus& aStatus) const; |
|
2415 |
|
2416 private: |
|
2417 // RSubSessionBase overrides |
|
2418 TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
2419 |
|
2420 friend class RDirPlugin; |
|
2421 }; |
|
2422 |
|
2423 |
|
2424 class RFormat : public RSubSessionBase |
|
2425 /** |
|
2426 @publishedAll |
|
2427 @released |
|
2428 |
|
2429 Formats a device, one step at a time. |
|
2430 |
|
2431 RFormat must first be opened on a device before formatting each |
|
2432 track using Next(). |
|
2433 |
|
2434 There is also an asynchronous version of Next() which, if encapsulated into |
|
2435 a suitable active object, can be used to implement a |
|
2436 user-interruptible formatting process. |
|
2437 */ |
|
2438 { |
|
2439 public: |
|
2440 IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount); |
|
2441 IMPORT_C TInt Open(RFs& aFs,const TDesC& aName,TUint aFormatMode,TInt& aCount,const TDesC8& anInfo); |
|
2442 IMPORT_C void Close(); |
|
2443 IMPORT_C TInt Next(TInt& aStep); |
|
2444 IMPORT_C void Next(TPckgBuf<TInt>& aStep,TRequestStatus& aStatus); |
|
2445 }; |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 class RRawDisk : public RSubSessionBase |
|
2451 /** |
|
2452 @publishedAll |
|
2453 @released |
|
2454 |
|
2455 Enables direct disk access. |
|
2456 |
|
2457 No other resources can access the disk while direct access to it is in effect. |
|
2458 |
|
2459 This class is not intended for user derivation. |
|
2460 */ |
|
2461 { |
|
2462 public: |
|
2463 IMPORT_C TInt Open(RFs& aFs,TInt aDrive); |
|
2464 IMPORT_C void Close(); |
|
2465 IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes); |
|
2466 IMPORT_C TInt Write(TInt64 aPos,TDesC8& aDes); |
|
2467 private: |
|
2468 TInt iDrive; |
|
2469 }; |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 class CDirStack; |
|
2475 NONSHARABLE_CLASS(CDirScan) : public CBase |
|
2476 /** |
|
2477 @publishedAll |
|
2478 @released |
|
2479 |
|
2480 Scans a directory structure. |
|
2481 |
|
2482 The scan moves from directory to directory through the hierarchy, returning |
|
2483 a list of the entries contained in each. The order in which the directories |
|
2484 are scanned is determined by a sort key which is specified when setting up |
|
2485 the scan. The base directory to be scanned and the entry types of interest |
|
2486 must also be specified before performing the scan. |
|
2487 |
|
2488 This class is not intended for user derivation |
|
2489 */ |
|
2490 { |
|
2491 public: |
|
2492 /** |
|
2493 Defines the scan direction. |
|
2494 */ |
|
2495 enum TScanDirection |
|
2496 { |
|
2497 /** |
|
2498 Scan upwards from the lowest level directory in the hierarchy to |
|
2499 the top level directory. |
|
2500 */ |
|
2501 EScanUpTree, |
|
2502 |
|
2503 /** |
|
2504 Scan downwards from the top level directory in the hierarchy to |
|
2505 the bottom level directory. |
|
2506 */ |
|
2507 EScanDownTree |
|
2508 }; |
|
2509 public: |
|
2510 IMPORT_C static CDirScan* NewL(RFs& aFs); |
|
2511 IMPORT_C static CDirScan* NewLC(RFs& aFs); |
|
2512 IMPORT_C ~CDirScan(); |
|
2513 IMPORT_C void SetScanDataL(const TDesC& aMatchName,TUint anEntryAttMask,TUint anEntrySortMask,TScanDirection aScanDir=EScanDownTree); |
|
2514 IMPORT_C void NextL(CDir*& aDirEntries); |
|
2515 IMPORT_C TPtrC AbbreviatedPath(); |
|
2516 IMPORT_C TPtrC FullPath(); |
|
2517 protected: |
|
2518 CDirScan(RFs& aFs); |
|
2519 private: |
|
2520 inline RFs& Fs(); |
|
2521 void UpdateAbbreviatedPath(); |
|
2522 void ScanUpTreeL(CDir*& aDirEntries); |
|
2523 void ScanDownTreeL(CDir*& aDirEntries); |
|
2524 void GetDirEntriesL(CDir*& aDirEntries); |
|
2525 private: |
|
2526 RFs* const iFs; |
|
2527 TParse iFullPath; |
|
2528 TPtrC iAbbreviatedPath; |
|
2529 TInt iAbbreviatedPathPos; |
|
2530 TUint iEntryAttMask; |
|
2531 TUint iEntrySortMask; |
|
2532 TBool iScanning; |
|
2533 TScanDirection iScanDir; |
|
2534 CDirStack* iStack; |
|
2535 }; |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 enum TFileManError |
|
2541 /** |
|
2542 @publishedAll |
|
2543 @released |
|
2544 |
|
2545 A list of CFileMan error codes. |
|
2546 |
|
2547 @see CFileMan |
|
2548 */ |
|
2549 { |
|
2550 /** |
|
2551 No additional error information is available, either because |
|
2552 the latest CFileMan operation did not return an error, or if it did, |
|
2553 the error was not one for which additional information is available. |
|
2554 */ |
|
2555 ENoExtraInformation, |
|
2556 |
|
2557 |
|
2558 /** |
|
2559 A leave occurred while setting up the initial scan. |
|
2560 |
|
2561 This indicates that the operation did not begin. |
|
2562 |
|
2563 @see CDirScan. |
|
2564 */ |
|
2565 EInitializationFailed, |
|
2566 |
|
2567 |
|
2568 /** |
|
2569 A leave occurred while scanning the next directory in the course of a file |
|
2570 management function. |
|
2571 |
|
2572 This indicates that the operation did begin. |
|
2573 |
|
2574 @see CDirScan. |
|
2575 */ |
|
2576 EScanNextDirectoryFailed, |
|
2577 |
|
2578 |
|
2579 /** |
|
2580 Error occurred when attempting to open the source file for a file copy |
|
2581 or move. |
|
2582 */ |
|
2583 ESrcOpenFailed, |
|
2584 |
|
2585 |
|
2586 /** |
|
2587 Error occurred while attempting to create, or, if overwriting is in effect, |
|
2588 replace the target file for a file copy or move. |
|
2589 */ |
|
2590 ETrgOpenFailed, |
|
2591 |
|
2592 |
|
2593 /** |
|
2594 The operation completed without processing any files because no matching |
|
2595 files were found. |
|
2596 */ |
|
2597 ENoFilesProcessed |
|
2598 }; |
|
2599 |
|
2600 |
|
2601 |
|
2602 |
|
2603 class MFileManObserver |
|
2604 /** |
|
2605 @publishedAll |
|
2606 @released |
|
2607 |
|
2608 Provides notification of the progress of synchronous or asynchronous |
|
2609 file management operations. |
|
2610 |
|
2611 It should be inherited by classes which implement this protocol. |
|
2612 |
|
2613 The enquiry functions provided by CFileBase and CFileMan may be used by |
|
2614 the observer to display information about the progress of the operation |
|
2615 such as error messages, the names of the target and destination files, |
|
2616 and the number of bytes transferred during a copy operation. |
|
2617 Notification may take place before or after an entry has been processed, |
|
2618 or during a file copy or move. |
|
2619 Each notification function returns a value which can be used to enable |
|
2620 the user to control the progress of the operation, for example to cancel |
|
2621 a long-running multiple file copy. |
|
2622 To use this class, pass a pointer to an instance of the class to |
|
2623 the CFileMan constructor, or use SetObserver(), defined in CFileBase. |
|
2624 */ |
|
2625 { |
|
2626 public: |
|
2627 /** |
|
2628 Control for the current CFileMan operation. |
|
2629 */ |
|
2630 enum TControl |
|
2631 { |
|
2632 /** |
|
2633 Proceed with the current or the next entry. |
|
2634 */ |
|
2635 EContinue, |
|
2636 |
|
2637 |
|
2638 /** |
|
2639 Retry processing the previous entry. |
|
2640 */ |
|
2641 ERetry, |
|
2642 |
|
2643 |
|
2644 /** |
|
2645 Abort operation, causes function to return KErrCancel. |
|
2646 */ |
|
2647 EAbort, |
|
2648 |
|
2649 |
|
2650 /** |
|
2651 Cancel processing the current entry. |
|
2652 */ |
|
2653 ECancel |
|
2654 }; |
|
2655 public: |
|
2656 IMPORT_C virtual TControl NotifyFileManStarted(); |
|
2657 IMPORT_C virtual TControl NotifyFileManOperation(); |
|
2658 IMPORT_C virtual TControl NotifyFileManEnded(); |
|
2659 }; |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 class CFileBase : public CBase |
|
2665 /** |
|
2666 @publishedAll |
|
2667 @released |
|
2668 |
|
2669 Abstract base class for file management. |
|
2670 |
|
2671 It provides functions to set an observer for the derived class |
|
2672 CFileMan, and to get information about the entry being processed. |
|
2673 |
|
2674 @see CFileMan |
|
2675 */ |
|
2676 { |
|
2677 public: |
|
2678 IMPORT_C void SetObserver(MFileManObserver* anObserver); |
|
2679 public: |
|
2680 IMPORT_C const TEntry& CurrentEntry(); |
|
2681 IMPORT_C TPtrC AbbreviatedPath(); |
|
2682 IMPORT_C TPtrC FullPath(); |
|
2683 IMPORT_C TInt GetLastError(); |
|
2684 IMPORT_C TFileManError GetMoreInfoAboutError(); |
|
2685 protected: |
|
2686 IMPORT_C CFileBase(RFs& anFs); |
|
2687 IMPORT_C void ConstructL(); |
|
2688 IMPORT_C ~CFileBase(); |
|
2689 IMPORT_C void RunL(); |
|
2690 IMPORT_C void RunInSeparateThreadL(TThreadFunction aThreadFunction); |
|
2691 // virtual |
|
2692 /** |
|
2693 Called from RunL to perform tidy up after an operation. |
|
2694 |
|
2695 @see CFileMan |
|
2696 @see CFileBase::RunL |
|
2697 */ |
|
2698 virtual void CompleteOperationL() {}; |
|
2699 |
|
2700 //pure virtual |
|
2701 /** |
|
2702 Called from RunL to perform the requested operation. |
|
2703 |
|
2704 @see CFileMan |
|
2705 @see CFileBase::RunL |
|
2706 */ |
|
2707 virtual void DoOperationL() = 0; |
|
2708 protected: |
|
2709 RFs iFs; |
|
2710 RFs iFsOld; |
|
2711 RThread iFManThread; |
|
2712 RSemaphore iSynchronizer; |
|
2713 CDirScan* iScanner; |
|
2714 CDir* iDirList; |
|
2715 TInt iCurrentEntry; |
|
2716 TUint iMatchEntry; |
|
2717 TUint iSwitches; |
|
2718 TParse iSrcFile; |
|
2719 MFileManObserver* iObserver; |
|
2720 TInt iLastError; |
|
2721 TFileManError iErrorInfo; |
|
2722 TRequestStatus* iStatus; |
|
2723 HBufC* iSessionPath; |
|
2724 TInt iNumberOfFilesProcessed; |
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 friend void DoFManBaseOperationL(TAny* aPtr); |
|
2730 friend TInt FManBaseThreadFunction(TAny* aPtr); |
|
2731 }; |
|
2732 |
|
2733 |
|
2734 |
|
2735 |
|
2736 NONSHARABLE_CLASS(CFileMan) : public CFileBase |
|
2737 /** |
|
2738 @publishedAll |
|
2739 @released |
|
2740 |
|
2741 Offers file management services which accept the use of wildcards; |
|
2742 synchronous and asynchronous. |
|
2743 |
|
2744 It also provides enquiry functions, which, like those provided by |
|
2745 the base class CFileBase, may be used by an observer class object |
|
2746 to provide the user with information about the progress of the operation. |
|
2747 |
|
2748 All of the file management functions provided by this class accept the use of |
|
2749 wildcards, and may operate either synchronously or asynchronously. |
|
2750 When CFileMan is operating asynchronously, the operation takes place in |
|
2751 a separate thread from the calling code. |
|
2752 |
|
2753 A file notification observer (an instance of a class deriving |
|
2754 from MFileManObserver) may optionally be used by CFileMan when operating |
|
2755 synchronously or asynchronously. If provided, the appropriate notification |
|
2756 function is called before or after each entry has been processed, |
|
2757 or during a file copy or move. |
|
2758 This notification can be used to provide information about the state of |
|
2759 the operation, such as the number of bytes transferred during a |
|
2760 large-scale file copy. It can also be used to allow the user to cancel, |
|
2761 retry or continue processing an entry, or to abort the whole operation. |
|
2762 If such notification is required, specify an object deriving from |
|
2763 MFileManObserver class in the constructor, or call SetObserver(), |
|
2764 defined in the base class, CFileBase. |
|
2765 |
|
2766 All of the file manipulation functions except Rename() may operate recursively, |
|
2767 and all can operate non-recursively. When operating recursively, |
|
2768 these functions will act on all matching files located throughout |
|
2769 the source directory’s hierarchy. When operating non-recursively, |
|
2770 these functions act upon files contained in the single top level source |
|
2771 directory only. Recursion is set or unset using the switch parameter to |
|
2772 these functions. |
|
2773 |
|
2774 This class is not intended for user derivation. |
|
2775 |
|
2776 Note: |
|
2777 |
|
2778 To support wildcard, CFileMan needs to store the entire directory entry |
|
2779 information. Therefore, in a extreme condition, if a directory contains |
|
2780 a huge number of files (e.g. more than 15000 files with 10 characters' long file |
|
2781 names), user may encounter KErrNoMemory errors. Developers who have a need to handle |
|
2782 this rare case should increase the heap size limitation of their applications. |
|
2783 |
|
2784 For more information about heap size configuration, please refer following |
|
2785 section in Symbian Developer Library: |
|
2786 Symbian OS build guide >> Build Tools Reference >> MMP file syntax >> epocheapsize |
|
2787 |
|
2788 @see MFileManObserver |
|
2789 */ |
|
2790 { |
|
2791 public: |
|
2792 /** |
|
2793 An enumeration that identifies CFileMan tasks. This enumeration is used |
|
2794 by CurrentAction() to identify which task currently being carried out. |
|
2795 |
|
2796 @see CFileMan::CurrentAction |
|
2797 */ |
|
2798 enum TAction |
|
2799 { |
|
2800 /** |
|
2801 Inactive |
|
2802 */ |
|
2803 ENone, |
|
2804 |
|
2805 |
|
2806 /** |
|
2807 Setting attributes |
|
2808 */ |
|
2809 EAttribs, |
|
2810 |
|
2811 |
|
2812 /** |
|
2813 Copying files |
|
2814 */ |
|
2815 ECopy, |
|
2816 |
|
2817 |
|
2818 /** |
|
2819 Deleting files |
|
2820 */ |
|
2821 EDelete, |
|
2822 |
|
2823 |
|
2824 /** |
|
2825 Moving files |
|
2826 */ |
|
2827 EMove, |
|
2828 |
|
2829 |
|
2830 /** |
|
2831 Renaming files |
|
2832 */ |
|
2833 ERename, |
|
2834 |
|
2835 |
|
2836 /** |
|
2837 Deleting a directory and all contents |
|
2838 */ |
|
2839 ERmDir, |
|
2840 |
|
2841 |
|
2842 /** |
|
2843 Renaming component to VFAT short name (guaranteed to be unique) |
|
2844 */ |
|
2845 ERenameInvalidEntry, |
|
2846 |
|
2847 /** |
|
2848 Copying file from open file handle |
|
2849 */ |
|
2850 ECopyFromHandle, |
|
2851 }; |
|
2852 |
|
2853 |
|
2854 /** |
|
2855 Overwriting and recursion switch. |
|
2856 |
|
2857 Used in CFileMan functions to set whether operations are applied to |
|
2858 the specified directory and all directories below it, or |
|
2859 the specified directory only. |
|
2860 */ |
|
2861 enum TSwitch |
|
2862 { |
|
2863 /** |
|
2864 Any files in the destination directory that have the same name as |
|
2865 the source files in a rename, move or copy operation, will |
|
2866 be overwritten. |
|
2867 */ |
|
2868 EOverWrite=1, |
|
2869 |
|
2870 |
|
2871 /** |
|
2872 Recursive operation. |
|
2873 */ |
|
2874 ERecurse=2 |
|
2875 }; |
|
2876 public: |
|
2877 IMPORT_C static CFileMan* NewL(RFs& aFs); |
|
2878 IMPORT_C static CFileMan* NewL(RFs& aFs,MFileManObserver* anObserver); |
|
2879 ~CFileMan(); |
|
2880 IMPORT_C TAction CurrentAction(); |
|
2881 IMPORT_C void GetCurrentTarget(TFileName& aFile); |
|
2882 IMPORT_C void GetCurrentSource(TFileName& aFile); |
|
2883 IMPORT_C TInt BytesTransferredByCopyStep(); |
|
2884 public: |
|
2885 IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch=0); |
|
2886 IMPORT_C TInt Attribs(const TDesC& aName,TUint aSetMask,TUint aClearMask,const TTime& aTime,TUint aSwitch,TRequestStatus& aStatus); |
|
2887 IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2888 IMPORT_C TInt Copy(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); |
|
2889 IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch=0); |
|
2890 IMPORT_C TInt Delete(const TDesC& aName,TUint aSwitch,TRequestStatus& aStatus); |
|
2891 IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2892 IMPORT_C TInt Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); |
|
2893 IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2894 IMPORT_C TInt Rename(const TDesC& anOld,const TDesC& aNew,TUint aSwitch,TRequestStatus& aStatus); |
|
2895 IMPORT_C TInt RmDir(const TDesC& aDirName); |
|
2896 IMPORT_C TInt RmDir(const TDesC& aDirName,TRequestStatus& aStatus); |
|
2897 IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches=EOverWrite); |
|
2898 IMPORT_C TInt Copy(const RFile& anOld,const TDesC& aNew,TUint aSwitches,TRequestStatus& aStatus); |
|
2899 protected: |
|
2900 CFileMan(RFs& aFs); |
|
2901 TInt RenameInvalidEntry(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
2902 private: |
|
2903 /** |
|
2904 This is an internal enumeration for CFileMan implementation. |
|
2905 THis enumeration is mapped into TAction when user wants to identify the current |
|
2906 task of CFileMan by CurrentAction(). |
|
2907 |
|
2908 @see CFileMan::TAction |
|
2909 @see CFileMan::CurrentAction |
|
2910 */ |
|
2911 enum TInternalAction |
|
2912 { |
|
2913 /** |
|
2914 Internal indicator for None operation. |
|
2915 This is mapped to CFileMan::ENone. |
|
2916 */ |
|
2917 EInternalNone, |
|
2918 |
|
2919 /** |
|
2920 Internal indicator for Attribs() operation. |
|
2921 This is mapped to CFileMan::EAttribs. |
|
2922 */ |
|
2923 EInternalAttribs, |
|
2924 |
|
2925 /** |
|
2926 Internal indicator for Copy() operation. |
|
2927 This is mapped to CFileMan::ECopy. |
|
2928 */ |
|
2929 EInternalCopy, |
|
2930 |
|
2931 /** |
|
2932 Internal indicator for Delete() operation. |
|
2933 This is mapped to CFileMan::EDelete. |
|
2934 */ |
|
2935 EInternalDelete, |
|
2936 |
|
2937 /** |
|
2938 Internal indicator for Move() operation on different drives. |
|
2939 This is mapped to CFileMan::Move. |
|
2940 */ |
|
2941 EInternalCopyForMove, |
|
2942 |
|
2943 /** |
|
2944 Internal indicator for Move() operation on the same drive. |
|
2945 This is mapped to CFileMan::Rename. |
|
2946 Note for compatibility reasons, it is not mapped to CFileMan::Move. |
|
2947 */ |
|
2948 EInternalRenameForMove, |
|
2949 |
|
2950 /** |
|
2951 Internal indicator for Rename() operation. |
|
2952 This is mapped to CFileMan::ERename. |
|
2953 */ |
|
2954 EInternalRename, |
|
2955 |
|
2956 /** |
|
2957 Internal indicator for RmDir() operation. |
|
2958 This is mapped to CFileMan::ERmDir. |
|
2959 */ |
|
2960 EInternalRmDir, |
|
2961 |
|
2962 /** |
|
2963 Internal indicator for RenameInvalidEntry() operation. |
|
2964 This is mapped to CFileMan::ERenameInvalidEntry. |
|
2965 */ |
|
2966 EInternalRenameInvalidEntry, |
|
2967 |
|
2968 /** |
|
2969 Internal indicator for CopyFromHandle() operation. |
|
2970 This is mapped to CFileMan::ECopyFromHandle. |
|
2971 */ |
|
2972 EInternalCopyFromHandle, |
|
2973 }; |
|
2974 |
|
2975 void CompleteOperationL(); |
|
2976 void DoOperationL(); |
|
2977 void CheckForDirectory(); |
|
2978 void SetFlags(TBool aOverWrite,TBool aRecurse,TBool aScanDirection,TBool aMoveRename); |
|
2979 void GetSrcAndTrg(TParse& aSrcName,TFileName& aTrgName); |
|
2980 void DoSynchronize(TInt aRetVal); |
|
2981 TInt CheckRenameAllowed(const TDesC& aSrcName,const TDesC& aTrgName); |
|
2982 TInt SetupMoveOnSameDrive(TUint aSwitches, TBool& aComplete); |
|
2983 TInt SetupMoveAcrossDrives(TUint aSwitches); |
|
2984 TInt SetupTargetDirectory(TBool aOverWrite, TBool& aComplete); |
|
2985 TBool SrcTrgDrivesIdentical(); |
|
2986 TInt SetupDirectoryForMove(TBool& aSrcIsDir); |
|
2987 private: |
|
2988 void DoAttribsL(); |
|
2989 void DoCopyOrMoveL(); |
|
2990 void DoDeleteL(); |
|
2991 void DoRenameL(); |
|
2992 void DoRmDirL(); |
|
2993 void DoCopyFromHandleL(); |
|
2994 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2995 TInt DoCopy(const RFile& aSrcFile, RFile& aDstFile, TInt& aRet); |
|
2996 #else |
|
2997 TInt DoCopy(const RFile64& aSrcFile, RFile64& aDstFile, TInt& aRet); |
|
2998 #endif |
|
2999 private: |
|
3000 TParse iTrgFile; |
|
3001 TInternalAction iAction; |
|
3002 TUint iSetMask; |
|
3003 TUint iClearMask; |
|
3004 TTime iTime; |
|
3005 TInt iBytesTransferred; |
|
3006 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3007 RFile iSrcFileHandle; |
|
3008 #else |
|
3009 RFile64 iSrcFileHandle; |
|
3010 #endif |
|
3011 TBool iMovingContents; |
|
3012 TEntry iTmpEntry; |
|
3013 TParse iTmpParse; |
|
3014 TFileName iTmpName1; |
|
3015 TFileName iTmpName2; |
|
3016 |
|
3017 friend void RenameInvalidEntryL(RFs& aFs,TParse& aSrcFile); |
|
3018 }; |
|
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 class TFindFile |
|
3024 /** |
|
3025 @publishedAll |
|
3026 @released |
|
3027 |
|
3028 Searches for files and directories. |
|
3029 |
|
3030 Each function has a variant which searches for multiple files/directories, |
|
3031 using one or more wildcard characters in the filename. |
|
3032 If an initial search is successful, further searches can be carried out |
|
3033 using Find() or FindWild(). |
|
3034 You can also retrieve the fully qualified file specification, |
|
3035 and manipulate and interrogate it using the TParse class (or related classes). |
|
3036 |
|
3037 Note that when specifying the path of a directory to search, the path should |
|
3038 always end with a backslash character.When trailing backslash is not present |
|
3039 then it is considered as file. And path will be taken till last backslash. |
|
3040 The client must have appropriate capabilities for the directory to be searched. |
|
3041 For example without ALL FILES Capability, it is not possible to successfully |
|
3042 find any files under \sys\bin directory. |
|
3043 |
|
3044 By default if the file is not found in the current drive the rest of the drives, |
|
3045 excluding the remote ones, will be searched. Using function SetFindMask it is |
|
3046 possible to specify a combination of drive attributes(aMask) that the drives to |
|
3047 be searched must match. |
|
3048 |
|
3049 */ |
|
3050 { |
|
3051 public: |
|
3052 IMPORT_C TFindFile(RFs& aFs); |
|
3053 IMPORT_C TInt FindByPath(const TDesC& aFileName,const TDesC* aPathList); |
|
3054 IMPORT_C TInt FindByDir(const TDesC& aFileName,const TDesC& aDirPath); |
|
3055 IMPORT_C TInt Find(); |
|
3056 IMPORT_C TInt FindWildByPath(const TDesC& aFileName,const TDesC* aPathList,CDir*& aDirList); |
|
3057 IMPORT_C TInt FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir); |
|
3058 IMPORT_C TInt FindWild(CDir*& aDirList); |
|
3059 IMPORT_C TInt SetFindMask(TUint aMask); |
|
3060 inline const TDesC& File() const; |
|
3061 private: |
|
3062 TInt DoFind(); |
|
3063 TInt DoFindByPath(const TDesC& aFileName,const TDesC* aPathList); |
|
3064 TInt DoFindByDir(const TDesC& aFileName,const TDesC& aDir); |
|
3065 TInt DoFindInDir(); |
|
3066 TInt DoFindNextInPath(); |
|
3067 TInt DoFindNextInDriveList(); |
|
3068 private: |
|
3069 RFs* const iFs; |
|
3070 TParse iFile; |
|
3071 TInt iPathPos; |
|
3072 TInt iCurrentDrive; |
|
3073 TInt iMode; |
|
3074 const TDesC* iPath; |
|
3075 TDriveList iDrvList; |
|
3076 CDir** iDir; |
|
3077 TUint32 iMatchMask; |
|
3078 }; |
|
3079 |
|
3080 |
|
3081 |
|
3082 |
|
3083 /** |
|
3084 @publishedAll |
|
3085 @released |
|
3086 |
|
3087 Contains a list of entries for the files which were opened in |
|
3088 a file server session. |
|
3089 |
|
3090 @see CDir |
|
3091 */ |
|
3092 typedef CDir CFileList; |
|
3093 |
|
3094 |
|
3095 |
|
3096 |
|
3097 class TOpenFileScan |
|
3098 /** |
|
3099 @publishedAll |
|
3100 @released |
|
3101 |
|
3102 Scans open files to get a list of the entries for all files which are currently |
|
3103 open in a particular file server session. |
|
3104 |
|
3105 NextL() creates a list of the files opened by the session. |
|
3106 The ID of the thread which opened the files listed may be obtained by calling ThreadId(). |
|
3107 If multiple sessions are in use, repeatedly calling NextL() will return a list |
|
3108 of open files in each session. |
|
3109 */ |
|
3110 { |
|
3111 public: |
|
3112 IMPORT_C TOpenFileScan(RFs& aFs); |
|
3113 IMPORT_C void NextL(CFileList*& aFileList); |
|
3114 IMPORT_C TThreadId ThreadId() const; |
|
3115 private: |
|
3116 RFs* iFs; |
|
3117 TThreadId iThreadId; |
|
3118 TInt iScanPos; |
|
3119 TInt iEntryListPos; |
|
3120 }; |
|
3121 |
|
3122 |
|
3123 |
|
3124 |
|
3125 class TFileText |
|
3126 /** |
|
3127 @publishedAll |
|
3128 @released |
|
3129 |
|
3130 Reads and writes single lines of text to or from a Unicode file. |
|
3131 */ |
|
3132 { |
|
3133 private: |
|
3134 enum TFileState |
|
3135 { |
|
3136 EStartOfFile, |
|
3137 ENormal, |
|
3138 EReverse |
|
3139 }; |
|
3140 public: |
|
3141 IMPORT_C TFileText(); |
|
3142 IMPORT_C void Set(RFile& aFile); |
|
3143 IMPORT_C TInt Read(TDes& aDes); |
|
3144 IMPORT_C TInt Write(const TDesC& aDes); |
|
3145 IMPORT_C TInt Seek(TSeek aMode); |
|
3146 private: |
|
3147 void NextRecord(); |
|
3148 TInt CheckForTerminator(TBool& anAnswer); |
|
3149 TInt FillBuffer(); |
|
3150 private: |
|
3151 const TText* iNext; |
|
3152 const TText* iEnd; |
|
3153 TFileState iState; |
|
3154 #ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3155 RFile iFile; |
|
3156 #else |
|
3157 RFile64 iFile; |
|
3158 #endif |
|
3159 TBuf8<0x100> iReadBuf; |
|
3160 }; |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 /** |
|
3166 @publishedAll |
|
3167 @released |
|
3168 */ |
|
3169 IMPORT_C TBool FileNamesIdentical(const TDesC& aFileName1,const TDesC& aFileName2); |
|
3170 |
|
3171 /** |
|
3172 @publishedAll |
|
3173 @released |
|
3174 |
|
3175 The UID of the File Server process |
|
3176 */ |
|
3177 const TInt KFileServerUidValue = 0x100039e3; |
|
3178 |
|
3179 |
|
3180 #include <f32file.inl> |
|
3181 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
3182 #include <f32file64.inl> |
|
3183 #endif |
|
3184 |
|
3185 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
3186 #include <f32notification.h> |
|
3187 #endif |
|
3188 |
|
3189 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
3190 #include <f32file_private.h> |
|
3191 #endif |
|
3192 |
|
3193 #endif |