backport to buster
[hcoop/debian/openafs.git] / src / util / work_queue.h
1 /*
2 * Copyright 2008-2010, Sine Nomine Associates and others.
3 * All Rights Reserved.
4 *
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
8 */
9
10 #ifndef AFS_UTIL_WORK_QUEUE_H
11 #define AFS_UTIL_WORK_QUEUE_H 1
12
13 #include "work_queue_types.h"
14
15 /**
16 * public interfaces for package work_queue.
17 */
18 /** @defgroup afs_work_queue Volume Package Work Queue */
19 /*@{*/
20
21 /* XXX move these into an et */
22 #define AFS_WQ_ERROR -1 /**< fatal error in work_queue package */
23 #define AFS_WQ_ERROR_RECOVERABLE -2 /**< soft error in work_queue package */
24 #define AFS_WQ_ERROR_RESCHEDULE -3 /**< reschedule work node for execution */
25
26 extern void afs_wq_opts_init(struct afs_work_queue_opts *);
27 extern void afs_wq_opts_calc_thresh(struct afs_work_queue_opts *, int);
28 extern int afs_wq_create(struct afs_work_queue **,
29 void * rock,
30 struct afs_work_queue_opts *);
31 extern int afs_wq_destroy(struct afs_work_queue *);
32
33 extern int afs_wq_shutdown(struct afs_work_queue *);
34
35 extern int afs_wq_node_alloc(struct afs_work_queue_node **);
36 extern int afs_wq_node_get(struct afs_work_queue_node *);
37 extern int afs_wq_node_put(struct afs_work_queue_node *);
38 extern int afs_wq_node_set_callback(struct afs_work_queue_node *,
39 afs_wq_callback_func_t *,
40 void * rock, afs_wq_callback_dtor_t *dtor);
41 extern int afs_wq_node_set_detached(struct afs_work_queue_node *);
42 extern int afs_wq_node_dep_add(struct afs_work_queue_node *,
43 struct afs_work_queue_node *);
44 extern int afs_wq_node_dep_del(struct afs_work_queue_node *,
45 struct afs_work_queue_node *);
46 extern int afs_wq_node_block(struct afs_work_queue_node *);
47 extern int afs_wq_node_unblock(struct afs_work_queue_node *);
48 extern void afs_wq_add_opts_init(struct afs_work_queue_add_opts *);
49 extern int afs_wq_add(struct afs_work_queue *,
50 struct afs_work_queue_node *,
51 struct afs_work_queue_add_opts *);
52 extern int afs_wq_del(struct afs_work_queue_node *);
53
54 extern int afs_wq_do(struct afs_work_queue *,
55 void * rock);
56 extern int afs_wq_do_nowait(struct afs_work_queue *,
57 void * rock);
58
59 extern int afs_wq_wait_all(struct afs_work_queue *);
60 extern int afs_wq_node_wait(struct afs_work_queue_node *,
61 int * retcode);
62
63 /*@}*/
64 #endif /* AFS_UTIL_WORK_QUEUE_H */