|
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 // f32\inc\f32fsys.inl |
|
15 // |
|
16 // WARNING: This file contains some APIs which are internal and are subject |
|
17 // to change without noticed. Such APIs should therefore not be used |
|
18 // outside the Kernel and Hardware Services package. |
|
19 // |
|
20 |
|
21 #define __IS_DRIVETHREAD() {__ASSERT_DEBUG(IsDriveThread(),DriveFault(ETrue));} |
|
22 #define __IS_MAINTHREAD() {__ASSERT_DEBUG(IsMainThread(),DriveFault(EFalse));} |
|
23 |
|
24 |
|
25 //--------------------------------------------------------------------------------------------------------------------------------- |
|
26 // Class TDrive |
|
27 |
|
28 /** |
|
29 Gets last error reason. |
|
30 |
|
31 @return TInt Returns last error reason. |
|
32 */ |
|
33 inline TInt TDrive::GetReason() const |
|
34 { |
|
35 __IS_DRIVETHREAD(); |
|
36 return(iReason); |
|
37 } |
|
38 |
|
39 |
|
40 |
|
41 /** |
|
42 Sets a flag to state that the drive contents has changed. |
|
43 |
|
44 @param aValue True if contents has changed; False if unchanged. |
|
45 */ |
|
46 inline void TDrive::SetChanged(TBool aValue) |
|
47 { |
|
48 iChanged=aValue; |
|
49 } |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 /** |
|
55 Determines whether the drive content has changed. |
|
56 |
|
57 @return True if contents changed , False if unchanged. |
|
58 */ |
|
59 inline TBool TDrive::IsChanged() const |
|
60 { |
|
61 return(iChanged); |
|
62 } |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 /** |
|
68 Returns the drive number. |
|
69 |
|
70 @return The drive number. |
|
71 |
|
72 @see TDriveNumber |
|
73 */ |
|
74 inline TInt TDrive::DriveNumber() const |
|
75 {return(iDriveNumber);} |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 /** |
|
81 Determines whether the drive is mounted. |
|
82 |
|
83 @return True if drive is mounted, False if drive is not mounted. |
|
84 */ |
|
85 inline TBool TDrive::IsMounted() const |
|
86 { |
|
87 __IS_DRIVETHREAD(); |
|
88 return(iCurrentMount!=NULL); |
|
89 } |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 /** |
|
95 Determines whether attribute is set to local. |
|
96 |
|
97 @return True if attribute is set to KDriveAttLocal, False for all other attributes. |
|
98 */ |
|
99 inline TBool TDrive::IsLocal() const |
|
100 {return(iAtt & KDriveAttLocal);} |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 /** |
|
106 Determines whether the drive is ROM drive. |
|
107 |
|
108 @return True if drive attribute is set as ROM drive , False if not set as ROM drive. |
|
109 */ |
|
110 inline TBool TDrive::IsRom() const |
|
111 {return( iAtt & KDriveAttRom);} |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 /** |
|
117 Determines whether the drive is removable. |
|
118 |
|
119 @return True if drive attribute is set to removable , False for all other attributes. |
|
120 */ |
|
121 inline TBool TDrive::IsRemovable() const |
|
122 {return( iAtt & KDriveAttRemovable);} |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 /** |
|
128 Determines whether the drive is substed. |
|
129 |
|
130 @return True if drive attribute is set to substed (KDriveAttSubsted), False for all other attributes. |
|
131 */ |
|
132 inline TBool TDrive::IsSubsted() const |
|
133 {return( iAtt & KDriveAttSubsted);}// KDriveAttSubsted = 0x08 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 /** |
|
139 Gets a reference to the object representing the current mount. |
|
140 |
|
141 @return The file's mount. |
|
142 */ |
|
143 inline CMountCB& TDrive::CurrentMount() const |
|
144 { |
|
145 __IS_DRIVETHREAD(); |
|
146 return(*iCurrentMount); |
|
147 } |
|
148 |
|
149 inline TBool TDrive::IsCurrentMount(CMountCB& aMount) const |
|
150 {return(iCurrentMount == &aMount);} |
|
151 |
|
152 |
|
153 |
|
154 /** |
|
155 Gets the substed drive. |
|
156 |
|
157 @return A pointer to the drive which is substed. |
|
158 */ |
|
159 inline TDrive& TDrive::SubstedDrive()const |
|
160 { |
|
161 __IS_MAINTHREAD(); |
|
162 return(*iSubstedDrive); |
|
163 } |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 /** |
|
169 |
|
170 Sets the drive as substed to the path set by an earlier call to SetSubst(). |
|
171 |
|
172 @param aDrive A pointer to the drive on which the volume is mounted. |
|
173 |
|
174 */ |
|
175 inline void TDrive::SetSubstedDrive(TDrive* aDrive) |
|
176 { |
|
177 __IS_MAINTHREAD(); |
|
178 iSubstedDrive=aDrive; |
|
179 } |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 /** |
|
185 Gets the substed path set by an earlier call to SetSubst(). |
|
186 |
|
187 @return A reference to a heap descriptor containing the substed path. |
|
188 */ |
|
189 inline HBufC& TDrive::Subst() const |
|
190 { |
|
191 __IS_MAINTHREAD(); |
|
192 return(*iSubst); |
|
193 } |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 /** |
|
199 Assigns a path to a drive. |
|
200 |
|
201 @param aSubst Path will be assigned to a drive. |
|
202 |
|
203 */ |
|
204 inline void TDrive::SetSubst(HBufC* aSubst) |
|
205 { |
|
206 __IS_MAINTHREAD(); |
|
207 iSubst=aSubst; |
|
208 } |
|
209 |
|
210 |
|
211 |
|
212 /** |
|
213 |
|
214 Gets a reference to the object representing the mount on which the file resides. |
|
215 |
|
216 @return The Drives's mount. |
|
217 |
|
218 */ |
|
219 inline CFsObjectCon& TDrive::Mount() const |
|
220 {return(*iMount);} |
|
221 /** |
|
222 |
|
223 Gets a reference to the object representing the file system |
|
224 |
|
225 @return The reference to file system. |
|
226 |
|
227 */ |
|
228 inline CFileSystem& TDrive::FSys() |
|
229 {return(*iFSys);} |
|
230 /** |
|
231 |
|
232 Gets the object representing the file system |
|
233 |
|
234 @return The file system. |
|
235 |
|
236 */ |
|
237 inline CFileSystem*& TDrive::GetFSys() |
|
238 {return(iFSys);} |
|
239 /** |
|
240 |
|
241 Gets the object representing the TDriveExtInfo. |
|
242 |
|
243 @return The Drive extension information object. |
|
244 |
|
245 @see TDriveExtInfo |
|
246 |
|
247 */ |
|
248 inline TDriveExtInfo& TDrive::ExtInfo() |
|
249 { |
|
250 __IS_DRIVETHREAD(); |
|
251 return(iExtInfo); |
|
252 } |
|
253 /** |
|
254 Sets the notification flag ON. The client will receive notifications on Read or Write |
|
255 failures from the file system. |
|
256 |
|
257 */ |
|
258 inline void TDrive::SetNotifyOn() |
|
259 { |
|
260 __IS_DRIVETHREAD(); |
|
261 iDriveFlags &= ~ENotifyOff; |
|
262 } |
|
263 /** |
|
264 Sets the notification flag OFF. The client will not receive notifications on Read or Write |
|
265 failures from the file system. |
|
266 |
|
267 */ |
|
268 inline void TDrive::SetNotifyOff() |
|
269 { |
|
270 __IS_DRIVETHREAD(); |
|
271 iDriveFlags |= ENotifyOff; |
|
272 } |
|
273 /** |
|
274 |
|
275 Locks the drive.This function acquires iLock mutex. |
|
276 |
|
277 */ |
|
278 inline void TDrive::Lock() |
|
279 {iLock.Wait();} |
|
280 /** |
|
281 |
|
282 UnLocks the drive.This function signals the iLock mutex. |
|
283 |
|
284 */ |
|
285 |
|
286 inline void TDrive::UnLock() |
|
287 {iLock.Signal();} |
|
288 |
|
289 |
|
290 /** |
|
291 |
|
292 Gets the reserved space of a drive |
|
293 |
|
294 @return Amount of space reserved in bytes. |
|
295 |
|
296 */ |
|
297 |
|
298 inline TInt TDrive::ReservedSpace() const |
|
299 {return iReservedSpace;} |
|
300 |
|
301 /** |
|
302 |
|
303 Reserves a space of a drive. |
|
304 |
|
305 @param aReservedSpace Amount of space to reserve in bytes. |
|
306 |
|
307 */ |
|
308 inline void TDrive::SetReservedSpace(const TInt aReservedSpace) |
|
309 {iReservedSpace=aReservedSpace; } |
|
310 |
|
311 /** |
|
312 |
|
313 Sets the rugged flag in the drive object. |
|
314 |
|
315 @param Flag to set or clear the rugged flag. |
|
316 @see IsRugged() |
|
317 |
|
318 */ |
|
319 |
|
320 inline void TDrive::SetRugged(TBool aIsRugged) |
|
321 { |
|
322 if (!aIsRugged) |
|
323 iDriveFlags |= ENotRugged; |
|
324 else |
|
325 iDriveFlags &= ~ENotRugged; |
|
326 } |
|
327 |
|
328 /** |
|
329 |
|
330 Returns whether the current drive is running as rugged Fat |
|
331 or not.If IsRugged flag is set then in the event of power |
|
332 failure fat/metadata will be in a valid state if the scandrive |
|
333 utility is run immediately after. |
|
334 |
|
335 @return Is rugged fat flag. |
|
336 */ |
|
337 |
|
338 inline TBool TDrive::IsRugged() const |
|
339 {return !(iDriveFlags & ENotRugged); } |
|
340 |
|
341 |
|
342 /** |
|
343 @return ETrue if the drive is synchronous, i.e. runs in the main file server thread. |
|
344 */ |
|
345 inline TBool TDrive::IsSynchronous() const |
|
346 { |
|
347 return iDriveFlags & EDriveIsSynch; |
|
348 } |
|
349 |
|
350 /** |
|
351 Set or reset internal EDriveIsSynch flag for the TDrive. |
|
352 */ |
|
353 inline void TDrive::SetSynchronous(TBool aIsSynch) |
|
354 { |
|
355 if(aIsSynch) |
|
356 iDriveFlags |= EDriveIsSynch; |
|
357 else |
|
358 iDriveFlags &= ~EDriveIsSynch; |
|
359 |
|
360 } |
|
361 |
|
362 inline TBool TDrive::DismountDeferred() const |
|
363 { return(iDriveFlags & EDismountDeferred); } |
|
364 |
|
365 |
|
366 // Class CMountCB |
|
367 |
|
368 /** |
|
369 Gets a reference to the object representing the drive on which |
|
370 the volume is mounted. |
|
371 |
|
372 @return The drive on which the volume is mounted. |
|
373 */ |
|
374 inline TDrive& CMountCB::Drive() const |
|
375 {return(*iDrive);} |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 /** |
|
381 Sets a pointer to the object representing the drive on which |
|
382 the volume is mounted. |
|
383 |
|
384 @param aDrive A pointer to the drive on which the volume is mounted. |
|
385 */ |
|
386 inline void CMountCB::SetDrive(TDrive* aDrive) |
|
387 {iDrive=aDrive;} |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 /** |
|
393 Gets a reference to a heap descriptor containing the name of |
|
394 the mounted volume. |
|
395 |
|
396 @return A reference to a heap descriptor containing the volume name. |
|
397 */ |
|
398 inline HBufC& CMountCB::VolumeName() const |
|
399 {return(*iVolumeName);} |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 /** |
|
405 Sets a pointer to a heap descriptor containing the name of the mounted volume. |
|
406 |
|
407 @param aName A pointer to a heap descriptor containing the name of |
|
408 the mounted volume to be set. |
|
409 */ |
|
410 inline void CMountCB::SetVolumeName(HBufC* aName) |
|
411 {iVolumeName=aName;} |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 /** |
|
417 Tests whether the client is notified of any read or write failures. |
|
418 |
|
419 The notification status is a property of the current session with |
|
420 the file server, the value of which is stored in CSessionFs::iNotifyUser. |
|
421 If set to true, the client will receive notifications from the file system. |
|
422 |
|
423 Typically, this function might be used to save the current notification |
|
424 state prior to temporarily disabling notifiers. This allows the original |
|
425 notification state to be restored. |
|
426 |
|
427 Note that GetNotifyUser() is only available once the drive has been set for |
|
428 the mount control block (using SetDrive()), since the notification status |
|
429 is held by the session and accessed via the drive. |
|
430 |
|
431 @return True if the client receives notifications from the file system, |
|
432 false otherwise. |
|
433 */ |
|
434 inline TBool CMountCB::GetNotifyUser() const |
|
435 {return(Drive().GetNotifyUser());} |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 /** |
|
441 */ |
|
442 inline void CMountCB::SetNotifyOn() |
|
443 {Drive().SetNotifyOn();} |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 /** |
|
449 */ |
|
450 inline void CMountCB::SetNotifyOff() |
|
451 {Drive().SetNotifyOff();} |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 /** |
|
457 Locks the mount by incrementing the internal lock counter. |
|
458 |
|
459 The mount becomes locked on formatting or on the opening of a resource |
|
460 (a file or a directory) or raw disk subsession. |
|
461 A format, resource or raw disk subsession can only be opened if the mount |
|
462 is not locked. |
|
463 */ |
|
464 inline void CMountCB::IncLock() |
|
465 {iLockMount++;} |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 /** |
|
471 Unlocks the mount by decrementing the internal lock counter. |
|
472 |
|
473 The mount becomes locked on formatting or on the opening of a resource |
|
474 (a file or a directory) or raw disk subsession. |
|
475 A format, resource or raw disk subsession can only be opened if the mount |
|
476 is not locked. |
|
477 */ |
|
478 inline void CMountCB::DecLock() |
|
479 {iLockMount--;} |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 /** |
|
485 Gets the current lock status. |
|
486 |
|
487 It delivers the current lock status by returning the internal lock counter. |
|
488 |
|
489 @return The current lock status. |
|
490 */ |
|
491 inline TInt CMountCB::LockStatus() const |
|
492 {return(iLockMount);} |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 /** |
|
498 Tests whether the mount is currently locked. |
|
499 |
|
500 A mount is locked when the internal lock counter is greater than zero. |
|
501 On creation, the lock counter is set to zero. |
|
502 |
|
503 The mount becomes locked on formatting or on the opening of a resource |
|
504 (a file or a directory) or raw disk subsession. |
|
505 A format, resource or raw disk subsession can only be opened if the mount |
|
506 is not locked. |
|
507 |
|
508 @return True if the mount is locked, false, otherwise. |
|
509 */ |
|
510 inline TBool CMountCB::Locked() const |
|
511 {return iLockMount>0; } |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 /** |
|
517 Tests whether the mount control block represents the current mount on |
|
518 the associated drive. |
|
519 |
|
520 A drive has only one mount which is accessible: the current mount. |
|
521 Any mount other than the current mount relates to a partition (i.e. volume) |
|
522 that was present on a removable media which has since been removed. |
|
523 The reason the mount has persisted is because resources (i.e. files/directories) |
|
524 are still open on it. |
|
525 |
|
526 This function is only available when the drive has been set for the mount |
|
527 control block (using SetDrive()), since the current mount is held by the drive. |
|
528 |
|
529 @return True if the mount is the current mount on the drive, false otherwise. |
|
530 */ |
|
531 inline TBool CMountCB::IsCurrentMount() const |
|
532 {return(this==&iDrive->CurrentMount());} |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 /** |
|
538 */ |
|
539 inline TInt64 CMountCB::Size() const |
|
540 {return(iSize);} |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 /** |
|
546 Set the unique mount number |
|
547 @param aMountNumber - The unique mount number |
|
548 */ |
|
549 const TInt KMountDismounted = 0x80000000; |
|
550 inline void CMountCB::SetMountNumber(TInt aMountNumber) |
|
551 { iMountNumber = (aMountNumber &~ KMountDismounted); } |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 /** |
|
557 Set the mount to be dismounted |
|
558 */ |
|
559 inline void CMountCB::SetDismounted(TBool aDismounted) |
|
560 { |
|
561 if(aDismounted) |
|
562 iMountNumber |= KMountDismounted; |
|
563 else |
|
564 iMountNumber &= ~KMountDismounted; |
|
565 } |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 /** |
|
571 Returns the unique mount number |
|
572 @return The unique mount number |
|
573 */ |
|
574 inline TInt CMountCB::MountNumber() const |
|
575 { return(iMountNumber &~ KMountDismounted); } |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 /** |
|
581 Returns ETrue if the mount is flagged as dismounted. |
|
582 @return ETrue if the mount is flagged as dismounted |
|
583 */ |
|
584 inline TBool CMountCB::IsDismounted() const |
|
585 { return(iMountNumber & KMountDismounted); } |
|
586 |
|
587 |
|
588 |
|
589 /** |
|
590 Retrieves TBusLocalDrive object associated with the mount |
|
591 */ |
|
592 inline TInt CMountCB::LocalDrive(TBusLocalDrive*& aLocalDrive) |
|
593 { |
|
594 aLocalDrive = NULL; |
|
595 return GetInterface(EGetLocalDrive, (TAny*&) aLocalDrive, NULL); |
|
596 } |
|
597 |
|
598 /** |
|
599 Retrieves CProxyDrive object associated with the mount |
|
600 */ |
|
601 inline TInt CMountCB::ProxyDrive(CProxyDrive*& aProxyDrive) |
|
602 { |
|
603 aProxyDrive = NULL; |
|
604 return GetInterface(EGetProxyDrive, (TAny*&) aProxyDrive, NULL); |
|
605 } |
|
606 |
|
607 inline TInt CMountCB::AddToCompositeMount(TInt aMountIndex) |
|
608 { |
|
609 TAny *mountInterface = NULL; |
|
610 return(GetInterface(EAddToCompositeMount, mountInterface, (TAny*)aMountIndex)); |
|
611 } |
|
612 |
|
613 /** |
|
614 Returns whether the mount (and any extensions) support file caching |
|
615 */ |
|
616 inline TInt CMountCB::LocalBufferSupport(CFileCB* aFile) |
|
617 { |
|
618 TAny* dummyInterface; |
|
619 return GetInterface(ELocalBufferSupport, dummyInterface, aFile); |
|
620 } |
|
621 |
|
622 inline TInt CMountCB::MountControl(TInt /*aLevel*/, TInt /*aOption*/, TAny* /*aParam*/) |
|
623 { |
|
624 return KErrNotSupported; |
|
625 } |
|
626 |
|
627 |
|
628 inline void CMountCB::FinaliseMountL(TInt aOperation, TAny* /*aParam1=NULL*/, TAny* /*aParam2=NULL*/) |
|
629 { |
|
630 if(aOperation == RFs::EFinal_RW) |
|
631 {//-- call the legacy method |
|
632 FinaliseMountL(); |
|
633 return; |
|
634 } |
|
635 |
|
636 User::Leave(KErrNotSupported); |
|
637 } |
|
638 |
|
639 inline TInt CMountCB::CheckDisk(TInt /*aOperation*/, TAny* /*aParam1=NULL*/, TAny* /*aParam2=NULL*/) |
|
640 { |
|
641 return(KErrNotSupported); |
|
642 } |
|
643 |
|
644 inline TInt CMountCB::ScanDrive(TInt /*aOperation*/, TAny* /*aParam1=NULL*/, TAny* /*aParam2=NULL*/) |
|
645 { |
|
646 return(KErrNotSupported); |
|
647 } |
|
648 |
|
649 |
|
650 //--------------------------------------------------------------------------------------------------------------------------------- |
|
651 |
|
652 /** |
|
653 Check is this file system can be mounted on the drive at all. The file system implementation may, for example, |
|
654 read and validate the boot region without real mounting overhead. |
|
655 |
|
656 |
|
657 @return KErrNotSupported this feature is not supported by the file system |
|
658 KErrNone this file system can be mounted on this drive |
|
659 KErrLocked the media is locked on a physical level. |
|
660 other error codes depending on the implementation, indicating that this filesystem can't be mouned |
|
661 */ |
|
662 inline TInt CMountCB::CheckFileSystemMountable() |
|
663 { |
|
664 return MountControl(ECheckFsMountable, 0, NULL); |
|
665 } |
|
666 |
|
667 //--------------------------------------------------------------------------------------------------------------------------------- |
|
668 /** |
|
669 Query if the mount is finalised, corresponds to the EMountStateQuery control code only. |
|
670 @param aFinalised out: ETrue if the mount is finalised, EFalse otherwise. |
|
671 |
|
672 @return KErrNotSupported this feature is not supported by the file system |
|
673 KErrNone on success |
|
674 */ |
|
675 inline TInt CMountCB::IsMountFinalised(TBool &aFinalised) |
|
676 { |
|
677 return MountControl(EMountStateQuery, ESQ_IsMountFinalised, &aFinalised); |
|
678 } |
|
679 |
|
680 //--------------------------------------------------------------------------------------------------------------------------------- |
|
681 /** |
|
682 Corresponds to EMountVolParamQuery. Request a certain amount of free space on the volume. |
|
683 If _current_ amount of free space is >= than required or it is not being updated in background by the mount, returns immediately; |
|
684 If mount is still counting free space and If _current_ amount of free space is < than required, the caller will be blocked |
|
685 until mount finds enough free space or reports that the _final_ amount of free space is less than required. |
|
686 |
|
687 @param aFreeSpaceBytes in: number of free bytes on the volume required, out: resulted amount of free space. It can be less than |
|
688 required if there isn't enough free space on the volume at all. |
|
689 |
|
690 @return KErrNotSupported this feature is not supported by the file system |
|
691 KErrNone on success |
|
692 */ |
|
693 inline TInt CMountCB::RequestFreeSpace(TUint64 &aFreeSpaceBytes) |
|
694 { |
|
695 return MountControl(EMountVolParamQuery, ESQ_RequestFreeSpace, &aFreeSpaceBytes); |
|
696 } |
|
697 |
|
698 //--------------------------------------------------------------------------------------------------------------------------------- |
|
699 /** |
|
700 Corresponds to EMountVolParamQuery. A request to obtain the _current_ amount of free space on the volume asynchronously, without blocking. |
|
701 Some mounts implementations can count volume free space in the background. |
|
702 |
|
703 @param aFreeSpaceBytes in: none; out: _current_ amount of free space on the volume. |
|
704 |
|
705 @return KErrNotSupported this feature is not supported by the file system |
|
706 KErrNone on success |
|
707 */ |
|
708 inline TInt CMountCB::GetCurrentFreeSpaceAvailable(TInt64 &aFreeSpaceBytes) |
|
709 { |
|
710 return MountControl(EMountVolParamQuery, ESQ_GetCurrentFreeSpace, &aFreeSpaceBytes); |
|
711 } |
|
712 |
|
713 //--------------------------------------------------------------------------------------------------------------------------------- |
|
714 /** |
|
715 Corresponds to EMountVolParamQuery. A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). |
|
716 @param aVolSizeBytes in: none; out: mounted volume size, same as TVolumeInfo::iSize |
|
717 |
|
718 @return KErrNotSupported this feature is not supported by the file system |
|
719 KErrNone on success |
|
720 */ |
|
721 inline TInt CMountCB::MountedVolumeSize(TUint64& aVolSizeBytes) |
|
722 { |
|
723 return MountControl(EMountVolParamQuery, ESQ_MountedVolumeSize, &aVolSizeBytes); |
|
724 } |
|
725 |
|
726 |
|
727 //--------------------------------------------------------------------------------------------------------------------------------- |
|
728 /** |
|
729 Get Maximum file size, which is supported by the file system that has produced this mount. |
|
730 @param aVolSizeBytes in: none; out: Theoretical max. supported by this file system file size. |
|
731 |
|
732 @return KErrNotSupported this feature is not supported by the file system |
|
733 KErrNone on success |
|
734 */ |
|
735 inline TInt CMountCB::GetMaxSupportedFileSize(TUint64 &aSize) |
|
736 { |
|
737 return MountControl(EMountFsParamQuery, ESQ_GetMaxSupportedFileSize, &aSize); |
|
738 } |
|
739 |
|
740 |
|
741 |
|
742 //############################################################################################### |
|
743 // Class CFileCB |
|
744 |
|
745 /** |
|
746 Sets the mount associated with the file. |
|
747 |
|
748 @param aMount The mount. |
|
749 */ |
|
750 inline void CFileCB::SetMount(CMountCB * aMount) |
|
751 {iMount=aMount;} |
|
752 |
|
753 /** |
|
754 Gets a reference to the object representing the drive on which |
|
755 the file resides. |
|
756 |
|
757 @return A reference to the file's drive. |
|
758 */ |
|
759 inline TDrive& CFileCB::Drive() const |
|
760 {return(*iDrive);} |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 /** |
|
766 Gets a reference to the object representing the drive on which the file was created. |
|
767 |
|
768 The 'created drive' is only different from the 'drive', as returned by Drive(), if |
|
769 the 'drive' was a substitute for the 'created drive' in the file server session. |
|
770 |
|
771 @return A reference to the drive on which the file was created. |
|
772 */ |
|
773 inline TDrive& CFileCB::CreatedDrive() const |
|
774 {return(*iCreatedDrive);} |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 /** |
|
780 Gets a reference to the object representing the mount on which the file resides. |
|
781 |
|
782 @return The file's mount. |
|
783 */ |
|
784 inline CMountCB& CFileCB::Mount() const |
|
785 {return(*iMount);} |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 /** |
|
791 Gets a reference to a heap descriptor containing the full file name. |
|
792 |
|
793 @return A heap descriptor containing the full file name. |
|
794 */ |
|
795 inline HBufC& CFileCB::FileName() const |
|
796 {return(*iFileName);} |
|
797 |
|
798 /** |
|
799 Gets a reference to a heap descriptor containing the folded full file name. |
|
800 |
|
801 @return A heap descriptor containing the full file name. |
|
802 */ |
|
803 inline HBufC& CFileCB::FileNameF() const |
|
804 {return(*iFileNameF);} |
|
805 |
|
806 /** |
|
807 Gets the hash of the folded filename |
|
808 |
|
809 @return hash of the folded file name |
|
810 */ |
|
811 inline TUint32 CFileCB::NameHash() const |
|
812 {return(iNameHash);} |
|
813 |
|
814 |
|
815 /** |
|
816 Gets a reference to the file share locks array being used by the file. |
|
817 @return The file share lock. |
|
818 */ |
|
819 inline TFileLocksArray& CFileCB::FileLocks() |
|
820 {return(*iFileLocks);} |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 /** |
|
826 Gets the file object's unique ID, as returned by CObject::UniqueID(). |
|
827 |
|
828 @return The object's unique ID. |
|
829 |
|
830 @see CObject |
|
831 */ |
|
832 inline TInt CFileCB::UniqueID() const |
|
833 {return(CFsObject::UniqueID());} |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 /** |
|
839 Gets the iShare value, which defines the level of access allowed to the file. |
|
840 |
|
841 @return The value of iShare |
|
842 |
|
843 @see CFileCB::iShare |
|
844 */ |
|
845 inline TShare CFileCB::Share() const |
|
846 {return(iShare);} |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 /** |
|
852 Sets the iShare value, which defines the level of access allowed to the file. |
|
853 |
|
854 @param aShare The new value. |
|
855 |
|
856 @see CFileCB::iShare |
|
857 */ |
|
858 inline void CFileCB::SetShare(TShare aShare) |
|
859 {iShare=aShare;} |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 /** |
|
865 Gets the size of the file. |
|
866 |
|
867 @return The size of the file. |
|
868 */ |
|
869 inline TInt CFileCB::Size() const |
|
870 {return(iSize);} |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 /** |
|
876 Sets the size of the file. |
|
877 |
|
878 @param aSize The size of the file. |
|
879 */ |
|
880 inline void CFileCB::SetSize(TInt aSize) |
|
881 {iSize=aSize;} |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 /** |
|
887 Gets the file's attributes. |
|
888 |
|
889 @return An integer containing the file attribute bit mask. |
|
890 */ |
|
891 inline TInt CFileCB::Att() const |
|
892 {return(iAtt);} |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 /** |
|
898 Sets the file's attributes. |
|
899 |
|
900 @param aAtt The file attribute bit mask. |
|
901 */ |
|
902 inline void CFileCB::SetAtt(TInt aAtt) |
|
903 {iAtt=aAtt;} |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 /** |
|
909 Gets the universal time when the file was last modified. |
|
910 |
|
911 @return The universal time when the file was last modiified. |
|
912 */ |
|
913 inline TTime CFileCB::Modified() const |
|
914 {return(iModified);} |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 /** |
|
920 Sets the universal time when the file was last modified. |
|
921 |
|
922 @param aModified The universal time when the file was last modified. |
|
923 */ |
|
924 inline void CFileCB::SetModified(TTime aModified) |
|
925 {iModified=aModified;} |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 /** |
|
931 Tests whether the file is corrupt. |
|
932 |
|
933 @return ETrue if the file is corrupt; EFalse otherwise. |
|
934 */ |
|
935 inline TBool CFileCB::FileCorrupt() const |
|
936 {return iFileCorrupt;} |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 /** |
|
942 Sets whether the file is corrupt. |
|
943 |
|
944 @param aFileCorrupt ETrue, if the file is corrupt; EFalse, otherwise. |
|
945 */ |
|
946 inline void CFileCB::SetFileCorrupt(TBool aFileCorrupt) |
|
947 {iFileCorrupt=aFileCorrupt;} |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 /** |
|
953 Gets the iBadPower value. |
|
954 |
|
955 @return The value of iBadPower |
|
956 |
|
957 @see CFileCB::iBadPower |
|
958 */ |
|
959 inline TBool CFileCB::BadPower() const |
|
960 {return (iBadPower);} |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 /** |
|
966 Sets the iBadPower value. |
|
967 |
|
968 @param aBadPower ETrue, if an operation on the file has failed due |
|
969 to bad power; |
|
970 EFalse if power has been found to be good. |
|
971 |
|
972 @see CFileCB::iBadPower |
|
973 */ |
|
974 inline void CFileCB::SetBadPower(TBool aBadPower) |
|
975 {iBadPower=aBadPower;} |
|
976 |
|
977 |
|
978 /** |
|
979 Retrieves the BlockMap of a file. |
|
980 |
|
981 @param aInfo |
|
982 |
|
983 @param aStartPos |
|
984 |
|
985 @param aEndPos |
|
986 |
|
987 @return |
|
988 */ |
|
989 inline TInt CFileCB::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos) |
|
990 { |
|
991 TAny* pM; |
|
992 TInt r = GetInterface(EBlockMapInterface, pM, (TAny*) this); |
|
993 if (KErrNone!=r) |
|
994 return r; |
|
995 return reinterpret_cast<CFileCB::MBlockMapInterface*>(pM)->BlockMap(aInfo, aStartPos, aEndPos); |
|
996 } |
|
997 |
|
998 |
|
999 /** |
|
1000 Retrieves TBusLocalDrive object associated with an open file. |
|
1001 */ |
|
1002 inline TInt CFileCB::LocalDrive(TBusLocalDrive*& aLocalDrive) |
|
1003 { |
|
1004 aLocalDrive = NULL; |
|
1005 return GetInterface(EGetLocalDrive, (TAny*&) aLocalDrive, NULL); |
|
1006 } |
|
1007 |
|
1008 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1009 // Class RLocalMessage |
|
1010 inline RLocalMessage::RLocalMessage() |
|
1011 {InitHandle();} |
|
1012 |
|
1013 inline void RLocalMessage::InitHandle() |
|
1014 {iHandle = KLocalMessageHandle; iFunction=-1;} |
|
1015 |
|
1016 inline void RLocalMessage::SetFunction(TInt aFunction) |
|
1017 {iFunction = aFunction;} |
|
1018 |
|
1019 inline void RLocalMessage::SetArgs(TIpcArgs& aArgs) |
|
1020 { |
|
1021 iArgs[0] = aArgs.iArgs[0]; |
|
1022 iArgs[1] = aArgs.iArgs[1]; |
|
1023 iArgs[2] = aArgs.iArgs[2]; |
|
1024 iArgs[3] = aArgs.iArgs[3]; |
|
1025 |
|
1026 } |
|
1027 |
|
1028 inline TInt RLocalMessage::Arg(TInt aIndex) const |
|
1029 {return iArgs[aIndex];} |
|
1030 |
|
1031 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1032 // Class CFileShare |
|
1033 /** |
|
1034 Gets a reference to the object representing an open file that is being shared. |
|
1035 |
|
1036 @return A reference to the shared file. |
|
1037 */ |
|
1038 inline CFileCB& CFileShare::File() |
|
1039 {return(*iFile);} |
|
1040 |
|
1041 |
|
1042 // Returns ETrue if the file share mode is EFileBifFile |
|
1043 // indicating large file access for the file share |
|
1044 inline TBool CFileShare::IsFileModeBig() |
|
1045 { |
|
1046 return (iMode & EFileBigFile) ? (TBool)ETrue:(TBool)EFalse; |
|
1047 } |
|
1048 |
|
1049 |
|
1050 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1051 // Class CDirCB |
|
1052 |
|
1053 /** |
|
1054 Gets a reference to the object representing the drive on which |
|
1055 the directory resides. |
|
1056 |
|
1057 @return A reference to the directory's drive. |
|
1058 */ |
|
1059 inline TDrive& CDirCB::Drive() const |
|
1060 {return(*iDrive);} |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 /** |
|
1066 Gets a reference to the object representing the mount on which |
|
1067 the directory resides. |
|
1068 |
|
1069 @return A reference to the directory's mount. |
|
1070 */ |
|
1071 inline CMountCB& CDirCB::Mount() const |
|
1072 {return(*iMount);} |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 /** |
|
1078 Tests whether the preceding entry details should be returned when |
|
1079 multiple entries are being read. |
|
1080 |
|
1081 @return True if the preceding entry details should be returned; |
|
1082 false otherwise. |
|
1083 */ |
|
1084 inline TBool CDirCB::Pending() const |
|
1085 {return iPending;} |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 /** |
|
1091 Sets whether the preceding entry details should be returned when |
|
1092 multiple entries are being read. |
|
1093 |
|
1094 @param aPending ETrue if the preceding entry details should be returned; |
|
1095 EFalse otherwise. |
|
1096 */ |
|
1097 inline void CDirCB::SetPending(TBool aPending) |
|
1098 {iPending=aPending;} |
|
1099 |
|
1100 |
|
1101 |
|
1102 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1103 // class CFormatCB |
|
1104 |
|
1105 /** |
|
1106 Gets the object representing the drive on which the disk to |
|
1107 be formatted resides. |
|
1108 |
|
1109 @return The drive for the format action. |
|
1110 */ |
|
1111 inline TDrive& CFormatCB::Drive() const |
|
1112 {return(*iDrive);} |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 /** |
|
1118 Gets the object representing the mount on which the disk to |
|
1119 be formatted resides. |
|
1120 |
|
1121 @return The mount for the format action. |
|
1122 */ |
|
1123 inline CMountCB& CFormatCB::Mount() const |
|
1124 {return(*iMount);} |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 /** |
|
1130 Gets the mode of the format operation. |
|
1131 |
|
1132 @return The value of the format mode. |
|
1133 */ |
|
1134 inline TFormatMode CFormatCB::Mode() const |
|
1135 {return(iMode);} |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 /** |
|
1141 Gets the current stage in the format operation. |
|
1142 |
|
1143 @return The stage the current format operation has reached. |
|
1144 */ |
|
1145 inline TInt& CFormatCB::CurrentStep() |
|
1146 {return(iCurrentStep);} |
|
1147 |
|
1148 |
|
1149 |
|
1150 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1151 // class CRawDiskCB |
|
1152 |
|
1153 /** |
|
1154 Gets a reference to an object representing the drive on which the disk resides. |
|
1155 |
|
1156 @return A reference to the drive on which the disk resides. |
|
1157 */ |
|
1158 inline TDrive& CRawDiskCB::Drive() |
|
1159 {return(iMount->Drive());} |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 /** |
|
1165 Gets an object representing the mount on which the disk resides. |
|
1166 |
|
1167 @return The mount on which the disk resides. |
|
1168 */ |
|
1169 inline CMountCB& CRawDiskCB::Mount() |
|
1170 {return(*iMount);} |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 /** |
|
1176 Tests whether the mount on which the disk resides is write protected. |
|
1177 |
|
1178 @return True if the mount is write protected, false otherwise. |
|
1179 */ |
|
1180 inline TBool CRawDiskCB::IsWriteProtected() const |
|
1181 { return(iFlags & EWriteProtected); } |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 /** |
|
1188 Stores the write protected state of the disk. |
|
1189 */ |
|
1190 inline void CRawDiskCB::SetWriteProtected() |
|
1191 { iFlags |= EWriteProtected; } |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 /** |
|
1197 Tests whether the disk contents has changed (due to a write operation) |
|
1198 |
|
1199 @return True if the disk contents has changed |
|
1200 */ |
|
1201 inline TBool CRawDiskCB::IsChanged() const |
|
1202 { return(iFlags & EChanged); } |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 /** |
|
1208 Set a flag to state that the disk contents has changed (due to a write operation) |
|
1209 */ |
|
1210 inline void CRawDiskCB::SetChanged() |
|
1211 { iFlags |= EChanged; } |
|
1212 |
|
1213 |
|
1214 |
|
1215 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1216 // class CProxyDriveFactory |
|
1217 /** |
|
1218 Sets the Library (DLL) handle to be used by the CProxyDriveFactory |
|
1219 */ |
|
1220 inline void CProxyDriveFactory::SetLibrary(RLibrary aLib) |
|
1221 {iLibrary=aLib;} |
|
1222 /** |
|
1223 Gets the Library (DLL) handle in use by the CProxyDriveFactory |
|
1224 @return Library (DLL) handle |
|
1225 */ |
|
1226 inline RLibrary CProxyDriveFactory::Library() const |
|
1227 {return(iLibrary);} |
|
1228 |
|
1229 |
|
1230 inline void CExtProxyDriveFactory::SetLibrary(RLibrary aLib) |
|
1231 {iLibrary=aLib;} |
|
1232 |
|
1233 inline RLibrary CExtProxyDriveFactory::Library() const |
|
1234 {return(iLibrary);} |
|
1235 |
|
1236 |
|
1237 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1238 // class CProxyDrive |
|
1239 /** |
|
1240 Gets the mount control block object for a specific volume on a drive. |
|
1241 |
|
1242 @return either a currently mounted volume in the system or the volume that has been removed but still has |
|
1243 subsession objects open. |
|
1244 */ |
|
1245 inline CMountCB* CProxyDrive::Mount() const |
|
1246 {return(iMount);} |
|
1247 |
|
1248 inline void CProxyDrive::SetMount(CMountCB *aMount) |
|
1249 { |
|
1250 iMount = aMount; |
|
1251 } |
|
1252 |
|
1253 /** |
|
1254 Returns wheher the drive (and any extensions) support file caching |
|
1255 */ |
|
1256 inline TInt CProxyDrive::LocalBufferSupport() |
|
1257 { |
|
1258 TAny* dummyInterface; |
|
1259 return GetInterface(ELocalBufferSupport, dummyInterface, NULL); |
|
1260 } |
|
1261 |
|
1262 /** |
|
1263 return whether proxy drive supports file caching |
|
1264 */ |
|
1265 inline TInt CBaseExtProxyDrive::LocalBufferSupport() |
|
1266 { |
|
1267 return iProxy->LocalBufferSupport(); |
|
1268 } |
|
1269 |
|
1270 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1271 // Surrogate Pair hepler apis |
|
1272 /** |
|
1273 Determines if aChar is the outsite BMP. |
|
1274 |
|
1275 @param aChar character to checked if that is outside BMP. |
|
1276 @return ETrue if outside BMP, EFalse otherwise. |
|
1277 */ |
|
1278 inline TBool IsSupplementary(TUint aChar) |
|
1279 { |
|
1280 return (aChar > 0xFFFF); |
|
1281 } |
|
1282 |
|
1283 /** |
|
1284 Determines if aInt16 is a high surrogate. |
|
1285 |
|
1286 @param aInt16 character to checked if that is high surrogate. |
|
1287 @return ETrue if high surrogate, EFalse otherwise. |
|
1288 */ |
|
1289 inline TBool IsHighSurrogate(TText16 aInt16) |
|
1290 { |
|
1291 return (aInt16 & 0xFC00) == 0xD800; |
|
1292 } |
|
1293 |
|
1294 /** |
|
1295 Determines if aInt16 is a low surrogate. |
|
1296 |
|
1297 @param aInt16 character to checked if that is low surrogate. |
|
1298 @return ETrue if low surrogate, EFalse otherwise. |
|
1299 */ |
|
1300 inline TBool IsLowSurrogate(TText16 aInt16) |
|
1301 { |
|
1302 return (aInt16 & 0xFC00) == 0xDC00; |
|
1303 } |
|
1304 |
|
1305 /** |
|
1306 Joins high surrogate character aHighSurrogate and low surrogate character aLowSurrogate. |
|
1307 |
|
1308 @param aHighSurrogate a high surrogate character to be joined. |
|
1309 @param aLowSurrogate a low surrogate character to be joined. |
|
1310 @return joined character that is outside BMP. |
|
1311 */ |
|
1312 inline TUint JoinSurrogate(TText16 aHighSurrogate, TText16 aLowSurrogate) |
|
1313 { |
|
1314 return ((aHighSurrogate - 0xD7F7) << 10) + aLowSurrogate; |
|
1315 } |
|
1316 |
|
1317 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1318 // class CExtProxyDrive |
|
1319 inline TInt CExtProxyDrive::DriveNumber() |
|
1320 {return iDriveNumber;}; |
|
1321 inline void CExtProxyDrive::SetDriveNumber(TInt aDrive) |
|
1322 {iDriveNumber = aDrive;}; |
|
1323 inline CExtProxyDriveFactory* CExtProxyDrive::FactoryP() |
|
1324 {return iFactory;}; |
|
1325 |
|
1326 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1327 // class CLocDrvMountCB |
|
1328 /** |
|
1329 Gets the mounted local drive object |
|
1330 |
|
1331 @return The local drive. |
|
1332 */ |
|
1333 inline CProxyDrive* CLocDrvMountCB::LocalDrive() const |
|
1334 {return(iProxyDrive);} |
|
1335 |
|
1336 //--------------------------------------------------------------------------------------------------------------------------------- |
|
1337 // class CFsObject |
|
1338 inline CFsObjectCon* CFsObject::Container() const |
|
1339 { return iContainer; } |
|
1340 inline TInt CFsObject::Inc() |
|
1341 { return __e32_atomic_tas_ord32(&iAccessCount, 1, 1, 0); } |
|
1342 inline TInt CFsObject::Dec() |
|
1343 { return __e32_atomic_tas_ord32(&iAccessCount, 1, -1, 0); } |
|
1344 |
|
1345 |