s3: VFS: Change SMB_VFS_CHFLAGS to use const struct smb_filename * instead of const...
[kamenim/samba-autobuild/.git] / source3 / modules / vfs_aio_pthread.c
index 7e772971de7b8225b42169ca757a677a28f1b1fd..1d9346cfb65d29d35e24b678060db3b909053fe9 100644 (file)
@@ -26,7 +26,7 @@
 #include "system/shmem.h"
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
-#include "lib/pthreadpool/pthreadpool.h"
+#include "../lib/pthreadpool/pthreadpool_pipe.h"
 #ifdef HAVE_LINUX_FALLOC_H
 #include <linux/falloc.h>
 #endif
 ***********************************************************************/
 
 static bool init_aio_threadpool(struct tevent_context *ev_ctx,
-                               struct pthreadpool **pp_pool,
+                               struct pthreadpool_pipe **pp_pool,
                                void (*completion_fn)(struct tevent_context *,
                                                struct tevent_fd *,
-                                               uint16,
+                                               uint16_t,
                                                void *))
 {
        struct tevent_fd *sock_event = NULL;
@@ -51,25 +51,25 @@ static bool init_aio_threadpool(struct tevent_context *ev_ctx,
                return true;
        }
 
-       ret = pthreadpool_init(aio_pending_size, pp_pool);
+       ret = pthreadpool_pipe_init(lp_aio_max_threads(), pp_pool);
        if (ret) {
                errno = ret;
                return false;
        }
        sock_event = tevent_add_fd(ev_ctx,
                                NULL,
-                               pthreadpool_signal_fd(*pp_pool),
+                               pthreadpool_pipe_signal_fd(*pp_pool),
                                TEVENT_FD_READ,
                                completion_fn,
                                NULL);
        if (sock_event == NULL) {
-               pthreadpool_destroy(*pp_pool);
+               pthreadpool_pipe_destroy(*pp_pool);
                *pp_pool = NULL;
                return false;
        }
 
        DEBUG(10,("init_aio_threadpool: initialized with up to %d threads\n",
-                 aio_pending_size));
+                 (int)lp_aio_max_threads()));
 
        return true;
 }
@@ -87,7 +87,7 @@ static bool init_aio_threadpool(struct tevent_context *ev_ctx,
  * process, as is the current jobid.
  */
 
-static struct pthreadpool *open_pool;
+static struct pthreadpool_pipe *open_pool;
 static int aio_pthread_open_jobid;
 
 struct aio_open_private_data {
@@ -152,7 +152,7 @@ static struct aio_open_private_data *find_open_private_data_by_mid(uint64_t mid)
 
 static void aio_open_handle_completion(struct tevent_context *event_ctx,
                                struct tevent_fd *event,
-                               uint16 flags,
+                               uint16_t flags,
                                void *p)
 {
        struct aio_open_private_data *opd = NULL;
@@ -167,7 +167,7 @@ static void aio_open_handle_completion(struct tevent_context *event_ctx,
                return;
        }
 
-       ret = pthreadpool_finished_jobs(open_pool, &jobid, 1);
+       ret = pthreadpool_pipe_finished_jobs(open_pool, &jobid, 1);
        if (ret != 1) {
                smb_panic("aio_open_handle_completion");
                /* notreached. */
@@ -341,7 +341,7 @@ static struct aio_open_private_data *create_private_open_data(const files_struct
        }
 
        talloc_set_destructor(opd, opd_destructor);
-       DLIST_ADD_END(open_pd_list, opd, struct aio_open_private_data *);
+       DLIST_ADD_END(open_pd_list, opd);
        return opd;
 }
 
@@ -368,10 +368,10 @@ static int open_async(const files_struct *fsp,
                return -1;
        }
 
-       ret = pthreadpool_add_job(open_pool,
-                               opd->jobid,
-                               aio_open_worker,
-                               (void *)opd);
+       ret = pthreadpool_pipe_add_job(open_pool,
+                                      opd->jobid,
+                                      aio_open_worker,
+                                      (void *)opd);
        if (ret) {
                errno = ret;
                return -1;
@@ -496,8 +496,8 @@ static struct vfs_fn_pointers vfs_aio_pthread_fns = {
 #endif
 };
 
-NTSTATUS vfs_aio_pthread_init(void);
-NTSTATUS vfs_aio_pthread_init(void)
+NTSTATUS vfs_aio_pthread_init(TALLOC_CTX *);
+NTSTATUS vfs_aio_pthread_init(TALLOC_CTX *ctx)
 {
        return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
                                "aio_pthread", &vfs_aio_pthread_fns);