static bool ad_pack_move_reso(struct vfs_handle_struct *handle,
			      struct adouble *ad,
			      files_struct *fsp)
{
	size_t reso_len;
	size_t reso_off;
	size_t n;
	bool ok;

	reso_len = ad_getentrylen(ad, ADEID_RFORK);
	reso_off = ad_getentryoff(ad, ADEID_RFORK);

	if (reso_len == 0) {
		return true;
	}

	if (ad->ad_rsrc_data == NULL) {
		/*
		 * This buffer is already set when converting a resourcefork
		 * stream from vfs_streams_depot backend via ad_unconvert(). It
		 * is NULL with vfs_streams_xattr where the resourcefork stream
		 * is stored in an AppleDouble sidecar file vy vfs_fruit.
		 */
		ad->ad_rsrc_data = talloc_size(ad, reso_len);
		if (ad->ad_rsrc_data == NULL) {
			return false;
		}

		n = SMB_VFS_NEXT_PREAD(handle,
				       fsp,
				       ad->ad_rsrc_data,
				       reso_len,
				       ADEDOFF_RFORK_DOT_UND);
		if (n != reso_len) {
			DBG_ERR("Read on [%s] failed\n",
				fsp_str_dbg(fsp));
			ok = false;
			goto out;
		}
	}

	n = SMB_VFS_NEXT_PWRITE(handle,
				fsp,
				ad->ad_rsrc_data,
				reso_len,
				reso_off);
	if (n != reso_len) {
		DBG_ERR("Write on [%s] failed\n",
			fsp_str_dbg(fsp));
		ok = false;
		goto out;
	}

	ok = true;
out:
	return ok;
}
static bool ad_pack_move_reso(struct vfs_handle_struct *handle,
			      struct adouble *ad,
			      files_struct *fsp)
{
	size_t reso_len;
	size_t reso_off;
	size_t n;
	bool ok;

	reso_len = ad_getentrylen(ad, ADEID_RFORK);
	reso_off = ad_getentryoff(ad, ADEID_RFORK);

	if (reso_len == 0) {
		return true;
	}

	if (ad->ad_rsrc_data == NULL) {
		 
		ad->ad_rsrc_data = talloc_size(ad, reso_len);
		if (ad->ad_rsrc_data == NULL) {
			return false;
		}

		n = SMB_VFS_NEXT_PREAD(handle,
				       fsp,
				       ad->ad_rsrc_data,
				       reso_len,
				       ADEDOFF_RFORK_DOT_UND);
		if (n != reso_len) {
			DBG_ERR("Read on [%s] failed\n",
				fsp_str_dbg(fsp));
			ok = false;
			goto out;
		}
	}

	n = SMB_VFS_NEXT_PWRITE(handle,
				fsp,
				ad->ad_rsrc_data,
				reso_len,
				reso_off);
	if (n != reso_len) {
		DBG_ERR("Write on [%s] failed\n",
			fsp_str_dbg(fsp));
		ok = false;
		goto out;
	}

	ok = true;
out:
	return ok;
}