* Ok, this is a sync fake. We should make the sync async as well, but
* I'm too lazy for that right now -- vl
*/
- commit_ret = commit(state->handle, state->fsp, state->fsp->fh->pos,
+ commit_ret = commit(state->handle,
+ state->fsp,
+ fh_get_pos(state->fsp->fh),
state->ret);
if (commit_ret == -1) {
if (result == -1 && errno == ESPIPE) {
/* Maintain the fiction that pipes can be seeked (sought?) on. */
result = sys_read(fsp_get_io_fd(fsp), data, n);
- fsp->fh->pos = 0;
+ fh_set_pos(fsp->fh, 0);
}
#else /* HAVE_PREAD */
{
char *buf = NULL;
ssize_t byte_count;
- off_t in_pos = fsp->fh->pos;
+ off_t in_pos = fh_get_pos(fsp->fh);
buf=(char *)SMB_MALLOC(DOS_HEADER_SIZE);
if (buf == NULL) {
} else {
outsize = setup_readX_header(outbuf, nread);
- aio_ex->fsp->fh->pos = aio_ex->offset + nread;
- aio_ex->fsp->fh->position_information = aio_ex->fsp->fh->pos;
+ fh_set_pos(aio_ex->fsp->fh, aio_ex->offset + nread);
+ fh_set_position_information(aio_ex->fsp->fh,
+ fh_get_pos(aio_ex->fsp->fh));
DEBUG( 3, ("handle_aio_read_complete file %s max=%d "
"nread=%d\n", fsp_str_dbg(fsp),
DEBUG(3,("handle_aio_write: %s, num=%d wrote=%d\n",
fsp_fnum_dbg(fsp), (int)numtowrite, (int)nwritten));
- aio_ex->fsp->fh->pos = aio_ex->offset + nwritten;
+ fh_set_pos(aio_ex->fsp->fh, aio_ex->offset + nwritten);
}
show_msg(outbuf);
status = smb2_read_complete(subreq, nread, vfs_aio_state.error);
if (nread > 0) {
- fsp->fh->pos = aio_ex->offset + nread;
- fsp->fh->position_information = fsp->fh->pos;
+ fh_set_pos(fsp->fh, aio_ex->offset + nread);
+ fh_set_position_information(fsp->fh,
+ fh_get_pos(fsp->fh));
}
DEBUG(10, ("smb2: scheduled aio_read completed "
cookie.servicepath = conn->connectpath;
cookie.base_name = fsp->fsp_name->base_name;
cookie.initial_allocation_size = fsp->initial_allocation_size;
- cookie.position_information = fsp->fh->position_information;
+ cookie.position_information = fh_get_position_information(fsp->fh);
cookie.update_write_time_triggered =
fsp->fsp_flags.update_write_time_triggered;
cookie.update_write_time_on_close =
cookie.servicepath = conn->connectpath;
cookie.base_name = fsp_str_dbg(fsp);
cookie.initial_allocation_size = fsp->initial_allocation_size;
- cookie.position_information = fsp->fh->position_information;
+ cookie.position_information = fh_get_position_information(fsp->fh);
cookie.update_write_time_triggered =
fsp->fsp_flags.update_write_time_triggered;
cookie.update_write_time_on_close =
}
fsp->initial_allocation_size = cookie.initial_allocation_size;
- fsp->fh->position_information = cookie.position_information;
+ fh_set_position_information(fsp->fh, cookie.position_information);
fsp->fsp_flags.update_write_time_triggered =
cookie.update_write_time_triggered;
fsp->fsp_flags.update_write_time_on_close =
fsp->conn = conn;
fsp_set_fd(fsp, -1);
fsp->vuid = current_vuid;
- fsp->fh->pos = -1;
+ fh_set_pos(fsp->fh, -1);
fsp->fsp_flags.can_lock = false; /* Should this be true ? - No, JRA */
fsp->access_mask = access_mask;
status = fsp_set_smb_fname(fsp, smb_fname);
ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n)
{
+ off_t new_pos;
ssize_t ret = 0;
bool ok;
return -1;
}
- fsp->fh->pos = pos;
+ fh_set_pos(fsp->fh, pos);
if (n > 0) {
ret = SMB_VFS_PREAD(fsp,data,n,pos);
DEBUG(10,("read_file (%s): pos = %.0f, size = %lu, returned %lu\n",
fsp_str_dbg(fsp), (double)pos, (unsigned long)n, (long)ret));
- fsp->fh->pos += ret;
- fsp->fh->position_information = fsp->fh->pos;
+ new_pos = fh_get_pos(fsp->fh) + ret;
+ fh_set_pos(fsp->fh, new_pos);
+ fh_set_position_information(fsp->fh, new_pos);
return(ret);
}
return 0;
}
- fsp->fh->pos = pos;
+ fh_set_pos(fsp->fh, pos);
if (pos &&
lp_strict_allocate(SNUM(fsp->conn)) &&
!fsp->fsp_flags.is_sparse)
fsp_str_dbg(fsp), (double)pos, (unsigned long)n, (long)ret));
if (ret != -1) {
- fsp->fh->pos += ret;
+ off_t new_pos = fh_get_pos(fsp->fh) + ret;
+ fh_set_pos(fsp->fh, new_pos);
/* Yes - this is correct - writes don't update this. JRA. */
/* Found by Samba4 tests. */
break;
case 1:
umode = SEEK_CUR;
- res = fsp->fh->pos + startpos;
+ res = fh_get_pos(fsp->fh) + startpos;
break;
case 2:
umode = SEEK_END;
}
}
- fsp->fh->pos = res;
+ fh_set_pos(fsp->fh, res);
reply_outbuf(req, 2, 0);
SIVAL(req->outbuf,smb_vwv0,res);
}
if (fsp) {
- pos = fsp->fh->position_information;
+ pos = fh_get_position_information(fsp->fh);
}
if (fsp) {
DEBUG(10,("smb_file_position_information: Set file position "
"information for file %s to %.0f\n", fsp_str_dbg(fsp),
(double)position_information));
- fsp->fh->position_information = position_information;
+ fh_set_position_information(fsp->fh, position_information);
return NT_STATUS_OK;
}