Exemplo n.º 1
0
void CDialogTimeout::RunL()
{
	DEBUG_LOG(_L("CKmdDialog timeout occurred"));
    TInt delete_dialog    = 1;
    CIkev1Dialog* NextDialog = iDialog->NextDialog();
	MIkeDialogComplete* Callback = iDialog->Callback();
    
    if ( Callback ) 
    {
		TInt err;
		DEBUG_LOG2(_L("Calling DialogCompleteL(), UserInfo = %x, Callback = %x"), (TUint32)iDialog->UserInfo(), (TUint32)Callback);					
        TRAP(err, delete_dialog = Callback->DialogCompleteL(iDialog,
                                                            iDialog->UserInfo(),
                                                            NULL,               //User name
                                                            NULL,               //Password
                                                            NULL));             //domain
		DEBUG_LOG2(_L("DialogCompleteL() completed, err = %d, delete_dialog = %d"), err, delete_dialog);			
		if ( err != KErrNone )
			delete_dialog = 1;
    }  
    if ( delete_dialog )
        {
        delete iDialog;
        iDialog = NULL;
        }

    //
    //  Start a dialog from wait queue if there is some 
    //
    if ( NextDialog )
	{
	   DEBUG_LOG(_L("Next dialog started from dialog timer"));	
       NextDialog->StartDialogL();
	}    
}
Exemplo n.º 2
0
/*! *************************************************************************
 * Function Name : InodeUtilCorruptAndRecover 
 *
 * Author        : Anusha Seshadri 
 *
 * Description   : This Function is used to manually corrupt and fix an inode.
 *
 * Input         : u4InodeNo    -   Inode to corrupt/fix
 *                 u4Cmd    -  INODE_CORRUPT  to corrupt
 *                             INODE_FIX to fix
 * Output        : None
 * 
 * Returns       : INODE_SUCCESS 
 *                 INODE_FAILURE
 *
 **************************************************************************/
INT4 InodeUtilCorruptAndRecover(UINT4 u4InodeNo, UINT4 u4Cmd)
{
    /*
       1. Get inode offset
       2. Read Inode
       3. Goto i_block[0] and flip bits say 1, 3 & 5
     */
    UINT4 u4iBlock0;
    UINT8 u8Offset = 0;
    INT4 i4RetVal;
    UINT4 u4Index = 0;

    InodeUtilGetInodeOffset(u4InodeNo, &u8Offset); /* offset for inode; */

    u8Offset = u8Offset + DIRECT_BLOCK_OFFSET;     /* offset for i_block[0] */

    i4RetVal = InodeUtilReadDataOffset(u8Offset, &u4iBlock0,
            sizeof(UINT4));
    if (i4RetVal == INODE_FAILURE)
    {
        DEBUG_LOG2("ERROR: Failed to read Block group descriptor table %s:%d\n", __FILE__, __LINE__);
        return INODE_FAILURE;
    }

    u4Index = InodeUtilCheckCorruptedInode(u4InodeNo);
    if((u4Index != INODE_FAILURE) &&
            (u4Cmd == INODE_CORRUPT))/* corruption intended, but already corrupted */
    {

        printf(" Inode already corrupted\n");
    }
    else if((u4Index == INODE_FAILURE) &&
            (u4Cmd == INODE_FIX))/* fix intended, but not corrupted already */
    {
        printf(" Nothing to fix\n");
    }
    else
    {
        /* flip bits on u4iBlock0 */
        u4iBlock0 = u4iBlock0 ^ CORR_FIX_MASK;  /* flipping bits 1,3,5 of LSB ie., 
                                          masking 00010101 to any of the address */
        /* write changes */
        i4RetVal = InodeUtilWriteDataOffset(u8Offset, &u4iBlock0, sizeof (UINT4));
        if(i4RetVal == SYS_CALL_FAILURE)
        {
            DEBUG_LOG2("ERROR: Failed to write back original data  %s:%d\n", __FILE__, __LINE__);
            return INODE_FAILURE;
        }

        if (u4Cmd == INODE_CORRUPT)
        {
            gu4CorruptedArray[++gi4ArrayIndex] = u4InodeNo;
        }
        else
        {
            gu4CorruptedArray[u4Index] = 0;
        }
    }
    return INODE_SUCCESS;
}
Exemplo n.º 3
0
/*! *************************************************************************
 * Function Name : InodeUtilReadDataBlock 
 *
 * Author        : Naveen Raj Selvaraj
 *
 * Description   : This Function is used to read a file system block 
 *
 * Input         : u4BlockNo    -   Block number to read
 *                 u4Size       -   size of data to read in bytes
 *
 * Output        : pBuffer      -   Buffer containg the contents of the block
 * 
 * Returns       : INODE_SUCCESS, if the read succeeds
 *                 INODE_FAILURE otherwise
 *
 **************************************************************************/
