diff options
author | Tim Prouty <tprouty@samba.org> | 2009-06-15 12:13:31 -0700 |
---|---|---|
committer | Tim Prouty <tprouty@samba.org> | 2009-06-15 14:03:40 -0700 |
commit | 6f335036fda47a6903b21287824d88333d1b526f (patch) | |
tree | 80651a922b95e70d70550dd91b0b0da99ddc313b | |
parent | efccef09aec93180a06955b5e03f1ceb99dc39e8 (diff) | |
download | samba-6f335036fda47a6903b21287824d88333d1b526f.tar.gz samba-6f335036fda47a6903b21287824d88333d1b526f.tar.bz2 samba-6f335036fda47a6903b21287824d88333d1b526f.zip |
s3 onefs: Change onefs modules to use the new createfile api
-rw-r--r-- | source3/modules/onefs.h | 6 | ||||
-rw-r--r-- | source3/modules/onefs_open.c | 40 | ||||
-rw-r--r-- | source3/modules/vfs_onefs_shadow_copy.c | 43 |
3 files changed, 46 insertions, 43 deletions
diff --git a/source3/modules/onefs.h b/source3/modules/onefs.h index 70f90b5cd5..3e6cd29b51 100644 --- a/source3/modules/onefs.h +++ b/source3/modules/onefs.h @@ -46,8 +46,7 @@ void onefs_init_search_op(struct vfs_handle_struct *handle, NTSTATUS onefs_create_file(vfs_handle_struct *handle, struct smb_request *req, uint16_t root_dir_fid, - const char *fname, - uint32_t create_file_flags, + struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, uint32_t create_disposition, @@ -58,8 +57,7 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, struct security_descriptor *sd, struct ea_list *ea_list, files_struct **result, - int *pinfo, - SMB_STRUCT_STAT *psbuf); + int *pinfo); int onefs_close(vfs_handle_struct *handle, struct files_struct *fsp); diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c index 4198e5fd56..c773f9ebbc 100644 --- a/source3/modules/onefs_open.c +++ b/source3/modules/onefs_open.c @@ -1981,8 +1981,7 @@ static void destroy_onefs_fsp_data(void *p_data) NTSTATUS onefs_create_file(vfs_handle_struct *handle, struct smb_request *req, uint16_t root_dir_fid, - const char *fname, - uint32_t create_file_flags, + struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, uint32_t create_disposition, @@ -1993,15 +1992,13 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, struct security_descriptor *sd, struct ea_list *ea_list, files_struct **result, - int *pinfo, - SMB_STRUCT_STAT *psbuf) + int *pinfo) { connection_struct *conn = handle->conn; - struct case_semantics_state *case_state = NULL; struct onefs_fsp_data fsp_data = {}; - SMB_STRUCT_STAT sbuf; int info = FILE_WAS_OPENED; files_struct *fsp = NULL; + char *fname = NULL; NTSTATUS status; DEBUG(10,("onefs_create_file: access_mask = 0x%x " @@ -2009,7 +2006,7 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, "create_disposition = 0x%x create_options = 0x%x " "oplock_request = 0x%x " "root_dir_fid = 0x%x, ea_list = 0x%p, sd = 0x%p, " - "create_file_flags = 0x%x, fname = %s\n", + "fname = %s\n", (unsigned int)access_mask, (unsigned int)file_attributes, (unsigned int)share_access, @@ -2017,7 +2014,7 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, (unsigned int)create_options, (unsigned int)oplock_request, (unsigned int)root_dir_fid, - ea_list, sd, create_file_flags, fname)); + ea_list, sd, smb_fname_str_dbg(smb_fname))); /* Get the file name if root_dir_fid was specified. */ if (root_dir_fid != 0) { @@ -2036,7 +2033,8 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, if ((req != NULL) && (req->flags2 & FLAGS2_DFS_PATHNAMES)) { char *resolved_fname; - status = resolve_dfspath(talloc_tos(), conn, true, fname, + status = resolve_dfspath(talloc_tos(), conn, true, + smb_fname->base_name, &resolved_fname); if (!NT_STATUS_IS_OK(status)) { @@ -2048,24 +2046,15 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, */ goto fail; } - fname = resolved_fname; - } - - /* Check if POSIX semantics are wanted. */ - if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) { - case_state = set_posix_case_semantics(talloc_tos(), conn); + TALLOC_FREE(smb_fname->base_name); + smb_fname->base_name = resolved_fname; } - if (psbuf != NULL) { - sbuf = *psbuf; - } else { - if (SMB_VFS_STAT(conn, fname, &sbuf) == -1) { - SET_STAT_INVALID(sbuf); - } + status = get_full_smb_filename(talloc_tos(), smb_fname, &fname); + if (!NT_STATUS_IS_OK(status)) { + goto fail; } - TALLOC_FREE(case_state); - /* All file access must go through check_name() */ status = check_name(conn, fname); if (!NT_STATUS_IS_OK(status)) { @@ -2088,7 +2077,7 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, &fsp, /* result */ &info, /* pinfo */ &fsp_data, /* fsp_data */ - &sbuf); /* psbuf */ + &smb_fname->st); /* psbuf */ if (!NT_STATUS_IS_OK(status)) { goto fail; @@ -2120,9 +2109,6 @@ NTSTATUS onefs_create_file(vfs_handle_struct *handle, if (pinfo != NULL) { *pinfo = info; } - if (psbuf != NULL) { - *psbuf = sbuf; - } return NT_STATUS_OK; fail: diff --git a/source3/modules/vfs_onefs_shadow_copy.c b/source3/modules/vfs_onefs_shadow_copy.c index 28bc0c5081..3d4ffc9084 100644 --- a/source3/modules/vfs_onefs_shadow_copy.c +++ b/source3/modules/vfs_onefs_shadow_copy.c @@ -143,6 +143,27 @@ onefs_shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, return ret; \ } while (0) \ +/* + * XXX: Convert osc_canonicalize_path to use talloc instead of malloc. + */ +#define SHADOW_NEXT_SMB_FNAME(op, args, rtype) do { \ + char *smb_base_name_tmp = NULL; \ + char *cpath = NULL; \ + char *snap_component = NULL; \ + rtype ret; \ + smb_base_name_tmp = smb_fname->base_name; \ + if (shadow_copy_match_name(smb_fname->base_name, \ + &snap_component)) { \ + cpath = osc_canonicalize_path(smb_fname->base_name, \ + snap_component); \ + smb_fname->base_name = cpath; \ + } \ + ret = SMB_VFS_NEXT_ ## op args; \ + smb_fname->base_name = smb_base_name_tmp; \ + SAFE_FREE(cpath); \ + return ret; \ + } while (0) \ + static uint64_t @@ -205,8 +226,7 @@ static NTSTATUS onefs_shadow_copy_create_file(vfs_handle_struct *handle, struct smb_request *req, uint16_t root_dir_fid, - const char *path, - uint32_t create_file_flags, + struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, uint32_t create_disposition, @@ -217,16 +237,15 @@ onefs_shadow_copy_create_file(vfs_handle_struct *handle, struct security_descriptor *sd, struct ea_list *ea_list, files_struct **result, - int *pinfo, - SMB_STRUCT_STAT *psbuf) -{ - SHADOW_NEXT(CREATE_FILE, - (handle, req, root_dir_fid, cpath ?: path, - create_file_flags, access_mask, share_access, - create_disposition, create_options, file_attributes, - oplock_request, allocation_size, sd, ea_list, result, - pinfo, psbuf), - NTSTATUS); + int *pinfo) +{ + SHADOW_NEXT_SMB_FNAME(CREATE_FILE, + (handle, req, root_dir_fid, smb_fname, + access_mask, share_access, + create_disposition, create_options, + file_attributes, oplock_request, + allocation_size, sd, ea_list, result, pinfo), + NTSTATUS); } /** |