uint64_t *bsize, uint64_t *dfree,
uint64_t *dsize)
{
- uint64_t result;
+ if (sys_fsusage(path, dfree, dsize) != 0) {
+ return (uint64_t)-1;
+ }
- result = sys_disk_free(handle->conn, path, bsize, dfree, dsize);
- return result;
+ *bsize = 512;
+ return *dfree / 2;
}
-static int vfswrap_get_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
+static int vfswrap_get_quota(struct vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *qt)
{
#ifdef HAVE_SYS_QUOTAS
int result;
START_PROFILE(syscall_get_quota);
- result = sys_get_quota(handle->conn->connectpath, qtype, id, qt);
+ result = sys_get_quota(path, qtype, id, qt);
END_PROFILE(syscall_get_quota);
return result;
#else
/* Directory operations */
-static DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32_t attr)
+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(fname);
+ result = opendir(smb_fname->base_name);
END_PROFILE(syscall_opendir);
return result;
}
END_PROFILE(syscall_rewinddir);
}
-static int vfswrap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int vfswrap_mkdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
bool has_dacl = False;
+ const char *path = smb_fname->base_name;
char *parent = NULL;
START_PROFILE(syscall_mkdir);
* mess up any inherited ACL bits that were set. JRA.
*/
int saved_errno = errno; /* We may get ENOSYS */
- if ((SMB_VFS_CHMOD_ACL(handle->conn, path, mode) == -1) && (errno == ENOSYS))
+ if ((SMB_VFS_CHMOD_ACL(handle->conn, smb_fname, mode) == -1) &&
+ (errno == ENOSYS)) {
errno = saved_errno;
+ }
}
END_PROFILE(syscall_mkdir);
return result;
}
-static int vfswrap_rmdir(vfs_handle_struct *handle, const char *path)
+static int vfswrap_rmdir(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
int result;
START_PROFILE(syscall_rmdir);
- result = rmdir(path);
+ result = rmdir(smb_fname->base_name);
END_PROFILE(syscall_rmdir);
return result;
}
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
- struct smb2_create_blob *svhdx = NULL;
-
- /*
- * It might be empty ... and smb2_create_blob_find does not handle that
- */
- if (in_context_blobs) {
- svhdx = smb2_create_blob_find(in_context_blobs,
- SVHDX_OPEN_DEVICE_CONTEXT);
- }
-
- if (svhdx != NULL) {
- /* SharedVHD is not yet supported */
- DEBUG(10, ("Shared VHD not yet supported, INVALID_DEVICE_REQUEST\n"));
- return NT_STATUS_INVALID_DEVICE_REQUEST;
- }
-
return create_file_default(handle->conn, req, root_dir_fid, smb_fname,
access_mask, share_access,
create_disposition, create_options,
return true;
}
- ret = asys_context_init(&ctx, get_aio_pending_size());
+ ret = asys_context_init(&ctx, lp_aio_max_threads());
if (ret != 0) {
DEBUG(1, ("asys_context_init failed: %s\n", strerror(ret)));
return false;
struct asys_context *asys_ctx;
struct tevent_req *req;
ssize_t ret;
- int err;
+ struct vfs_aio_state vfs_aio_state;
SMBPROFILE_BASIC_ASYNC_STATE(profile_basic);
SMBPROFILE_BYTES_ASYNC_STATE(profile_bytes);
};
uint16_t flags, void *p)
{
struct asys_context *asys_ctx = (struct asys_context *)p;
- struct asys_result results[outstanding_aio_calls];
+ struct asys_result results[get_outstanding_aio_calls()];
int i, ret;
if ((flags & TEVENT_FD_READ) == 0) {
return;
}
- ret = asys_results(asys_ctx, results, outstanding_aio_calls);
+ ret = asys_results(asys_ctx, results, get_outstanding_aio_calls());
if (ret < 0) {
DEBUG(1, ("asys_results returned %s\n", strerror(-ret)));
return;
SMBPROFILE_BASIC_ASYNC_END(state->profile_basic);
SMBPROFILE_BYTES_ASYNC_END(state->profile_bytes);
state->ret = result->ret;
- state->err = result->err;
+ state->vfs_aio_state.error = result->err;
+ state->vfs_aio_state.duration = result->duration;
tevent_req_defer_callback(req, ev);
tevent_req_done(req);
}
}
-static ssize_t vfswrap_asys_ssize_t_recv(struct tevent_req *req, int *err)
+static ssize_t vfswrap_asys_ssize_t_recv(struct tevent_req *req,
+ struct vfs_aio_state *vfs_aio_state)
{
struct vfswrap_asys_state *state = tevent_req_data(
req, struct vfswrap_asys_state);
- if (tevent_req_is_unix_error(req, err)) {
+ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
return -1;
}
- *err = state->err;
+ *vfs_aio_state = state->vfs_aio_state;
return state->ret;
}
-static int vfswrap_asys_int_recv(struct tevent_req *req, int *err)
+static int vfswrap_asys_int_recv(struct tevent_req *req,
+ struct vfs_aio_state *vfs_aio_state)
{
struct vfswrap_asys_state *state = tevent_req_data(
req, struct vfswrap_asys_state);
- if (tevent_req_is_unix_error(req, err)) {
+ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
return -1;
}
- *err = state->err;
+ *vfs_aio_state = state->vfs_aio_state;
return state->ret;
}
return result;
}
-static int vfswrap_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
+static int vfswrap_chmod(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
{
int saved_errno = errno; /* We might get ENOSYS */
- if ((result = SMB_VFS_CHMOD_ACL(handle->conn, path, mode)) == 0) {
+ result = SMB_VFS_CHMOD_ACL(handle->conn,
+ smb_fname,
+ mode);
+ if (result == 0) {
END_PROFILE(syscall_chmod);
return result;
}
errno = saved_errno;
}
- result = chmod(path, mode);
+ result = chmod(smb_fname->base_name, mode);
END_PROFILE(syscall_chmod);
return result;
}
return result;
}
-static int vfswrap_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
+static int vfswrap_chown(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ uid_t uid,
+ gid_t gid)
{
int result;
START_PROFILE(syscall_chown);
- result = chown(path, uid, gid);
+ result = chown(smb_fname->base_name, uid, gid);
END_PROFILE(syscall_chown);
return result;
}
char *result;
START_PROFILE(syscall_realpath);
-#ifdef REALPATH_TAKES_NULL
- result = realpath(path, NULL);
-#else
- result = SMB_MALLOC_ARRAY(char, PATH_MAX+1);
- if (result) {
- char *resolved_path = realpath(path, result);
- if (!resolved_path) {
- SAFE_FREE(result);
- } else {
- /* SMB_ASSERT(result == resolved_path) ? */
- result = resolved_path;
- }
- }
-#endif
+ result = sys_realpath(path);
END_PROFILE(syscall_realpath);
return result;
}
}
static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
- const char *name,
+ const struct smb_filename *smb_fname,
uint32_t security_info,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc)
NTSTATUS result;
START_PROFILE(get_nt_acl);
- result = posix_get_nt_acl(handle->conn, name, security_info,
- mem_ctx, ppdesc);
+ result = posix_get_nt_acl(handle->conn,
+ smb_fname->base_name,
+ security_info,
+ mem_ctx,
+ ppdesc);
END_PROFILE(get_nt_acl);
return result;
}
return NT_STATUS_OK; /* Nothing to do here ... */
}
-static int vfswrap_chmod_acl(vfs_handle_struct *handle, const char *name, mode_t mode)
+static int vfswrap_chmod_acl(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
#ifdef HAVE_NO_ACL
errno = ENOSYS;
int result;
START_PROFILE(chmod_acl);
- result = chmod_acl(handle->conn, name, mode);
+ result = chmod_acl(handle->conn, smb_fname->base_name, mode);
END_PROFILE(chmod_acl);
return result;
#endif