562 |
562 |
563 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) |
563 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) |
564 friend class TFsControlIo; // for access to LocateDrives() |
564 friend class TFsControlIo; // for access to LocateDrives() |
565 #endif |
565 #endif |
566 }; |
566 }; |
|
567 |
|
568 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
569 typedef TFsNotification::TFsNotificationType TNotificationType; |
|
570 #else |
|
571 typedef TInt TNotificationType; |
|
572 #endif |
|
573 __ASSERT_COMPILE(sizeof(TNotificationType) == sizeof(TInt)); |
|
574 |
|
575 class CFsNotificationInfoBody; //Forward-declaration |
|
576 class CFsClientMessageRequest; //Forward-declaration |
|
577 class TParsePtrC; //Forward-declaration |
|
578 template <class T> class CFsPool; //Forward-declaration |
|
579 |
|
580 class CFsNotificationInfo : public CBase |
|
581 { |
|
582 public: |
|
583 |
|
584 /** |
|
585 * For construction from File systems / CMountCBs |
|
586 * |
|
587 * Provides a CFsNotificationInfo to populate. Populate with the change information. |
|
588 * Supply this object to CMountCB::IssueNotification. |
|
589 * |
|
590 * Once CMountCB::IssueNotification has been called, |
|
591 * free the object by passing it to CFsNotificationInfo::Free |
|
592 * (i.e. Do not call delete on the object) |
|
593 * |
|
594 * @param aMount The mount control block which is issuing this notification |
|
595 * @param aFunction The function as defined in TFsMessage, f32plugin.h, such as EFsFileWrite. |
|
596 * |
|
597 * @return A CFsNotificationInfo* which may be populated with notification info. |
|
598 * Will return NULL in error conditions. |
|
599 * |
|
600 * @see CMountCB::IssueNotification |
|
601 * @see CFsNotificationInfo::Free |
|
602 */ |
|
603 IMPORT_C static CFsNotificationInfo* Allocate(const CMountCB& aMount, TInt aFunction); |
|
604 |
|
605 /** |
|
606 * Free CFsNotificationInfo objects allocated by CFsNotificationInfo::Allocate with this function. |
|
607 * |
|
608 * On return aNotificationInfo will be set to NULL. |
|
609 */ |
|
610 IMPORT_C static void Free(CFsNotificationInfo*& aNotificationInfo); |
|
611 |
|
612 //Set data: |
|
613 |
|
614 /** |
|
615 * Set the source name for the changes. |
|
616 * This is the name of the file/directory that has changed. |
|
617 * |
|
618 * "drive-letter:" is not to be included. |
|
619 * |
|
620 * e.g. "x:\\myfile.txt" is incorrect |
|
621 * "\\myfile.txt" is correct. |
|
622 */ |
|
623 IMPORT_C TInt SetSourceName(const TDesC& aSrc); |
|
624 |
|
625 /** |
|
626 * Set the new name for the file. |
|
627 * This is the new name of the file in the case of a rename. |
|
628 * |
|
629 * "drive-letter:" is not to be included. |
|
630 */ |
|
631 IMPORT_C TInt SetNewName(const TDesC& aDest); |
|
632 |
|
633 /** |
|
634 * In the case of a File Write or File Set Size operation being notified, |
|
635 * the new file size of the file must be provided. |
|
636 */ |
|
637 IMPORT_C TInt SetFilesize(TInt64 aFilesize); |
|
638 |
|
639 /** |
|
640 * In the case of a change of attributes, the set and cleared attributes must be provided. |
|
641 * (If these are not known, then the current attributes can be provided to aSet and |
|
642 * inverse of the current attributes can be provided to aCleared. |
|
643 */ |
|
644 IMPORT_C TInt SetAttributes(TUint aSet,TUint aCleared); |
|
645 |
|
646 /** |
|
647 * Set the UID of the process that has caused the change. |
|
648 * |
|
649 */ |
|
650 IMPORT_C TInt SetUid(const TUid& aUid); |
|
651 |
|
652 |
|
653 |
|
654 //******************************************** |
|
655 // File server internal : |
|
656 //******************************************** |
|
657 |
|
658 static CFsNotificationInfo* Allocate(CFsMessageRequest& aRequest); |
|
659 static CFsNotificationInfo* Allocate(TInt aFunction, TInt aDrive); |
|
660 |
|
661 //Initialise notification object pool |
|
662 static TInt Initialise(); |
|
663 |
|
664 //Getters |
|
665 TInt SetDriveNumber(TInt aDriveNumber); |
|
666 void SetRequest(CFsRequest*); |
|
667 TInt Function(); |
|
668 TInt DriveNumber(); |
|
669 TParsePtrC& Source(); |
|
670 TParsePtrC& NewName(); |
|
671 CFsRequest* Request(); |
|
672 TInt64* Data(); |
|
673 TUid& Uid(); |
|
674 TNotificationType& NotificationType(); |
|
675 TBool DestDriveIsSet(); |
|
676 |
|
677 /* |
|
678 * This is the source length including the drive and colon |
|
679 * which isn't actually saved as part of the stored source |
|
680 */ |
|
681 TInt SourceSize(); |
|
682 /* |
|
683 * This is the new name length including the drive and colon |
|
684 * which may (or may not (- see below)) be actually part of the stored newname. |
|
685 * |
|
686 * "Drive:" is stored when the notification request originates from a |
|
687 * file server client and the drive could be different to the source's drive. |
|
688 * |
|
689 * In the case of a request originating from a CMountCB::IssueNotification call, |
|
690 * the CMountCB does not know about drive letters and only operates on a single |
|
691 * drive so in this case the "drive:" is missing. |
|
692 */ |
|
693 TInt NewNameSize(); |
|
694 |
|
695 static void NotificationType(TInt aFunction,TNotificationType& aNotificationType); |
|
696 static void PathName(CFsClientMessageRequest& aRequest, TParsePtrC& aName); |
|
697 static void NewPathName(CFsClientMessageRequest& aRequest, TParsePtrC& aName); |
|
698 static TInt NotificationSize(CFsNotificationInfo& aRequest); |
|
699 static TInt TypeToIndex(TNotificationType aType); |
|
700 static TNotificationType NotificationType(TInt& aIndex); |
|
701 static TInt DriveNumber(const TPtrC& aPath); |
|
702 static void Attributes(CFsMessageRequest& aRequest, TUint& aSet, TUint& aClear); |
|
703 static TInt64 FileSize(CFsMessageRequest& aRequest); |
|
704 static TInt ValidateNotification(CFsNotificationInfo& aNotificationInfo); |
|
705 static void SetData(CFsMessageRequest* aRequest, CFsNotificationInfo* aNotificationInfo); |
|
706 static TUint NotifyType(TInt aFunction); |
|
707 |
|
708 private: |
|
709 //Don't delete instances, free them. |
|
710 virtual ~CFsNotificationInfo(); |
|
711 CFsNotificationInfo& operator=(CFsNotificationInfo& aNotification); //to prevent copying |
|
712 |
|
713 // called from New |
|
714 CFsNotificationInfo(); |
|
715 |
|
716 //Used to populate NotificationInfoPool |
|
717 static CFsNotificationInfo* New(); |
|
718 |
|
719 //Called after construction/allocation from pool |
|
720 TInt Init(TInt aFunction, TInt aDriveNumber); |
|
721 |
|
722 //Resets notification |
|
723 void CleanNotification(); |
|
724 |
|
725 CFsNotificationInfoBody* iBody; |
|
726 friend class FsNotify; |
|
727 friend class CFsPool<CFsNotificationInfo>; //For access to ~CFsNotificationInfo for compilation purposes |
|
728 }; |
|
729 |
567 |
730 |
568 class CFileCB; |
731 class CFileCB; |
569 class CDirCB; |
732 class CDirCB; |
570 |
733 |
571 __ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo)); |
734 __ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo)); |
1393 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
1556 IMPORT_C virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
1394 |
1557 |
1395 // calls GetInterface() with tracepoints added |
1558 // calls GetInterface() with tracepoints added |
1396 TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
1559 TInt GetInterfaceTraced(TInt aInterfaceId,TAny*& aInterface,TAny* aInput); |
1397 |
1560 |
1398 |
1561 public: |
1399 |
1562 /* |
1400 |
1563 * This function is provided for file systems to issue notifications to file server clients |
|
1564 * that have registered for notifications using the RFs::NotifyChange and CFsNotify client-side APIs. |
|
1565 * |
|
1566 * @param aNotificationInfo This object should contain the relevant Source (and if appropriate, NewName) |
|
1567 * as well as any other required information. |
|
1568 * |
|
1569 * The Source provided should be a fullpath of the form: |
|
1570 * \[path\]directory\ - in the case of changes to a directory |
|
1571 * \[path\]filename.ext - in the case of changes to a file |
|
1572 * |
|
1573 * The drive letter information is not to be included. |
|
1574 * |
|
1575 * In the case of 'File Write' or 'File Set Size' operations, the resulting file size must be set. |
|
1576 * @see CFsNotificationInfo::SetFileSize |
|
1577 * |
|
1578 * In the case of a attributes change, the attributes set and cleared must be set. |
|
1579 * @see CFsNotificationInfo::SetAttributes |
|
1580 * |
|
1581 * All CFsNotificationInfo objects must have a Uid set. This is the Uid of the |
|
1582 * process which caused the change. i.e. A photo browser may wish to know if it was the camera app |
|
1583 * or the photo editor which has caused a change. @see CFsNotificationInfo::SetUID |
|
1584 * |
|
1585 * @see class TFsNotification. |
|
1586 * |
|
1587 * @return Symbian Standard error code. KErrNone on success. |
|
1588 */ |
|
1589 IMPORT_C TInt IssueNotification(CFsNotificationInfo* aNotificationInfo); |
|
1590 |
1401 private: |
1591 private: |
1402 void SetFileSystem(CFileSystem* aFS); |
1592 void SetFileSystem(CFileSystem* aFS); |
1403 |
1593 |
1404 //-- these factory methods mus be used to produce objects representing files, directories etc. as soon as all these objects are |
1594 //-- these factory methods mus be used to produce objects representing files, directories etc. as soon as all these objects are |
1405 //-- associated with the mount, not the file sytem (file system is a factory for corresponding mounts) |
1595 //-- associated with the mount, not the file sytem (file system is a factory for corresponding mounts) |