INT4 InodeUtilReadDataBlock(UINT4 u4BlockNo, UINT2 u2StartPos, VOID *pBuffer, UINT4 u4Size)
{
    UINT8 u8Offset;
    INT4 i4RetVal;

    u8Offset = ((UINT8)gu4BlockSize * u4BlockNo) + u2StartPos;
    i4RetVal = 0;

    /* Read the contents of the data block */
    if (lseek64(gu4FileDes, u8Offset, SEEK_SET) == SYS_CALL_FAILURE)
    {
        DEBUG_LOG2("ERROR: lseek error %s:%d\n", __FILE__, __LINE__);
        return INODE_FAILURE;
    }

    /* Read the block */
    i4RetVal = read(gu4FileDes, pBuffer, u4Size); 
    if (i4RetVal == SYS_CALL_FAILURE)
    {
        DEBUG_LOG2("ERROR: read error %s:%d\n", __FILE__, __LINE__);
        return INODE_FAILURE;
    }

    return INODE_SUCCESS;
}
Exemplo n.º 4
0
// ---------------------------------------------------------------------------
// From class CActive
// Handles completion of progress notification.
// ---------------------------------------------------------------------------
//
void CConnObserver::RunL()
    {
    DEBUG_LOG2( _L("CConnObserver::RunL(), iStatus=%d, error=%d"),
            iStatus.Int(), iProgressBuf().iError );
    TInt status = iStatus.Int();
    if ( status == KErrNone )
        {
        status = iProgressBuf().iError;
        }
    
    iCallback.LinkDisconnected( status );
    }
Exemplo n.º 5
0
/*--------------------------------------------------------------------
 *
 *  Get user name and Secure ID next pin data for Legacy authentication
 *
 *---------------------------------------------------------------------*/
void CIkev1Dialog::GetAsyncSecureNextPinDialogL(TAny *aUserInfo,  MIkeDialogComplete* aCallback)
{
	DEBUG_LOG2(_L("CIkev1Dialog::GetAsyncSecureNextPinDialogL(), aUserInfo =  %x, aCallback = %x"), aUserInfo, aCallback);
	
    iDialogType = TKMDDialog::ESecurIdNextPin;
    iUserInfo   = aUserInfo;
    iCallback   = aCallback; // For asynchronous dialog RunL
    
	TIPSecDialogInfo dialog_input(TKMDDialog::ESecurIdNextPin, 0);		
	iInputData = CreateDialogInput(dialog_input, ETrue);// TRUE = Use user name cache    	
    if ( iInputData )
       LaunchDialogL();   //launch the dialog
}
Exemplo n.º 6
0
DMAD_EXPORT_C void CDmAdEngine::FetchLeafObjectL(const TDesC8& aUri, const TDesC8& aLuid, 
                                                 const TDesC8& aType, TInt aResultsRef, TInt aStatusRef)
    {
    TRACE("CDmAdEngine::FetchLeafObjectL");
    
    DEBUG_LOG1(_L8("aUri %S"), &aUri);
    DEBUG_LOG1(_L8("aLuid %S"), &aLuid);
    DEBUG_LOG1(_L8("aType %S"), &aType);
    DEBUG_LOG2(_L("aResultsRef = %d, aStatusRef = %d"), aResultsRef, aStatusRef);
        
    TPtrC8 uri(TDmAdUtil::RemoveDotSlash(aUri));
    TRAPD(err, DoFetchLeafObjectL(uri, aLuid, aType, aResultsRef, aStatusRef));
    if (err != KErrNone)
        {
        iCallBack->SetStatusL(aStatusRef, err);
        }
    }
