struct vfs_statvfs_struct statbuf;
int ret;
- smb_fname_cpath = synthetic_smb_fname(talloc_tos(), conn->connectpath,
- NULL, NULL, 0);
+ smb_fname_cpath = synthetic_smb_fname(talloc_tos(),
+ conn->connectpath,
+ NULL,
+ NULL,
+ 0,
+ 0);
if (smb_fname_cpath == NULL) {
return caps;
}
/* Directory operations */
-static DIR *vfswrap_opendir(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *mask,
- uint32_t attr)
-{
- DIR *result;
-
- START_PROFILE(syscall_opendir);
- result = opendir(smb_fname->base_name);
- END_PROFILE(syscall_opendir);
- return result;
-}
-
static DIR *vfswrap_fdopendir(vfs_handle_struct *handle,
files_struct *fsp,
const char *mask,
mode_t mode)
{
int result;
- const char *path = smb_fname->base_name;
- char *parent = NULL;
+ struct smb_filename *parent = NULL;
+ bool ok;
START_PROFILE(syscall_mkdirat);
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
- if (lp_inherit_acls(SNUM(handle->conn))
- && parent_dirname(talloc_tos(), path, &parent, NULL)
- && directory_has_default_acl(handle->conn, parent)) {
- mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
+ if (lp_inherit_acls(SNUM(handle->conn))) {
+ ok = parent_smb_fname(talloc_tos(), smb_fname, &parent, NULL);
+ if (ok && directory_has_default_acl(handle->conn,
+ dirfsp,
+ parent))
+ {
+ mode = (0777 & lp_directory_mask(SNUM(handle->conn)));
+ }
}
TALLOC_FREE(parent);
- result = mkdirat(dirfsp->fh->fd, path, mode);
+ result = mkdirat(dirfsp->fh->fd, smb_fname->base_name, mode);
END_PROFILE(syscall_mkdirat);
return result;
}
struct vfswrap_pread_state {
- struct tevent_req *req;
ssize_t ret;
int fd;
void *buf;
return NULL;
}
- state->req = req;
state->ret = -1;
state->fd = fsp->fh->fd;
state->buf = data;
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, vfs_pread_done, state);
+ tevent_req_set_callback(subreq, vfs_pread_done, req);
talloc_set_destructor(state, vfs_pread_state_destructor);
static int vfs_pread_state_destructor(struct vfswrap_pread_state *state)
{
- /*
- * This destructor only gets called if the request is still
- * in flight, which is why we deny it by returning -1. We
- * also set the req pointer to NULL so the _done function
- * can detect the caller doesn't want the result anymore.
- *
- * Forcing the fsp closed by a SHUTDOWN_CLOSE can cause this.
- */
- state->req = NULL;
return -1;
}
static void vfs_pread_done(struct tevent_req *subreq)
{
- struct vfswrap_pread_state *state = tevent_req_callback_data(
- subreq, struct vfswrap_pread_state);
- struct tevent_req *req = state->req;
+ struct tevent_req *req = tevent_req_callback_data(
+ subreq, struct tevent_req);
+ struct vfswrap_pread_state *state = tevent_req_data(
+ req, struct vfswrap_pread_state);
int ret;
ret = pthreadpool_tevent_job_recv(subreq);
TALLOC_FREE(subreq);
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
talloc_set_destructor(state, NULL);
- if (req == NULL) {
- /*
- * We were shutdown closed in flight. No one
- * wants the result, and state has been reparented
- * to the NULL context, so just free it so we
- * don't leak memory.
- */
- DBG_NOTICE("pread request abandoned in flight\n");
- TALLOC_FREE(state);
- return;
- }
if (ret != 0) {
if (ret != EAGAIN) {
tevent_req_error(req, ret);
result,
NULL,
NULL,
+ 0,
0);
/*
* sys_getwd() *always* returns malloced memory.
START_PROFILE(syscall_ftruncate);
- if (lp_strict_allocate(SNUM(fsp->conn)) && !fsp->is_sparse) {
+ if (lp_strict_allocate(SNUM(fsp->conn)) && !fsp->fsp_flags.is_sparse) {
result = strict_allocate_ftruncate(handle, fsp, len);
END_PROFILE(syscall_ftruncate);
return result;
START_PROFILE(syscall_fcntl_lock);
- if (fsp->use_ofd_locks) {
+ if (fsp->fsp_flags.use_ofd_locks) {
op = map_process_lock_to_ofd_lock(op);
}
START_PROFILE(syscall_fcntl_getlock);
- if (fsp->use_ofd_locks) {
+ if (fsp->fsp_flags.use_ofd_locks) {
op = map_process_lock_to_ofd_lock(op);
}
result = sys_realpath(smb_fname->base_name);
END_PROFILE(syscall_realpath);
if (result) {
- result_fname = synthetic_smb_fname(ctx, result, NULL, NULL, 0);
+ result_fname = synthetic_smb_fname(ctx,
+ result,
+ NULL,
+ NULL,
+ 0,
+ 0);
SAFE_FREE(result);
}
return result_fname;
struct stream_struct *tmp_streams = NULL;
int ret;
- if ((fsp != NULL) && (fsp->is_directory)) {
+ if ((fsp != NULL) && (fsp->fsp_flags.is_directory)) {
/*
* No default streams on directories
*/
/* Directory operations */
- .opendir_fn = vfswrap_opendir,
.fdopendir_fn = vfswrap_fdopendir,
.readdir_fn = vfswrap_readdir,
.readdir_attr_fn = vfswrap_readdir_attr,