From: Ralph Boehme Date: Fri, 2 Dec 2016 10:26:22 +0000 (+0100) Subject: vfs_fruit: refactor fruit_stat_rsrc() X-Git-Tag: tdb-1.3.13~720 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=5037816d28df6f1eed46abf910b0cd4c1a40ec77 vfs_fruit: refactor fruit_stat_rsrc() Use helper functions for the fruit:resource cases. No change in behaveour. The next patch will add the proper helper functions for fruit:resource=xattr and fruit:resource=stream. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12427 Signed-off-by: Ralph Boehme Reviewed-by: Uri Simchoni --- diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index eb20baaa14c..07221d37f25 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -3592,15 +3592,12 @@ static int fruit_stat_meta(vfs_handle_struct *handle, return ret; } -static int fruit_stat_rsrc(vfs_handle_struct *handle, - struct smb_filename *smb_fname, - bool follow_links) - +static int fruit_stat_rsrc_netatalk(vfs_handle_struct *handle, + struct smb_filename *smb_fname, + bool follow_links) { struct adouble *ad = NULL; - - DEBUG(10, ("fruit_stat_rsrc called for %s\n", - smb_fname_str_dbg(smb_fname))); + int ret; ad = ad_get(talloc_tos(), handle, smb_fname->base_name, ADOUBLE_RSRC); if (ad == NULL) { @@ -3609,7 +3606,8 @@ static int fruit_stat_rsrc(vfs_handle_struct *handle, } /* Populate the stat struct with info from the base file. */ - if (fruit_stat_base(handle, smb_fname, follow_links) == -1) { + ret = fruit_stat_base(handle, smb_fname, follow_links); + if (ret != 0) { TALLOC_FREE(ad); return -1; } @@ -3621,6 +3619,33 @@ static int fruit_stat_rsrc(vfs_handle_struct *handle, return 0; } +static int fruit_stat_rsrc(vfs_handle_struct *handle, + struct smb_filename *smb_fname, + bool follow_links) +{ + struct fruit_config_data *config = NULL; + int ret; + + 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->rsrc) { + case FRUIT_RSRC_STREAM: + case FRUIT_RSRC_XATTR: + case FRUIT_RSRC_ADFILE: + ret = fruit_stat_rsrc_netatalk(handle, smb_fname, follow_links); + break; + + default: + DBG_ERR("Unexpected rsrc config [%d]\n", config->rsrc); + return -1; + } + + return ret; +} + static int fruit_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname) {