Exemplo n.º 7
0
DMAD_EXPORT_C void CDmAdEngine::ChildURIListL(const TDesC8& aUri, const TDesC8& aParentLuid, 
                                              const CArrayFix<TSmlDmMappingInfo>& aPreviousUriSegmentList, 
                                              TInt aResultsRef, TInt aStatusRef)
    {
    TRACE("CDmAdEngine::ChildURIListL");

    DEBUG_LOG1(_L8("aUri %S"), &aUri);
    DEBUG_LOG1(_L8("aParentLuid %S"), &aParentLuid);
    DEBUG_LOG2(_L("aResultsRef = %d, aStatusRef = %d"), aResultsRef, aStatusRef);
    
    
    TPtrC8 uri(TDmAdUtil::RemoveDotSlash(aUri));
    TRAPD(err, DoChildUriListL(uri, aParentLuid, aPreviousUriSegmentList, aResultsRef, aStatusRef));
    if (err != KErrNone)
        {
        iCallBack->SetStatusL(aStatusRef, err);
        }
    }
Exemplo n.º 8
0
/*! *************************************************************************
 * Function Name : InodeUtilGetInodeOffset 
 *
 * Author        : Naveen Raj Selvaraj
 *
 * Description   : This Function is used to convert the given inode number into
 *                 byte offset
 *
 * Input         : u4InodeNo    -   Inode number
 *
 * Output        : pu8Offset    -   byte offset 
 * 
 * Returns       : INODE_SUCCESS, if the byte offset can be calculated 
 *                 INODE_FAILURE otherwise
 *
 **************************************************************************/
INT4 InodeUtilGetInodeOffset(UINT4 u4InodeNo, UINT8 *pu8Offset)
{
    struct ext3_inode Inode;
    struct ext3_group_desc GroupDes;
    UINT4 u4GroupNo;
    UINT4 u4LocalInodeIndex;
    INT4 i4RetVal;
    UINT8 u8GbdOffset;

    memset(&Inode, 0, sizeof(Inode));
    memset(&GroupDes, 0, sizeof(GroupDes));
    i4RetVal = 0;
    u8GbdOffset = 0;

    /* Find the block group no. corresponding to this inode */
    u4GroupNo = (u4InodeNo - 1) / sb.s_inodes_per_group; 

    /* Find the local inode index */
    u4LocalInodeIndex = (u4InodeNo - 1) % sb.s_inodes_per_group;

    /* 
       1. Seek and Read the block group descriptor for u4GroupNo
       2. Identify the inode table location from the group descriptor
    */
    u8GbdOffset = gu4BlockSize + u4GroupNo * sizeof(struct ext3_group_desc);
    i4RetVal = InodeUtilReadDataOffset(u8GbdOffset, &GroupDes, sizeof(struct ext3_group_desc));
    if (i4RetVal == INODE_FAILURE)
    {
        DEBUG_LOG2("ERROR: Failed to read Block group descriptor table %s:%d\n", __FILE__, __LINE__);
        return INODE_FAILURE;
    }

    /* Inode table block no. is identified for this group no.
       Seek to this block and get offset */
    *pu8Offset = ((UINT8) GroupDes.bg_inode_table * gu4BlockSize) + (u4LocalInodeIndex *
           sb.s_inode_size); 

    /* printf("Inode no %d has offset %u\n", u4InodeNo, u8Offset); */
    return INODE_SUCCESS;
}
Exemplo n.º 9
0
DMAD_EXPORT_C void CDmAdEngine::FetchLeafObjectSizeL(const TDesC8& aUri,
                                                     const TDesC8& aLuid,
                                                     const TDesC8& aType,
                                                     TInt aResultsRef,
                                                     TInt aStatusRef)
    {
    TRACE("CDmAdEngine::FetchLeafObjectSizeL");
        
    DEBUG_LOG1(_L8("aUri %S"), &aUri);
    DEBUG_LOG1(_L8("aLuid %S"), &aLuid);
    DEBUG_LOG1(_L8("aType %S"), &aType);
    DEBUG_LOG2(_L("aResultsRef = %d, aStatusRef = %d"), aResultsRef, aStatusRef);
    
    TPtrC8 uri(TDmAdUtil::RemoveDotSlash(aUri));
    TInt status = KErrNone;
    CBufBase* object = 0;
    TRAPD(err, status = DoFetchLeafObjectL(uri, aLuid, aType, object));
    if (err != KErrNone)
        {
        iCallBack->SetStatusL(aStatusRef, err);
        return;
        }
    if (status != KErrNone)
        {
        delete object;
        iCallBack->SetStatusL(aStatusRef, status);
        return;
        }
    
    CleanupStack::PushL(object);
    TInt objSizeInBytes = object->Size();
    HBufC8* sizeBuf = TDmAdUtil::IntToDes8LC(objSizeInBytes);
    object->Reset();
    object->InsertL(0, *sizeBuf);
        
    iCallBack->SetResultsL(aResultsRef, *object, aType);
    iCallBack->SetStatusL(aStatusRef, status);
    CleanupStack::PopAndDestroy(2); //sizeBuf, object
    }
