userlibandfileserver/fileserver/sfile/sf_notify.cpp
changeset 300 1d28c8722707
parent 286 48e57fb1237e
equal deleted inserted replaced
293:0659d0e1a03c 300:1d28c8722707
    14 // f32\sfile\sf_notif.cpp
    14 // f32\sfile\sf_notif.cpp
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #include "sf_std.h"
    18 #include "sf_std.h"
    19 
    19 #include "sf_notifier.h"
    20 
    20 #include "sf_pool.h"
       
    21 
       
    22 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
       
    23 #include <f32notification.h>
       
    24 #endif
    21 
    25 
    22 TChangeQue FsNotify::iChangeQues[KMaxNotifyQues];
    26 TChangeQue FsNotify::iChangeQues[KMaxNotifyQues];
    23 TDiskSpaceQue FsNotify::iDiskSpaceQues[KMaxDiskQues];
    27 TDiskSpaceQue FsNotify::iDiskSpaceQues[KMaxDiskQues];
    24 TDebugQue FsNotify::iDebugQue;
    28 TDebugQue FsNotify::iDebugQue;
    25 TDismountNotifyQue FsNotify::iDismountNotifyQue;
    29 TDismountNotifyQue FsNotify::iDismountNotifyQue;
       
    30 
       
    31 _LIT(KEmptyString,"");
       
    32 
       
    33 CFsNotificationInfoBody::CFsNotificationInfoBody()
       
    34 : iSrc(KEmptyString),
       
    35   iSrcBuf(KEmptyString),
       
    36   iDest(KEmptyString),
       
    37   iDestDriveStored(EFalse),
       
    38   iFunction(KErrNotFound),
       
    39   iData(KErrNotFound), 
       
    40 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
       
    41   iNotificationType(TFsNotification::EOverflow),
       
    42 #else
       
    43   iNotificationType(KErrNotFound),
       
    44 #endif
       
    45   iUid(TUid::Null())
       
    46     {
       
    47     }
       
    48 
       
    49 CFsNotificationInfo::CFsNotificationInfo()
       
    50     {
       
    51     }
       
    52 
       
    53 /*
       
    54  * These do not get deleted, they get Freed via CFsNotificationInfo::Free.
       
    55  */
       
    56 CFsNotificationInfo::~CFsNotificationInfo()
       
    57     {
       
    58     Fault(ENotificationInfoDeletion);
       
    59     }
       
    60 
       
    61 TInt CFsNotificationInfo::Init(TInt aFunction, TInt aDriveNum)
       
    62     {
       
    63     //Clean notification before use
       
    64     CleanNotification();
       
    65     
       
    66     iBody->iFunction = aFunction;
       
    67     TInt err = SetDriveNumber(aDriveNum);
       
    68     if(err != KErrNone)
       
    69         {
       
    70         return err;
       
    71         }
       
    72  
       
    73     //Set notification type
       
    74 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
       
    75     CFsNotificationInfo::NotificationType(iBody->iFunction, iBody->iNotificationType);
       
    76 #else
       
    77     iBody->iNotificationType = KErrNotSupported;
       
    78 #endif   
       
    79     return KErrNone;
       
    80     }
       
    81 
       
    82 void CFsNotificationInfo::CleanNotification()
       
    83     {
       
    84     //Clear all variables 
       
    85     TParsePtrC empty(KEmptyString);
       
    86     memcpy(&iBody->iSrc,&empty,sizeof(TParsePtrC));
       
    87     memcpy(&iBody->iDest,&empty,sizeof(TParsePtrC));
       
    88     iBody->iData = KErrNotFound;
       
    89     iBody->iRequest = NULL;
       
    90     iBody->iDriveNumber = KErrNotFound;
       
    91     iBody->iUid = TUid::Null();
       
    92     iBody->iDestDriveStored = EFalse;
       
    93 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
       
    94     iBody->iNotificationType=TFsNotification::EOverflow;
       
    95 #else
       
    96     iBody->iNotificationType=KErrNotFound;
       
    97 #endif
       
    98     }
       
    99 
       
   100 EXPORT_C CFsNotificationInfo* CFsNotificationInfo::Allocate(const CMountCB& aMount, TInt aFunction)
       
   101     {
       
   102     CFsNotificationInfo* info = NotificationInfoPool->Allocate();
       
   103     __ASSERT_DEBUG(info,User::Panic(_L("CFsNotificationInfo::Allocate, Could not allocate"),KErrNotFound));
       
   104     
       
   105     TInt driveNum = aMount.Drive().DriveNumber();
       
   106     __ASSERT_ALWAYS((driveNum >= EDriveA && driveNum <= EDriveZ), User::Panic(_L("CFsNotificationInfo::Allocate - Invalid Drive Num"),KErrArgument));
       
   107     TInt err = info->Init(aFunction,driveNum);
       
   108     if(err != KErrNone)
       
   109         {
       
   110         Free(info);
       
   111         return NULL;
       
   112         }
       
   113     return info;
       
   114     }
       
   115 
       
   116 
       
   117 CFsNotificationInfo* CFsNotificationInfo::Allocate(CFsMessageRequest& aRequest)
       
   118     {
       
   119     //Get a notification Info block from the pool.
       
   120     CFsNotificationInfo* notificationInfo = NotificationInfoPool->Allocate();
       
   121     
       
   122     //Set the function and call Init.
       
   123     TInt function = aRequest.Operation()->Function();
       
   124     notificationInfo->iBody->iFunction = function;
       
   125     TInt err = notificationInfo->Init(function,aRequest.DriveNumber());
       
   126     if(err != KErrNone)
       
   127         {
       
   128         CFsNotificationInfo::Free(notificationInfo);
       
   129         return NULL;
       
   130         }
       
   131 
       
   132     //Set request
       
   133     notificationInfo->SetRequest(&aRequest);
       
   134 
       
   135 	//Set UID
       
   136     notificationInfo->SetUid(aRequest.Uid()); 
       
   137 
       
   138     //Set notification type
       
   139 #ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION
       
   140     CFsNotificationInfo::SetData(&aRequest,notificationInfo);
       
   141 #endif    
       
   142     
       
   143     CFsClientMessageRequest& msgRequest = (CFsClientMessageRequest&)aRequest;
       
   144     
       
   145     //Get and store Src
       
   146     CFsNotificationInfo::PathName(msgRequest,notificationInfo->Source());
       
   147     
       
   148 	//Get and store NewName/Dest
       
   149     switch(function)
       
   150         {
       
   151         case EFsFileRename:
       
   152         case EFsRename:    
       
   153         case EFsReplace:   
       
   154         case EFsSetDriveName:
       
   155         case EFsSetVolume:
       
   156             {
       
   157             CFsNotificationInfo::NewPathName((CFsClientMessageRequest&)aRequest,notificationInfo->NewName());
       
   158             notificationInfo->iBody->iDestDriveStored = ETrue;
       
   159             }
       
   160         default:
       
   161             break;
       
   162         }
       
   163     return notificationInfo;
       
   164     }
       
   165 
       
   166 CFsNotificationInfo* CFsNotificationInfo::Allocate(TInt aFunction, TInt aDrive)
       
   167     {
       
   168     //Get a notification Info block from the pool.
       
   169     CFsNotificationInfo* notificationInfo = NotificationInfoPool->Allocate();
       
   170     
       
   171     //Set the function and call Init.
       
   172     notificationInfo->iBody->iFunction = aFunction;
       
   173     TInt err = notificationInfo->Init(aFunction,aDrive);
       
   174     if(err != KErrNone)
       
   175         {
       
   176         CFsNotificationInfo::Free(notificationInfo);
       
   177         return NULL;
       
   178         }
       
   179     
       
   180     //Set request (NULL)
       
   181     notificationInfo->SetRequest(NULL);
       
   182 	
       
   183 	//Set UID (KNullUid)
       
   184     notificationInfo->SetUid(TUid::Null());
       
   185     return notificationInfo;
       
   186     }
       
   187 
       
   188 EXPORT_C void CFsNotificationInfo::Free(CFsNotificationInfo*& aNotificationInfo)
       
   189     {
       
   190     __ASSERT_DEBUG(aNotificationInfo,User::Panic(_L("CFsNotificationInfo::Free - KErrArgument"), KErrArgument));
       
   191     NotificationInfoPool->Free(aNotificationInfo);    
       
   192     aNotificationInfo = NULL;
       
   193     }
       
   194 
       
   195 
       
   196 TInt CFsNotificationInfo::Initialise()
       
   197     {
       
   198     //Have to trap as sf_main.cpp commonInitialize doesn't.
       
   199     TRAPD(r, NotificationInfoPool = CFsPool<CFsNotificationInfo>::New(KMaxDrives,CFsNotificationInfo::New));
       
   200     if(r != KErrNone)
       
   201         return r;
       
   202     if(!NotificationInfoPool)
       
   203         return KErrNoMemory;
       
   204     return KErrNone;
       
   205     }
       
   206 
       
   207 CFsNotificationInfo* CFsNotificationInfo::New()
       
   208     {
       
   209     CFsNotificationInfo* info = new CFsNotificationInfo;
       
   210     __ASSERT_ALWAYS(info,Fault(ENotifyPoolCreation));
       
   211     info->iBody = new CFsNotificationInfoBody();
       
   212     __ASSERT_ALWAYS(info->iBody,Fault(ENotifyPoolCreation));
       
   213     return info;
       
   214     }
       
   215 
       
   216 EXPORT_C TInt CFsNotificationInfo::SetSourceName(const TDesC& aSrc)
       
   217     {
       
   218     //Add the aSrc to a TParsePtrC (no copying the filename)
       
   219     TParsePtrC sourceParsePtr(aSrc);
       
   220     
       
   221     if(sourceParsePtr.DrivePresent() || !sourceParsePtr.FullName().Length())
       
   222         return KErrArgument;
       
   223     
       
   224     switch(iBody->iFunction)
       
   225         {
       
   226 
       
   227         case EFsFileWrite:          //EParseSrc | EFileShare
       
   228         case EFsFileSetSize:        //EParseSrc | EFileShare
       
   229         case EFsFileSetAtt:         //EParseDst | EParseSrc, - should not use these; has share.
       
   230         case EFsFileSet:            //EParseSrc | EFileShare
       
   231         case EFsFileSetModified:    //EParseSrc | EFileShare - new
       
   232         case EFsFileWriteDirty:     //EFileShare
       
   233         case EFsFileCreate:         //EParseSrc
       
   234         case EFsFileTemp:           //EParseSrc - new
       
   235         case EFsFileRename:         //EParseDst | EParseSrc,
       
   236         case EFsFileReplace:        //EParseSrc
       
   237             {
       
   238             //Should look like this:  \[path\]filename
       
   239             if(!sourceParsePtr.Name().Length())
       
   240                 {
       
   241                 return KErrArgument;
       
   242                 }
       
   243             break;
       
   244             }
       
   245         case EFsDelete:             //EParseSrc
       
   246         case EFsSetEntry:           //EParseSrc,
       
   247         case EFsRename:             //EParseDst | EParseSrc,
       
   248         case EFsReplace:            //EParseDst | EParseSrc,
       
   249             {
       
   250             if(!sourceParsePtr.PathPresent() && !sourceParsePtr.NamePresent())
       
   251                 {
       
   252                 return KErrArgument;
       
   253                 }
       
   254             break;
       
   255             }
       
   256         case EFsRmDir:              //EParseSrc
       
   257         case EFsMkDir:              //EParseSrc
       
   258             {
       
   259             if(!sourceParsePtr.PathPresent())
       
   260                 {
       
   261                 return KErrArgument;
       
   262                 }
       
   263             break;
       
   264             }
       
   265       /*case EFsFormatNext:         //EParseSrc
       
   266         case EFsDismountFileSystem: //0
       
   267         case EFsMountFileSystem:    //0
       
   268         case EFsSetVolume:          //0
       
   269         case EFsSetDriveName:       //ESync
       
   270         case EFsRawDiskWrite:       //EParseSrc
       
   271         case EFsMountFileSystemScan: */
       
   272         default:
       
   273             {
       
   274             __ASSERT_DEBUG(EFalse,User::Panic(_L("CFsNotificationInfo::SetSourceName Invalid Operation"),KErrArgument));
       
   275             return KErrNotSupported;
       
   276             }
       
   277         }
       
   278     memcpy(&iBody->iSrc,&sourceParsePtr,sizeof(TParsePtrC));
       
   279     return KErrNone;
       
   280     }
       
   281 
       
   282 EXPORT_C TInt CFsNotificationInfo::SetNewName(const TDesC& aDest)
       
   283     {
       
   284     //Add the aSrc to a TParsePtr for some validation without copying the filename
       
   285     TParsePtrC destParsePtr(aDest);
       
   286     
       
   287     if(destParsePtr.DrivePresent() || !destParsePtr.FullName().Length())
       
   288         return KErrArgument;
       
   289     
       
   290     switch(iBody->iFunction)
       
   291         {
       
   292         case EFsFileRename:         //EParseDst | EParseSrc,
       
   293         case EFsRename:             //EParseDst | EParseSrc,
       
   294         case EFsReplace:            //EParseDst | EParseSrc,
       
   295             {
       
   296             if(!destParsePtr.PathPresent() && !destParsePtr.NamePresent())
       
   297                 {
       
   298                 return KErrArgument;
       
   299                 }
       
   300             break;
       
   301             }
       
   302         case EFsSetDriveName:
       
   303         case EFsSetVolume:
       
   304             {
       
   305             if(!destParsePtr.NamePresent())
       
   306                 {
       
   307                 return KErrArgument;
       
   308                 }
       
   309             break;
       
   310             }            
       
   311         default:
       
   312             {
       
   313             __ASSERT_DEBUG(ETrue,User::Panic(_L("CFsNotificationInfo::SetNewName Invalid Operation"),KErrArgument));
       
   314             }
       
   315         }
       
   316     
       
   317     memcpy(&iBody->iDest,&destParsePtr,sizeof(TParsePtrC));
       
   318     return KErrNone;
       
   319     }
       
   320 
       
   321 EXPORT_C TInt CFsNotificationInfo::SetFilesize(TInt64 aFilesize)
       
   322     {
       
   323     if(aFilesize<0)
       
   324         return KErrArgument;
       
   325     
       
   326     iBody->iData = aFilesize;
       
   327     return KErrNone;
       
   328     }
       
   329 EXPORT_C TInt CFsNotificationInfo::SetAttributes(TUint aSet,TUint aCleared)
       
   330     {
       
   331     iBody->iData = MAKE_TUINT64(aSet,aCleared);
       
   332     return KErrNone;
       
   333     }
       
   334 
       
   335 EXPORT_C TInt CFsNotificationInfo::SetUid(const TUid& aUid)
       
   336     {
       
   337     iBody->iUid = aUid;
       
   338     return KErrNone;
       
   339     }
       
   340 
       
   341 
       
   342 TInt CFsNotificationInfo::SetDriveNumber(TInt aDriveNumber) 
       
   343     {
       
   344     if(aDriveNumber >= EDriveA && aDriveNumber <= EDriveZ)
       
   345         {
       
   346         iBody->iDriveNumber = aDriveNumber;
       
   347         return KErrNone;
       
   348         }
       
   349     return KErrArgument;    
       
   350     }
       
   351 void CFsNotificationInfo::SetRequest(CFsRequest* aRequest)
       
   352     {
       
   353     iBody->iRequest = aRequest;
       
   354     }
       
   355 TInt CFsNotificationInfo::Function() 
       
   356     { return iBody->iFunction; }
       
   357 TInt CFsNotificationInfo::DriveNumber() 
       
   358     { return iBody->iDriveNumber; }
       
   359 TParsePtrC& CFsNotificationInfo::Source() 
       
   360     {
       
   361     switch(iBody->iFunction)
       
   362         {
       
   363         case EFsFormatNext:         //EParseSrc
       
   364         case EFsDismountFileSystem: //0
       
   365         case EFsMountFileSystem:    //0
       
   366         case EFsSetVolume:          //0
       
   367         case EFsSetDriveName:       //ESync
       
   368         case EFsRawDiskWrite:       //EParseSrc
       
   369         case EFsMountFileSystemScan:
       
   370             {
       
   371             _LIT(KFormatDrive,"?:");
       
   372             iBody->iSrcBuf = KFormatDrive;
       
   373             iBody->iSrcBuf[0] = TText(DriveNumber() + 'A');
       
   374             TParsePtrC parse(iBody->iSrcBuf);
       
   375             memcpy(&iBody->iSrc,&parse,sizeof(TParsePtrC));
       
   376             }
       
   377         }
       
   378     return iBody->iSrc;
       
   379     }
       
   380 TParsePtrC& CFsNotificationInfo::NewName() 
       
   381     { return iBody->iDest; }
       
   382 CFsRequest* CFsNotificationInfo::Request() 
       
   383     { return iBody->iRequest; }
       
   384 TInt64* CFsNotificationInfo::Data() 
       
   385     { return &iBody->iData; }
       
   386 TUid& CFsNotificationInfo::Uid()
       
   387     { return iBody->iUid; }
       
   388 TNotificationType& CFsNotificationInfo::NotificationType()
       
   389     { return iBody->iNotificationType; }
       
   390 TBool CFsNotificationInfo::DestDriveIsSet()
       
   391     { return iBody->iDestDriveStored; }
       
   392 TInt CFsNotificationInfo::SourceSize()
       
   393     {
       
   394     TInt size = Source().FullName().Size();
       
   395     if(NotificationType()!=TFsNotification::EMediaChange    &&
       
   396        NotificationType()!=TFsNotification::EDriveName      && 
       
   397        NotificationType()!=TFsNotification::EVolumeName)
       
   398         {
       
   399         size += sizeof(TText)*2;
       
   400         }
       
   401     return size;    
       
   402     }
       
   403 TInt CFsNotificationInfo::NewNameSize()
       
   404     {
       
   405     TInt size = NewName().FullName().Size();
       
   406     if(!DestDriveIsSet())
       
   407         size += sizeof(TText)*2;
       
   408     return size;  
       
   409     }
       
   410 
       
   411 //Get the path of the file, folder or drive name based on the TFsMessage function
       
   412 void CFsNotificationInfo::PathName(CFsClientMessageRequest& aRequest, TParsePtrC& aPath)
       
   413     {
       
   414     __PRINT(_L("CFsNotificationInfo::PathName"));
       
   415     //Get the notification type
       
   416     TInt function = aRequest.Operation()->Function();
       
   417     
       
   418     //Get the filename(s)
       
   419     switch(function)
       
   420         {
       
   421         case EFsFileWrite:          //EParseSrc | EFileShare
       
   422         case EFsFileSetSize:        //EParseSrc | EFileShare
       
   423         case EFsFileSetAtt:         //EParseDst | EParseSrc, - should not use these; has share.
       
   424         case EFsFileSet:            //EParseSrc | EFileShare
       
   425         case EFsFileSetModified:    //EParseSrc | EFileShare - new
       
   426         case EFsFileWriteDirty:     //EFileShare
       
   427             {
       
   428             CFileShare* share = NULL;
       
   429             CFileCB* file = NULL;
       
   430             GetFileFromScratch(&aRequest,share,file);
       
   431             TParsePtrC ptrC(file->iFileName->Des());
       
   432             memcpy(&aPath,&ptrC,sizeof(TParsePtrC));
       
   433             break;
       
   434             }
       
   435         case EFsFileCreate:         //EParseSrc
       
   436         case EFsFileTemp:           //EParseSrc - new
       
   437         case EFsDelete:             //EParseSrc
       
   438         case EFsSetEntry:           //EParseSrc,
       
   439         case EFsFileRename:         //EParseDst | EParseSrc,
       
   440         case EFsRename:             //EParseDst | EParseSrc,
       
   441         case EFsReplace:            //EParseDst | EParseSrc,
       
   442         case EFsFileReplace:        //EParseSrc
       
   443             {
       
   444             TParsePtrC parsePtrC(aRequest.Src().FullName().Mid(2)); //Don't want drive letter
       
   445             memcpy(&aPath,&parsePtrC,sizeof(TParsePtrC));
       
   446             break;
       
   447             }
       
   448         case EFsRmDir:              //EParseSrc
       
   449         case EFsMkDir:              //EParseSrc
       
   450             {
       
   451             TParsePtrC parsePtrC(aRequest.Src().Path());
       
   452             memcpy(&aPath,&parsePtrC,sizeof(TParsePtrC));
       
   453             break;
       
   454             
       
   455             //aPath.Set(aRequest.Src().DriveAndPath(),NULL,NULL);
       
   456             //break;
       
   457             }
       
   458         case EFsFormatNext:         //EParseSrc
       
   459         case EFsDismountFileSystem: //0
       
   460         case EFsMountFileSystem:    //0
       
   461         case EFsSetVolume:          //0
       
   462         case EFsSetDriveName:       //ESync
       
   463         case EFsRawDiskWrite:       //EParseSrc
       
   464         case EFsLockDrive:
       
   465         case EFsUnlockDrive:
       
   466         case EFsReserveDriveSpace:
       
   467         case EFsMountFileSystemScan:
       
   468             {
       
   469             break;
       
   470             }
       
   471         default:
       
   472             ASSERT(0);
       
   473             break;
       
   474         }
       
   475     }
       
   476 
       
   477 //Get the new path of the file, folder or drive name based on the TFsMessage function
       
   478 void CFsNotificationInfo::NewPathName(CFsClientMessageRequest& aRequest, TParsePtrC& aNewPath)
       
   479     {
       
   480     __PRINT(_L("CFsNotificationInfo::NewPathName"));
       
   481     //Get the notification type
       
   482     TInt function = aRequest.Operation()->Function();
       
   483 
       
   484     //Get the filename(s)
       
   485     switch(function)
       
   486         {
       
   487         case EFsFileRename:         //EParseDst | EParseSrc,
       
   488         case EFsRename:             //EParseDst | EParseSrc,
       
   489         case EFsReplace:            //EParseDst | EParseSrc,
       
   490             {
       
   491             //We must provide the drive letter too as in the case
       
   492             //of the file being monitored being renamed to a 
       
   493             //different drive.
       
   494             //In that case we need to provide the new drive letter to the client.
       
   495             TParsePtrC ptrC(aRequest.Dest().FullName());
       
   496             memcpy(&aNewPath,&ptrC,sizeof(TParsePtrC));
       
   497             break;
       
   498             }
       
   499         case EFsSetVolume:          //EParseDst
       
   500         case EFsSetDriveName:       //ESync | EParseDst
       
   501             {
       
   502             TParsePtrC ptrC(aRequest.Dest().FullName());
       
   503             memcpy(&aNewPath,&ptrC,sizeof(TParsePtrC));
       
   504             break;
       
   505             }
       
   506         default:
       
   507             {
       
   508             ASSERT(0);
       
   509             }
       
   510         }
       
   511     }
       
   512 
       
   513 //Get the size of the notification based on its type
       
   514 TInt CFsNotificationInfo::NotificationSize(CFsNotificationInfo& aRequest)
       
   515     {
       
   516     __PRINT(_L("CFsNotificationInfo::NotificationSize"));
       
   517     
       
   518     /*
       
   519      * If there are no new names, the order of the data in the buffer is:
       
   520      * Word1   : NotificationSize (2 bytes) , PathSize (2 bytes)
       
   521      * Word2   : NotificationType (Lower 2 bytes)
       
   522      * Word3   : UID
       
   523      * Word(s) : Path (TText8) , [Any sub-class members]
       
   524      * 
       
   525      * Else for notification types ERename, EVolumeName and EDriveName the order is:
       
   526      * Word1   : NotificationSize (2 bytes) , PathSize (2 bytes)
       
   527      * Word2   : NewNameSize (2 bytes) , NotificationType (2 bytes)
       
   528      * Word3   : UID
       
   529      * Word(s) : Path (TText8) , NewName (TText8)
       
   530      * 
       
   531      * EOverflow size: KNotificationHeaderSize
       
   532      */ 
       
   533     
       
   534     //Size of the filename +(with '<drive>:')
       
   535     TInt size = KNotificationHeaderSize + Align4(aRequest.SourceSize());
       
   536     
       
   537     switch(aRequest.NotificationType())
       
   538         {
       
   539         //NewName
       
   540         case TFsNotification::ERename:
       
   541         case TFsNotification::EVolumeName:
       
   542         case TFsNotification::EDriveName:
       
   543             {
       
   544             if(!aRequest.NewName().FullName().Length())
       
   545                 __ASSERT_ALWAYS(false,User::Panic(_L("CFsNotificationInfo::NotificationSize"),KErrArgument));
       
   546             
       
   547             size += Align4(aRequest.NewNameSize());
       
   548             break;
       
   549             }
       
   550         case TFsNotification::EFileChange:
       
   551             {
       
   552             size += sizeof(TInt64);
       
   553             break;
       
   554             }
       
   555         case TFsNotification::EAttribute:
       
   556             {
       
   557             size += sizeof(TUint64);
       
   558             break;
       
   559             }
       
   560         case TFsNotification::ECreate: 
       
   561         case TFsNotification::EDelete:
       
   562         case TFsNotification::EMediaChange:
       
   563             {
       
   564             break;
       
   565             }
       
   566         default:
       
   567             {
       
   568             ASSERT(0);
       
   569             break;
       
   570             }
       
   571         }
       
   572     return (TUint16) size;
       
   573     }
       
   574 
       
   575 
       
   576 TNotificationType CFsNotificationInfo::NotificationType(TInt& aIndex)
       
   577     {
       
   578     __PRINT(_L("CFsNotificationInfo::NotificationType(TInt)"));
       
   579     __ASSERT_DEBUG(aIndex < KNumRegisterableFilters, Fault(ENotificationFault));
       
   580     
       
   581     switch(aIndex) //No break statements here on purpose
       
   582         {
       
   583         case 7 : return TFsNotification::EMediaChange;
       
   584         case 6 : return TFsNotification::EDriveName;
       
   585         case 5 : return TFsNotification::EVolumeName;
       
   586         case 4 : return TFsNotification::EDelete;
       
   587         case 3 : return TFsNotification::EAttribute;
       
   588         case 2 : return TFsNotification::ECreate;
       
   589         case 1 : return TFsNotification::ERename;
       
   590         case 0 : return TFsNotification::EFileChange;
       
   591         default: ASSERT(0); return (TFsNotification::TFsNotificationType) 0;
       
   592         }
       
   593     }
       
   594 
       
   595 //Get the array index of the notification based on its type
       
   596 TInt CFsNotificationInfo::TypeToIndex(TNotificationType aType)
       
   597     {
       
   598     __PRINT(_L("CFsNotificationInfo::ArrayIndex"));
       
   599 
       
   600     TInt index = 0; 
       
   601     switch(aType) //No break statements here on purpose
       
   602         {
       
   603         case TFsNotification::EMediaChange: index++;
       
   604         case TFsNotification::EDriveName:   index++;
       
   605         case TFsNotification::EVolumeName:  index++;
       
   606         case TFsNotification::EDelete:      index++;
       
   607         case TFsNotification::EAttribute:   index++;
       
   608         case TFsNotification::ECreate:      index++;
       
   609         case TFsNotification::ERename:      index++;
       
   610         case TFsNotification::EFileChange:  // skip;
       
   611         default: break;
       
   612         }
       
   613     __ASSERT_DEBUG(index < KNumRegisterableFilters, Fault(ENotificationFault));
       
   614     return index;
       
   615     }
       
   616 
       
   617 TInt CFsNotificationInfo::DriveNumber(const TPtrC& aPath)
       
   618     {
       
   619     if(aPath.Length() >= 1)
       
   620         {
       
   621         TInt drive;
       
   622         TInt r = RFs::CharToDrive(aPath[0],drive);
       
   623         if(r!=KErrNone)
       
   624             return KErrNotFound;
       
   625         return drive;
       
   626         }
       
   627     return KErrNotFound;
       
   628     }
       
   629 
       
   630 //Get the attributes set and cleared
       
   631 void CFsNotificationInfo::Attributes(CFsMessageRequest& aRequest, TUint& aSet, TUint& aClear)
       
   632     {
       
   633     __PRINT(_L("CFsNotificationInfo::Attributes"));
       
   634 
       
   635     TInt function = aRequest.Operation()->Function();
       
   636     const RMessage2& msg = aRequest.Message();
       
   637 
       
   638     //Client notification
       
   639     switch(function)
       
   640         {
       
   641         case EFsFileSet:
       
   642             {
       
   643             aSet = msg.Int1();
       
   644             aClear = msg.Int2();
       
   645             break;
       
   646             }
       
   647         case EFsFileSetAtt:
       
   648             {
       
   649             aSet = msg.Int0();
       
   650             aClear = msg.Int1();
       
   651             break;
       
   652             }
       
   653         case EFsSetEntry:
       
   654             {
       
   655             aSet = msg.Int2();
       
   656             aClear = msg.Int3();
       
   657             break;
       
   658             }
       
   659         default:
       
   660             {
       
   661             ASSERT(0);
       
   662             break;
       
   663             }
       
   664         }
       
   665     }
       
   666 
       
   667 TInt64 CFsNotificationInfo::FileSize(CFsMessageRequest& aRequest)
       
   668     {
       
   669     CFileShare* share = NULL;
       
   670     CFileCB* file = NULL;
       
   671     GetFileFromScratch(&aRequest, share, file);
       
   672     TInt64 size = file->CachedSize64();
       
   673     return size;
       
   674     }
       
   675 
       
   676 
       
   677 void CFsNotificationInfo::SetData(CFsMessageRequest* aRequest, CFsNotificationInfo* aNotificationInfo)
       
   678     {
       
   679     TInt function = aRequest->Operation()->Function();
       
   680     
       
   681     switch(function)
       
   682         {
       
   683         case EFsFileWrite:
       
   684         case EFsFileWriteDirty:
       
   685         case EFsFileSetSize:
       
   686             {
       
   687             aNotificationInfo->SetFilesize(FileSize(*aRequest));
       
   688             break;
       
   689             }
       
   690         case EFsSetEntry:
       
   691         case EFsFileSetAtt:
       
   692         case EFsFileSet:
       
   693             {
       
   694             TUint set = 0;
       
   695             TUint clear = 0;
       
   696             Attributes(*aRequest,set,clear);
       
   697             *(aNotificationInfo->Data())= MAKE_TUINT64(set,clear);
       
   698             break;
       
   699             }
       
   700         default:
       
   701             {
       
   702             return;
       
   703             }
       
   704         }
       
   705     }
       
   706 
       
   707 TInt CFsNotificationInfo::ValidateNotification(CFsNotificationInfo& aNotificationInfo)
       
   708     {
       
   709     //Validate UID
       
   710     if(aNotificationInfo.Uid() == TUid::Null())
       
   711         {
       
   712         __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Uid not set"),KErrArgument));
       
   713         return KErrArgument;
       
   714         }
       
   715    
       
   716     switch(aNotificationInfo.Function())
       
   717         {
       
   718         case EFsFileWrite:
       
   719         case EFsFileWriteDirty:
       
   720         case EFsFileSetSize:
       
   721             {
       
   722             if(*aNotificationInfo.Data() == -1)
       
   723                 {
       
   724                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - File size not set"),KErrArgument));
       
   725                 return KErrArgument;
       
   726                 }
       
   727             if(!aNotificationInfo.Source().FullName().Length())
       
   728                 {
       
   729                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Source Name not set"),KErrArgument));
       
   730                 return KErrArgument;
       
   731                 }
       
   732             if(aNotificationInfo.NewName().FullName().Length())
       
   733                 {
       
   734                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - New Name set in err"),KErrArgument));
       
   735                 return KErrArgument;
       
   736                 }
       
   737             break;
       
   738             }
       
   739         case EFsRename:
       
   740         case EFsFileRename:
       
   741         case EFsReplace:
       
   742         case EFsSetVolume:
       
   743         case EFsSetDriveName:
       
   744             {
       
   745             if(!aNotificationInfo.Source().FullName().Length())
       
   746                 {
       
   747                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Source Name not set"),KErrArgument));
       
   748                 return KErrArgument;
       
   749                 }
       
   750             if(!aNotificationInfo.NewName().FullName().Length())
       
   751                 {
       
   752                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - New Name not set"),KErrArgument));
       
   753                 return KErrArgument;
       
   754                 }
       
   755             if(*aNotificationInfo.Data() != -1)
       
   756                 {
       
   757                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Data set in err"),KErrArgument));
       
   758                 return KErrArgument;
       
   759                 }
       
   760             break;
       
   761             }
       
   762         case EFsMkDir:
       
   763         case EFsFileCreate:
       
   764         case EFsFileReplace:
       
   765         case EFsDelete:
       
   766         case EFsRmDir:
       
   767             {
       
   768             if(!aNotificationInfo.Source().FullName().Length())
       
   769                 {
       
   770                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Source Name not set"),KErrArgument));
       
   771                 return KErrArgument;
       
   772                 }
       
   773             if(aNotificationInfo.NewName().FullName().Length())
       
   774                 {
       
   775                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - New Name set in err"),KErrArgument));
       
   776                 return KErrArgument;
       
   777                 }
       
   778             if(*aNotificationInfo.Data() != -1)
       
   779                 {
       
   780                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Data set in err"),KErrArgument));
       
   781                 return KErrArgument;
       
   782                 }
       
   783             break;
       
   784             }
       
   785         case EFsFileSetAtt:
       
   786         case EFsFileSet:
       
   787         case EFsSetEntry:
       
   788             {
       
   789             if(!aNotificationInfo.Source().FullName().Length())
       
   790                 {
       
   791                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Source Name not set"),KErrArgument));
       
   792                 return KErrArgument;
       
   793                 }
       
   794             if(*aNotificationInfo.Data() == -1)
       
   795                 {
       
   796                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Attributes not set"),KErrArgument));
       
   797                 return KErrArgument;
       
   798                 }
       
   799             if(aNotificationInfo.NewName().FullName().Length())
       
   800                 {
       
   801                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - New Name set in err"),KErrArgument));
       
   802                 return KErrArgument;
       
   803                 }               
       
   804             break;
       
   805             }
       
   806         case EFsDismountFileSystem:
       
   807         case EFsMountFileSystem:
       
   808         case EFsFormatNext:
       
   809         case EFsRawDiskWrite:
       
   810         case EFsMountFileSystemScan:
       
   811             {
       
   812             if(aNotificationInfo.NewName().FullName().Length())
       
   813                 {
       
   814                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - New Name set in err"),KErrArgument));
       
   815                 return KErrArgument;
       
   816                 }               
       
   817             if(aNotificationInfo.Source().FullName().Length())
       
   818                 {
       
   819                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Source Name set in err"),KErrArgument));
       
   820                 return KErrArgument;
       
   821                 }
       
   822             if(*aNotificationInfo.Data() != -1)
       
   823                 {
       
   824                 __ASSERT_DEBUG(false,User::Panic(_L("::ValidateNotification - Data set in err"),KErrArgument));
       
   825                 return KErrArgument;
       
   826                 }
       
   827             break;
       
   828             }
       
   829         default:
       
   830             {
       
   831             break;
       
   832             }
       
   833         }
       
   834     return KErrNone;
       
   835     }
       
   836 
       
   837 TUint CFsNotificationInfo::NotifyType(TInt aFunction)
       
   838 //
       
   839 //  Convert aFunction that caused the notification to a 
       
   840 //  value corresponding to the correct TNotifyType enum  
       
   841 //
       
   842     {
       
   843     switch (aFunction)
       
   844         {
       
   845         case EFsFileCreate:
       
   846         case EFsFileReplace:
       
   847         case EFsDelete:
       
   848         case EFsReplace:
       
   849         case EFsFileRename:
       
   850             return(ENotifyFile|ENotifyEntry);   
       
   851         case EFsMkDir:
       
   852         case EFsRmDir:
       
   853             return(ENotifyDir|ENotifyEntry);    
       
   854         case EFsRename:                 
       
   855             return(ENotifyDir|ENotifyFile|ENotifyEntry);                    
       
   856         case EFsSetVolume:                  
       
   857             return(ENotifyDisk|ENotifyEntry);   
       
   858         case EFsFileSet:
       
   859         case EFsFileSetAtt:
       
   860         case EFsFileSetModified:
       
   861         case EFsFileSetSize:
       
   862         case EFsSetEntry:
       
   863             return(ENotifyAttributes);  
       
   864         case EFsFileWrite:
       
   865         case EFsFileWriteDirty:
       
   866             return(ENotifyWrite);   
       
   867         case EFsRawDiskWrite:
       
   868         case EFsLockDrive:
       
   869         case EFsUnlockDrive:
       
   870             return(ENotifyDisk);    
       
   871         case EFsFileTemp:       
       
   872         case EFsSetDriveName:
       
   873             return(ENotifyAll); 
       
   874         default:
       
   875             return(0);
       
   876         }
       
   877     }
    26 
   878 
    27 void CNotifyInfo::Initialise(TInfoType aType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession)
   879 void CNotifyInfo::Initialise(TInfoType aType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession)
    28 //
   880 //
    29 //
   881 //
    30 //
   882 //
    65 	{
   917 	{
    66 	iChangeType=aChangeType;
   918 	iChangeType=aChangeType;
    67 	CNotifyInfo::Initialise(EStdChange,aStatus,aMessage,aSession);
   919 	CNotifyInfo::Initialise(EStdChange,aStatus,aMessage,aSession);
    68 	}
   920 	}
    69 
   921 
    70 TUint CStdChangeInfo::RequestNotifyType(CFsRequest* aRequest)
   922 TUint CStdChangeInfo::RequestNotifyType(CFsNotificationInfo* aRequest)
    71 //
   923 //
    72 // return notification type for the request
   924 // return notification type for the request
    73 //
   925 //
    74 	{
   926 	{
    75 	TUint notifyType=aRequest->Operation()->NotifyType();
   927     TUint notifyType=CFsNotificationInfo::NotifyType(aRequest->Function());
    76 	if(aRequest->Operation()->Function()==EFsRename)
   928     if(aRequest->Function()==EFsRename)
    77 		{
   929 		{
    78 		__ASSERT_DEBUG(notifyType==(ENotifyDir|ENotifyFile|ENotifyEntry),Fault(EStdChangeRequestType));
   930 		__ASSERT_DEBUG(notifyType==(ENotifyDir|ENotifyFile|ENotifyEntry),Fault(EStdChangeRequestType));
    79 		if(aRequest->Src().NamePresent())
   931         if(aRequest->Source().NamePresent())
    80 			notifyType=ENotifyFile|ENotifyEntry;
   932 			notifyType=ENotifyFile|ENotifyEntry;
    81 		else
   933 		else
    82 			notifyType=ENotifyDir|ENotifyEntry;
   934 			notifyType=ENotifyDir|ENotifyEntry;
    83 		}
   935 		}
    84 	return(notifyType);						
   936 	return(notifyType);						
    85 	}
   937 	}
    86 
   938 
    87 TBool CStdChangeInfo::IsMatching(CFsRequest* aRequest)
   939 
       
   940 TBool CStdChangeInfo::IsMatching(CFsNotificationInfo* aNotificationInfo)
    88 //
   941 //
    89 // return ETrue if operation type of request matches that of change notification
   942 // return ETrue if operation type of request matches that of change notification
    90 //
   943 //
    91 	{
   944     {
    92 	if((iChangeType&ENotifyAll) || (iChangeType&aRequest->Operation()->NotifyType()))
   945     if((iChangeType&ENotifyAll) || (iChangeType&CFsNotificationInfo::NotifyType(aNotificationInfo->Function())))
    93 		return(ETrue);
   946 		return(ETrue);
    94 	else
   947 	else
    95 		return(EFalse);
   948 		return(EFalse);
    96 	}
   949 	}
    97 
   950 
   105 	iChangeType=aChangeType;
   958 	iChangeType=aChangeType;
   106 	CNotifyInfo::Initialise(EExtChange,aStatus,aMessage,aSession);
   959 	CNotifyInfo::Initialise(EExtChange,aStatus,aMessage,aSession);
   107 	}
   960 	}
   108 
   961 
   109 
   962 
   110 TBool CExtChangeInfo::IsMatching(CFsRequest* aRequest)
   963 TBool CExtChangeInfo::IsMatching(CFsNotificationInfo* aRequest)
   111 //
   964 //
   112 // return ETrue if operation notify type of request matches that of change notification
   965 // return ETrue if operation notify type of request matches that of change notification
   113 // and paths match
   966 // and paths match
   114 //
   967 //
   115 	{
   968     {
   116 	TInt function=aRequest->Operation()->Function();
   969     TInt function=aRequest->Function();
   117 	//	if a rename occurred inform any requests if their path has been changed regardless of the notification type
   970 	//	if a rename occurred inform any requests if their path has been changed regardless of the notification type
   118 	if(function==EFsRename)				
   971 	if(function==EFsRename)				
   119 		{		
   972 		{		
   120 		TBuf<KMaxFileName> renamePath=aRequest->Src().FullName().Mid(2);		
   973         TBuf<KMaxFileName> renamePath=aRequest->Source().FullName();        
   121 		renamePath+=_L("*");
   974 		renamePath+=_L("*");
   122 		if (iName.MatchF(renamePath)!=KErrNotFound)	
   975 		if (iName.MatchF(renamePath)!=KErrNotFound)	
   123 			return(ETrue);
   976 			return(ETrue);
   124 		}
   977 		}
   125 
   978 
   126 
   979 
   127 	//Special case where the dir the notifier is setup on has just been created
   980 	//Special case where the dir the notifier is setup on has just been created
   128 	if(function==EFsMkDir)	
   981 	if(function==EFsMkDir)	
   129 		{		
   982 		{		
   130 		TInt notDrive;
   983         if(aRequest->Source().Path().MatchF(iName) == 0)
   131 		RFs::CharToDrive(aRequest->Src().Drive()[0],notDrive);	//can not fail as the drive letter has been parsed already
       
   132 		if(aRequest->Src().Path().MatchF(iName) == 0 && aRequest->DriveNumber() == notDrive)
       
   133 			return ETrue;
   984 			return ETrue;
   134 		}
   985 		}
   135 	
   986 	
   136 	//Special case where  the File the notifier is setup on has just been created by temp as the name is not known unti it has been created
   987 	//Special case where  the File the notifier is setup on has just been created by temp as the name is not known until it has been created
   137 	if(function==EFsRename||function==EFsFileOpen||function==EFsFileCreate||function==EFsFileReplace)
   988 	if(function==EFsRename||function==EFsFileOpen||function==EFsFileCreate||function==EFsFileReplace)
   138 		{
   989 		{
   139 		TInt notDrive;
   990         if(aRequest->Source().FullName().MatchF(iName) == 0)
   140 		RFs::CharToDrive(aRequest->Src().Drive()[0],notDrive);	//can not fail as the drive letter has been parsed already
       
   141 		if(aRequest->Src().FullName().Mid(2).MatchF(iName) == 0 && aRequest->DriveNumber() == notDrive)
       
   142 			return ETrue;
   991 			return ETrue;
   143 		}
   992 		}
   144 	
   993 	
   145 	//For the case of a file created using EFsFileTemp we can probably ignore it for special cases as it 
   994 	//For the case of a file created using EFsFileTemp we can probably ignore it for special cases as it 
   146 	//is created with a random name. Not specifically going to be being looked for
   995 	//is created with a random name. Not specifically going to be being looked for
   160 			case EFsFileSetSize:
  1009 			case EFsFileSetSize:
   161 			{
  1010 			{
   162 			TBuf<KMaxFileName> root=iName;
  1011 			TBuf<KMaxFileName> root=iName;
   163 			root+=_L("*");	
  1012 			root+=_L("*");	
   164 			
  1013 			
   165 			// NB share may be NULL if file server has initiated a flush of the file cache
  1014                 if (aRequest->Source().FullName().MatchF(root) != KErrNotFound)
   166 			CFileShare* share;
  1015                     {
   167 			CFileCB* fileCache;
  1016                     return(ETrue);
   168 			GetFileFromScratch(aRequest, share, fileCache);
  1017                     }
   169 			if (share && share->File().FileName().MatchF(root) != KErrNotFound)
       
   170 				return(ETrue);
       
   171 
       
   172 			}
  1018 			}
   173 			break;
  1019 			break;
   174 			case EFsSetDriveName:
  1020 			case EFsSetDriveName:
   175 			case EFsSetVolume:
  1021 			case EFsSetVolume:
   176 			case EFsRawDiskWrite:
  1022 			case EFsRawDiskWrite:
   184 			default:
  1030 			default:
   185 				{	
  1031 				{	
   186 				TBuf<KMaxFileName> root = iName;
  1032 				TBuf<KMaxFileName> root = iName;
   187 				root+=_L("*");	
  1033 				root+=_L("*");	
   188 				
  1034 				
   189 				if(aRequest->Src().FullName().Mid(2).MatchF(root)!=KErrNotFound)
  1035                 if(aRequest->Source().FullName().MatchF(root)!=KErrNotFound)
   190 					return(ETrue);	
  1036 					return(ETrue);	
   191 				else if(function==EFsRename||function==EFsReplace||function==EFsFileRename)
  1037 				else if(function==EFsRename||function==EFsReplace||function==EFsFileRename)
   192 					{
  1038 					{
   193 					// - rename/replace causes the file/path to disappear
  1039 					// - rename/replace causes the file/path to disappear
   194 					if(aRequest->Dest().FullName().Mid(2).MatchF(root)!=KErrNotFound)
  1040 				    TPtrC newName;
       
  1041 				    if(aRequest->DestDriveIsSet())
       
  1042 				        newName.Set(aRequest->NewName().FullName().Mid(2));
       
  1043 				    else
       
  1044 				        newName.Set(aRequest->NewName().FullName());
       
  1045                     if(newName.MatchF(root)!=KErrNotFound)
   195 						{
  1046 						{
   196 						return(ETrue);
  1047 						return(ETrue);
   197 						}
  1048 						}
   198 
  1049 
   199 					// - rename/replace causes the file/path to arrive
  1050 					// - rename/replace causes the file/path to arrive
   200 					root=aRequest->Dest().FullName().Mid(2);
  1051                     if(aRequest->DestDriveIsSet())
       
  1052                         root=aRequest->NewName().FullName().Mid(2);
       
  1053                     else
       
  1054                         root=aRequest->NewName().FullName();
   201 					root+=_L("*");
  1055 					root+=_L("*");
   202 
  1056 
   203 					if (iName.MatchF(root)!=KErrNotFound)
  1057 					if (iName.MatchF(root)!=KErrNotFound)
   204 						{
  1058 						{
   205 						return(ETrue);
  1059 						return(ETrue);
   414 	iQLock.Wait();
  1268 	iQLock.Wait();
   415 	TBaseQue::DoCancelAll(aCompletionCode);
  1269 	TBaseQue::DoCancelAll(aCompletionCode);
   416 	iQLock.Signal();
  1270 	iQLock.Signal();
   417 	}
  1271 	}
   418 
  1272 
   419 void TChangeQue::CheckChange(CFsRequest* aRequest)
  1273 void TChangeQue::CheckChange(CFsNotificationInfo& aRequest)
   420 //
  1274 //
   421 // complete any notification in que that matches aRequest
  1275 // complete any notification in que that matches aRequest
   422 //
  1276 //
   423 	{
  1277 	{
   424 	iQLock.Wait();
  1278 	iQLock.Wait();
   427 	while((info=q++)!=NULL)
  1281 	while((info=q++)!=NULL)
   428 		{
  1282 		{
   429 		__ASSERT_DEBUG(info->Type()==CNotifyInfo::EStdChange||info->Type()==CNotifyInfo::EExtChange,Fault(EChangeQueType));
  1283 		__ASSERT_DEBUG(info->Type()==CNotifyInfo::EStdChange||info->Type()==CNotifyInfo::EExtChange,Fault(EChangeQueType));
   430 		TBool isMatching;
  1284 		TBool isMatching;
   431 		if(info->Type()==CNotifyInfo::EStdChange)
  1285 		if(info->Type()==CNotifyInfo::EStdChange)
   432 			isMatching=((CStdChangeInfo*)info)->IsMatching(aRequest);
  1286 			isMatching=((CStdChangeInfo*)info)->IsMatching(&aRequest);
   433 		else
  1287 		else
   434 			isMatching=((CExtChangeInfo*)info)->IsMatching(aRequest);
  1288 			isMatching=((CExtChangeInfo*)info)->IsMatching(&aRequest);
   435 		if(isMatching)
  1289 		if(isMatching)
   436 			{
  1290 			{
   437 			__PRINT1(_L("TChangeQue::CheckChange()-Matching info=0x%x"),info);
  1291 			__PRINT1(_L("TChangeQue::CheckChange()-Matching info=0x%x"),info);
   438 			info->Complete(KErrNone);
  1292 			info->Complete(KErrNone);
   439 			delete(info);
  1293 			delete(info);
   840 	__PRINT1(_L("FsNotify::AddDismountNotify() info=0x%x"),aDismountNotifyInfo);
  1694 	__PRINT1(_L("FsNotify::AddDismountNotify() info=0x%x"),aDismountNotifyInfo);
   841 	iDismountNotifyQue.AddNotify(aDismountNotifyInfo);
  1695 	iDismountNotifyQue.AddNotify(aDismountNotifyInfo);
   842 	return(KErrNone);
  1696 	return(KErrNone);
   843 	}
  1697 	}
   844 
  1698 
   845 void FsNotify::HandleChange(CFsRequest* aRequest,TInt aDrive)
  1699 
       
  1700 void FsNotify::HandleChange(CFsNotificationInfo& aNotificationInfo)
   846 //
  1701 //
   847 // Check whether any change notifications need to be completed due to aRequest on aDrive
  1702 // Check whether any change notifications need to be completed due to aRequest on aDrive
   848 //
  1703 //
   849 	{
  1704     {
   850 	__PRINT2(_L("FsNotify::HandleChange() aRequest=0x%x, aDrive=%d"),aRequest,aDrive);
  1705     __PRINT1(_L("FsNotify::HandleChange(TFsNotificationInfo) DriveNumber=%d"),aNotificationInfo.DriveNumber());
   851 	if(!aRequest->IsChangeNotify())
  1706     if(aNotificationInfo.Request() && !aNotificationInfo.Request()->IsChangeNotify())
   852 		return;
  1707         return;
   853 	iChangeQues[ChangeIndex(aDrive)].CheckChange(aRequest);
  1708     iChangeQues[ChangeIndex(aNotificationInfo.DriveNumber())].CheckChange(aNotificationInfo);
   854 	iChangeQues[ChangeIndex(KDriveInvalid)].CheckChange(aRequest);
  1709     iChangeQues[ChangeIndex(KDriveInvalid)].CheckChange(aNotificationInfo);
   855 	}
  1710     }
   856 	
  1711 	
   857 
  1712 
   858 void FsNotify::HandleDiskSpace(CFsRequest* aRequest,TInt aDrive)
  1713 void FsNotify::HandleDiskSpace(CFsRequest* aRequest,TInt aDrive)
   859 //
  1714 //
   860 // Check whether any disk space notifications need to be completed due to aRequest on aDrive
  1715 // Check whether any disk space notifications need to be completed due to aRequest on aDrive