示例#1
0
static int
fs_stateResizeFile(struct fs_dump_state * state, size_t min_add)
{
    int ret = 0;
    afs_foff_t inc;

    fs_stateUnmapFile(state);

    inc = ((min_add / FS_STATE_INIT_FILESIZE)+1) * FS_STATE_INIT_FILESIZE;
    state->file_len += inc;

    if (afs_ftruncate(state->fd, state->file_len) != 0) {
	ViceLog(0, ("fs_stateResizeFile: truncate failed\n"));
	ret = 1;
	goto done;
    }

    if (fs_stateMapFile(state)) {
	ViceLog(0, ("fs_stateResizeFile: remapping memory mapped file failed\n"));
	ret = 1;
	goto done;
    }

 done:
    return ret;
}
示例#2
0
static int
fs_stateSizeFile(struct fs_dump_state * state)
{
    int ret = 0;
    state->file_len = FS_STATE_INIT_FILESIZE;
    if (afs_ftruncate(state->fd, state->file_len) != 0)
	ret = 1;
    return ret;
}
示例#3
0
static int
fs_stateTruncateFile(struct fs_dump_state * state)
{
    int ret = 0;

#ifdef AFS_LARGEFILE_ENV
    if (afs_ftruncate(state->fd, state->eof_offset) != 0) {
	ret = 1;
    }
#else
    afs_uint32 hi, lo;
    SplitInt64(state->eof_offset, hi, lo);
    if (afs_ftruncate(state->fd, lo) != 0) {
	ret = 1;
    }
#endif

    return ret;
}
示例#4
0
static int
fs_stateTruncateFile(struct fs_dump_state * state)
{
    int ret = 0;

    if (afs_ftruncate(state->fd, state->eof_offset) != 0) {
	ret = 1;
    }

    return ret;
}