Exemplo n.º 10
0
DMAD_EXPORT_C void TDmAdUtil::BuildRtNodeChildUriListL(MDmAdCallBack*                          aDmAdCallBack,
                                                  MDmAdStoreApi*                          aStoreApi,
                                                  const TDesC8&                           aUri,
                                                  const TDesC8&                           aParentLuid,
                                                  const CArrayFix<TSmlDmMappingInfo>&     aPreviousUriSegmentList,
                                                  CBufBase&                               aCurrentList)
    {
#ifdef DMAD_DUMP_PREVIOUS_URI_SEGMENT_LIST
        DEBUG_LOG(_L("BuildRtNodeChildUriListL:"));
        {
        for (TInt i=0; i < aPreviousUriSegmentList.Count(); i++)
            {
            const TSmlDmMappingInfo& mappingInfo = aPreviousUriSegmentList.At(i);
                        
            DEBUG_LOG1(_L("entry %d:"), i);            
            DEBUG_LOG1(_L8("Uri: %S"), &(mappingInfo.iURISeg));
            DEBUG_LOG_HEX(mappingInfo.iURISegLUID);
            
            }
        }
#endif

    RPointerArray<HBufC8> luidList;
    CleanupStack::PushL(TCleanupItem(PointerArrayCleanup, &luidList));
    
    aStoreApi->LuidListL(aUri, aParentLuid, luidList);


    // Finds largest number used in cli<x> named nodes.
    TInt largest = FindLargestLocallyCreated(aPreviousUriSegmentList);
    DEBUG_LOG1(_L("largest is cli%d"), largest);
    
    TInt countLuidList = luidList.Count();
    for (TInt j=0; j < countLuidList; j++)
        {
        const HBufC8* luidElem = luidList[j];

        HBufC8* uriSeg = 0;
        
        //Tries to find the luid from the aPreviousUriSegmentList
        for (TInt i=0; i < aPreviousUriSegmentList.Count(); i++)
            {
            const TSmlDmMappingInfo& mappingInfo = aPreviousUriSegmentList.At(i);
                        
            if (mappingInfo.iURISegLUID.Compare(*luidElem) == 0)
                {            
                uriSeg = mappingInfo.iURISeg.AllocLC();
                break;
                }
            }
        
        if (uriSeg == 0)
            {
            //Uri was not found from the aPreviousUriSegmentList
            uriSeg = BuildLocallyCreatedRtNodeUriSegLC(largest);
            
            DEBUG_LOG2(_L8("uriSeg %S, largest %d"), uriSeg, largest);
            
            HBufC8* wholeUri = TDmAdUtil::BuildUriLC(aUri, *uriSeg);            
            aDmAdCallBack->SetMappingL(*wholeUri, *luidElem);
            CleanupStack::PopAndDestroy(); //wholeUri
            }

        //If this is not the first element, inserts slash at the beginning
        //of the result list.
        if (j > 0)
            {            
            aCurrentList.InsertL(aCurrentList.Size(), KDmAdSeparator);
            }
        aCurrentList.InsertL(aCurrentList.Size(), *uriSeg);
        
        CleanupStack::PopAndDestroy(); // uriSeg
        }
    
    CleanupStack::PopAndDestroy(); //luidList
    }
