Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f3bb6947c |
1 changed files with 4 additions and 3 deletions
|
|
@ -63,6 +63,10 @@ mpool_open(key, fd, fvtable, pagesize, maxcache)
|
||||||
MPOOL *mp;
|
MPOOL *mp;
|
||||||
int entry;
|
int entry;
|
||||||
|
|
||||||
|
off_t file_size = fvtable->lseek(fd, 0, SEEK_END);
|
||||||
|
if (file_size == (off_t)-1)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
/* Allocate and initialize the MPOOL cookie. */
|
/* Allocate and initialize the MPOOL cookie. */
|
||||||
if ((mp = (MPOOL *)calloc(1, sizeof(MPOOL))) == NULL)
|
if ((mp = (MPOOL *)calloc(1, sizeof(MPOOL))) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
@ -71,9 +75,6 @@ mpool_open(key, fd, fvtable, pagesize, maxcache)
|
||||||
CIRCLEQ_INIT(&mp->hqh[entry]);
|
CIRCLEQ_INIT(&mp->hqh[entry]);
|
||||||
mp->maxcache = maxcache;
|
mp->maxcache = maxcache;
|
||||||
mp->fvtable = fvtable;
|
mp->fvtable = fvtable;
|
||||||
off_t file_size = mp->fvtable->lseek(fd, 0, SEEK_END);
|
|
||||||
if (file_size == (off_t)-1)
|
|
||||||
return (NULL);
|
|
||||||
mp->npages = file_size / pagesize;
|
mp->npages = file_size / pagesize;
|
||||||
mp->pagesize = pagesize;
|
mp->pagesize = pagesize;
|
||||||
mp->fd = fd;
|
mp->fd = fd;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue