* Helper functions
*****************************************************************************/
+static struct fio *fruit_get_complete_fio(vfs_handle_struct *handle,
+ files_struct *fsp)
+{
+ struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+
+ if (fio == NULL) {
+ return NULL;
+ }
+
+ return fio;
+}
+
/**
* Initialize config struct from our smb.conf config parameters
**/
static int fruit_close_meta(vfs_handle_struct *handle,
files_struct *fsp)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
int ret;
struct fruit_config_data *config = NULL;
files_struct *fsp, void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nread;
int ret;
files_struct *fsp, void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nread;
ssize_t to_return;
files_struct *fsp, void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nread;
if (fio == NULL) {
files_struct *fsp, void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nread;
DBG_DEBUG("Path [%s] offset=%"PRIdMAX", size=%zd\n",
struct tevent_req *req = NULL;
struct tevent_req *subreq = NULL;
struct fruit_pread_state *state = NULL;
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
req = tevent_req_create(mem_ctx, &state,
struct fruit_pread_state);
files_struct *fsp, const void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
AfpInfo *ai = NULL;
size_t nwritten;
int ret;
files_struct *fsp, const void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nwritten;
uint8_t buf[AFP_INFO_SIZE];
size_t to_write;
files_struct *fsp, const void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nwritten;
if (fio == NULL) {
files_struct *fsp, const void *data,
size_t n, off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
ssize_t nwritten;
DBG_DEBUG("Path [%s] offset=%"PRIdMAX", size=%zd\n",
struct tevent_req *req = NULL;
struct tevent_req *subreq = NULL;
struct fruit_pwrite_state *state = NULL;
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
req = tevent_req_create(mem_ctx, &state,
struct fruit_pwrite_state);
files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
struct smb_filename smb_fname;
ino_t ino;
int ret;
static int fruit_fstat(vfs_handle_struct *handle, files_struct *fsp,
SMB_STRUCT_STAT *sbuf)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
int rc;
if (fio == NULL) {
off_t offset,
off_t len)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
if (fio == NULL) {
return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
struct files_struct *fsp,
off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
int ret;
if (fio == NULL) {
struct files_struct *fsp,
off_t offset)
{
- struct fio *fio = (struct fio *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
+ struct fio *fio = fruit_get_complete_fio(handle, fsp);
int ret;
DBG_DEBUG("Path [%s] offset [%"PRIdMAX"]\n", fsp_str_dbg(fsp),