1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

vfs_fruit: refactor fruit_open_meta()

Just split out the fruit:metadata=stream case into a helper function, no
change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12427

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
This commit is contained in:
Ralph Boehme 2016-11-29 16:56:00 +01:00 committed by Uri Simchoni
parent 3d5bf4b85f
commit 5a072ca91c

View File

@ -2185,26 +2185,27 @@ static int fruit_connect(vfs_handle_struct *handle,
return rc;
}
static int fruit_open_meta(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
static int fruit_open_meta_stream(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp,
int flags,
mode_t mode)
{
return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}
static int fruit_open_meta_netatalk(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp,
int flags,
mode_t mode)
{
int rc = 0;
struct fruit_config_data *config = NULL;
struct smb_filename *smb_fname_base = NULL;
int baseflags;
int hostfd = -1;
struct adouble *ad = NULL;
DEBUG(10, ("fruit_open_meta for %s\n", smb_fname_str_dbg(smb_fname)));
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data, return -1);
if (config->meta == FRUIT_META_STREAM) {
return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}
/* Create an smb_filename with stream_name == NULL. */
smb_fname_base = synthetic_smb_fname(talloc_tos(),
smb_fname->base_name,
@ -2297,6 +2298,38 @@ exit:
return hostfd;
}
static int fruit_open_meta(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)
{
int rc;
struct fruit_config_data *config = NULL;
DBG_DEBUG("path [%s]\n", smb_fname_str_dbg(smb_fname));
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct fruit_config_data, return -1);
switch (config->meta) {
case FRUIT_META_STREAM:
rc = fruit_open_meta_stream(handle, smb_fname,
fsp, flags, mode);
break;
case FRUIT_META_NETATALK:
rc = fruit_open_meta_netatalk(handle, smb_fname,
fsp, flags, mode);
break;
default:
DBG_ERR("Unexpected meta config [%d]\n", config->meta);
return -1;
}
DBG_DEBUG("path [%s] rc [%d]\n", smb_fname_str_dbg(smb_fname), rc);
return rc;
}
static int fruit_open_rsrc(vfs_handle_struct *handle,
struct smb_filename *smb_fname,
files_struct *fsp, int flags, mode_t mode)