ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

Flushes all Write cache buffers with no active Handles.

Parameters:
pIomanIOMAN Object.
Returns:
FF_ERR_NONE on Success.

Definition at line 297 of file ff_ioman.c.

Referenced by FF_Close(), FF_CreateFile(), FF_MkDir(), FF_Move(), FF_RmDir(), FF_RmFile(), FF_Seek(), and FF_UnmountPartition().

                                         {

    FF_T_UINT16 i,x;

    if(!pIoman) {
        return FF_ERR_NULL_POINTER | FF_FLUSHCACHE;
    }

    FF_PendSemaphore(pIoman->pSemaphore);
    {
        for(i = 0; i < pIoman->CacheSize; i++) {
            if((pIoman->pBuffers + i)->NumHandles == 0 && (pIoman->pBuffers + i)->Modified == FF_TRUE) {

                FF_BlockWrite(pIoman, (pIoman->pBuffers + i)->Sector, 1, (pIoman->pBuffers + i)->pBuffer);

                // Buffer has now been flushed, mark it as a read buffer and unmodified.
                (pIoman->pBuffers + i)->Mode = FF_MODE_READ;
                (pIoman->pBuffers + i)->Modified = FF_FALSE;

                // Search for other buffers that used this sector, and mark them as modified
                // So that further requests will result in the new sector being fetched.
                for(x = 0; x < pIoman->CacheSize; x++) {
                    if(x != i) {
                        if((pIoman->pBuffers + x)->Sector == (pIoman->pBuffers + i)->Sector && (pIoman->pBuffers + x)->Mode == FF_MODE_READ) {
                            (pIoman->pBuffers + x)->Modified = FF_TRUE;
                        }
                    }
                }
            }
        }
    }
    FF_ReleaseSemaphore(pIoman->pSemaphore);

    return FF_ERR_NONE;
}

Generated on Sat May 26 2012 05:55:59 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.