filehash/ffdb_pagepool.c
static int
_ffdb_pagepool_write(ffdb_pagepool_t* pgp, 
		     ffdb_bkt_t* bp)
{
  off_t offset;
  int nbytes;
  int ret = 0;

#ifdef _FFDB_STATISTICS
  ++pgp->pagewrite;
#endif

  /* Run through the user's filter. */
  if (pgp->pgout)
    (pgp->pgout)(pgp->pgcookie, bp->pgno, bp->page);

  offset =  (off_t)pgp->pagesize * bp->pgno;

  if (lseek(pgp->fd, offset, SEEK_SET) != offset) 
    ret = -1;
  else {
    if ((nbytes = write(pgp->fd, bp->page, pgp->pagesize)) != pgp->pagesize) 
      ret = -1;
  }

  if (ret == 0)
    FFDB_FLAG_CLR(bp->flags, FFDB_PAGE_DIRTY);

  /* Update how many pages this file holds now */
  if (bp->pgno >= pgp->npages) {
    pgp->npages = bp->pgno + 1;
  }

  return ret;
}
/*
 * _ffdb_pagepool_write
 *	Write a dirty page to disk.
 * This routine is called with page being locked
 */
_ffdb_pagepool_write
Write a dirty page to disk.
This routine is called with page being locked
_ffdb_pagepool_write Write a dirty page to disk . This routine is called with page being locked
static int
_ffdb_pagepool_write(ffdb_pagepool_t* pgp, 
		     ffdb_bkt_t* bp)
{
  off_t offset;
  int nbytes;
  int ret = 0;
#ifdef _FFDB_STATISTICS
  ++pgp->pagewrite;
#endif
  if (pgp->pgout)
    (pgp->pgout)(pgp->pgcookie, bp->pgno, bp->page);
  offset =  (off_t)pgp->pagesize * bp->pgno;
  if (lseek(pgp->fd, offset, SEEK_SET) != offset) 
    ret = -1;
  else {
    if ((nbytes = write(pgp->fd, bp->page, pgp->pagesize)) != pgp->pagesize) 
      ret = -1;
  }
  if (ret == 0)
    FFDB_FLAG_CLR(bp->flags, FFDB_PAGE_DIRTY);
  if (bp->pgno >= pgp->npages) {
    pgp->npages = bp->pgno + 1;
  }
  return ret;
}
static int _ffdb_pagepool_write ( ffdb_pagepool_t * pgp , ffdb_bkt_t * bp ) { off_t offset ; int nbytes ; int ret = 0 ; #ifdef _FFDB_STATISTICS ++ pgp -> pagewrite ; #endif if ( pgp -> pgout ) ( pgp -> pgout ) ( pgp -> pgcookie , bp -> pgno , bp -> page ) ; offset = ( off_t ) pgp -> pagesize * bp -> pgno ; if ( lseek ( pgp -> fd , offset , SEEK_SET ) != offset ) ret = -1 ; else { if ( ( nbytes = write ( pgp -> fd , bp -> page , pgp -> pagesize ) ) != pgp -> pagesize ) ret = -1 ; } if ( ret == 0 ) FFDB_FLAG_CLR ( bp -> flags , FFDB_PAGE_DIRTY ) ; if ( bp -> pgno >= pgp -> npages ) { pgp -> npages = bp -> pgno + 1 ; } return ret ; }
_ffdb_pagepool_write
      Write a dirty page to disk.
_ffdb_pagepool_write Write a dirty page to disk .
/* Run through the user's filter. */ /* Update how many pages this file holds now */