Exemplo n.º 11
0
Arquivo: screen.c Projeto: rasilon/vim
static int scrollrect(VTermRect rect, int downward, int rightward, void *user)
{
  VTermScreen *screen = user;

  if(screen->damage_merge != VTERM_DAMAGE_SCROLL) {
    vterm_scroll_rect(rect, downward, rightward,
        moverect_internal, erase_internal, screen);

    vterm_screen_flush_damage(screen);

    vterm_scroll_rect(rect, downward, rightward,
        moverect_user, erase_user, screen);

    return 1;
  }

  if(screen->damaged.start_row != -1 &&
     !rect_intersects(&rect, &screen->damaged)) {
    vterm_screen_flush_damage(screen);
  }

  if(screen->pending_scrollrect.start_row == -1) {
    screen->pending_scrollrect = rect;
    screen->pending_scroll_downward  = downward;
    screen->pending_scroll_rightward = rightward;
  }
  else if(rect_equal(&screen->pending_scrollrect, &rect) &&
     ((screen->pending_scroll_downward  == 0 && downward  == 0) ||
      (screen->pending_scroll_rightward == 0 && rightward == 0))) {
    screen->pending_scroll_downward  += downward;
    screen->pending_scroll_rightward += rightward;
  }
  else {
    vterm_screen_flush_damage(screen);

    screen->pending_scrollrect = rect;
    screen->pending_scroll_downward  = downward;
    screen->pending_scroll_rightward = rightward;
  }

  vterm_scroll_rect(rect, downward, rightward,
      moverect_internal, erase_internal, screen);

  if(screen->damaged.start_row == -1)
    return 1;

  if(rect_contains(&rect, &screen->damaged)) {
    /* Scroll region entirely contains the damage; just move it */
    vterm_rect_move(&screen->damaged, -downward, -rightward);
    rect_clip(&screen->damaged, &rect);
  }
  /* There are a number of possible cases here, but lets restrict this to only
   * the common case where we might actually gain some performance by
   * optimising it. Namely, a vertical scroll that neatly cuts the damage
   * region in half.
   */
  else if(rect.start_col <= screen->damaged.start_col &&
          rect.end_col   >= screen->damaged.end_col &&
          rightward == 0) {
    if(screen->damaged.start_row >= rect.start_row &&
       screen->damaged.start_row  < rect.end_row) {
      screen->damaged.start_row -= downward;
      if(screen->damaged.start_row < rect.start_row)
        screen->damaged.start_row = rect.start_row;
      if(screen->damaged.start_row > rect.end_row)
        screen->damaged.start_row = rect.end_row;
    }
    if(screen->damaged.end_row >= rect.start_row &&
       screen->damaged.end_row  < rect.end_row) {
      screen->damaged.end_row -= downward;
      if(screen->damaged.end_row < rect.start_row)
        screen->damaged.end_row = rect.start_row;
      if(screen->damaged.end_row > rect.end_row)
        screen->damaged.end_row = rect.end_row;
    }
  }
  else {
    DEBUG_LOG2("TODO: Just flush and redo damaged=" STRFrect " rect=" STRFrect "\n",
        ARGSrect(screen->damaged), ARGSrect(rect));
  }

  return 1;
}