#define AD_XATTR_HDR_SIZE 36
#define AD_XATTR_MAX_HDR_SIZE 65536
+#define AD_CONV_WIPE_BLANK (1<<0)
+#define AD_CONV_DELETE (1<<1)
+
/*
* Both struct ad_xattr_header and struct ad_xattr_entry describe the in memory
* representation as well as the on-disk format.
static bool ad_convert_blank_rfork(vfs_handle_struct *handle,
struct adouble *ad,
+ uint32_t flags,
bool *blank)
{
- struct fruit_config_data *config = NULL;
size_t rforklen = sizeof(empty_resourcefork);
char buf[rforklen];
ssize_t nread;
*blank = false;
- SMB_VFS_HANDLE_GET_DATA(handle, config,
- struct fruit_config_data, return false);
-
- if (!config->wipe_intentionally_left_blank_rfork) {
+ if (!(flags & AD_CONV_WIPE_BLANK)) {
return true;
}
static bool ad_convert_delete_adfile(vfs_handle_struct *handle,
struct adouble *ad,
- const struct smb_filename *smb_fname)
+ const struct smb_filename *smb_fname,
+ uint32_t flags)
{
- struct fruit_config_data *config = NULL;
struct smb_filename *ad_name = NULL;
int rc;
return true;
}
- SMB_VFS_HANDLE_GET_DATA(handle, config,
- struct fruit_config_data, return false);
-
- if (!config->delete_empty_adfiles) {
+ if (!(flags & AD_CONV_DELETE)) {
return true;
}
* otherwise
**/
static int ad_convert(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+ const struct smb_filename *smb_fname,
+ uint32_t flags)
{
struct adouble *ad = NULL;
bool ok;
goto done;
}
- ok = ad_convert_blank_rfork(handle, ad, &blank);
+ ok = ad_convert_blank_rfork(handle, ad, flags, &blank);
if (!ok) {
ret = -1;
goto done;
goto done;
}
- ok = ad_convert_delete_adfile(handle, ad, smb_fname);
+ ok = ad_convert_delete_adfile(handle, ad, smb_fname, flags);
if (!ok) {
ret = -1;
goto done;
return NT_STATUS_UNSUCCESSFUL);
if (is_apple_stream(smb_fname) && !internal_open) {
- ret = ad_convert(handle, smb_fname);
+ uint32_t conv_flags = 0;
+
+ if (config->wipe_intentionally_left_blank_rfork) {
+ conv_flags |= AD_CONV_WIPE_BLANK;
+ }
+ if (config->delete_empty_adfiles) {
+ conv_flags |= AD_CONV_DELETE;
+ }
+
+ ret = ad_convert(handle, smb_fname, conv_flags);
if (ret != 0) {
DBG_ERR("ad_convert() failed\n");
return NT_STATUS_UNSUCCESSFUL;
{
struct fruit_config_data *config = NULL;
struct readdir_attr_data *attr_data;
+ uint32_t conv_flags = 0;
NTSTATUS status;
int ret;
DEBUG(10, ("fruit_readdir_attr %s\n", fname->base_name));
- ret = ad_convert(handle, fname);
+ if (config->wipe_intentionally_left_blank_rfork) {
+ conv_flags |= AD_CONV_WIPE_BLANK;
+ }
+ if (config->delete_empty_adfiles) {
+ conv_flags |= AD_CONV_DELETE;
+ }
+
+ ret = ad_convert(handle, fname, conv_flags);
if (ret != 0) {
DBG_ERR("ad_convert() failed\n");
return NT_STATUS_UNSUCCESSFUL;