| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: workqueue.h,v 1.16 2021/12/19 01:03:57 riastradh Exp $ */ | | 1 | /* $NetBSD: workqueue.h,v 1.17 2021/12/19 01:04:05 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -35,41 +35,43 @@ | | | @@ -35,41 +35,43 @@ |
35 | #include <sys/queue.h> | | 35 | #include <sys/queue.h> |
36 | #include <sys/stdbool.h> | | 36 | #include <sys/stdbool.h> |
37 | | | 37 | |
38 | #include <linux/kernel.h> /* container_of */ | | 38 | #include <linux/kernel.h> /* container_of */ |
39 | | | 39 | |
40 | #define INIT_DELAYED_WORK linux_INIT_DELAYED_WORK | | 40 | #define INIT_DELAYED_WORK linux_INIT_DELAYED_WORK |
41 | #define INIT_WORK linux_INIT_WORK | | 41 | #define INIT_WORK linux_INIT_WORK |
42 | #define alloc_ordered_workqueue linux_alloc_ordered_workqueue | | 42 | #define alloc_ordered_workqueue linux_alloc_ordered_workqueue |
43 | #define cancel_delayed_work linux_cancel_delayed_work | | 43 | #define cancel_delayed_work linux_cancel_delayed_work |
44 | #define cancel_delayed_work_sync linux_cancel_delayed_work_sync | | 44 | #define cancel_delayed_work_sync linux_cancel_delayed_work_sync |
45 | #define cancel_work linux_cancel_work | | 45 | #define cancel_work linux_cancel_work |
46 | #define cancel_work_sync linux_cancel_work_sync | | 46 | #define cancel_work_sync linux_cancel_work_sync |
47 | #define current_work linux_current_work | | 47 | #define current_work linux_current_work |
| | | 48 | #define delayed_work_pending linux_delayed_work_pending |
48 | #define destroy_workqueue linux_destroy_workqueue | | 49 | #define destroy_workqueue linux_destroy_workqueue |
49 | #define flush_delayed_work linux_flush_delayed_work | | 50 | #define flush_delayed_work linux_flush_delayed_work |
50 | #define flush_scheduled_work linux_flush_scheduled_work | | 51 | #define flush_scheduled_work linux_flush_scheduled_work |
51 | #define flush_work linux_flush_work | | 52 | #define flush_work linux_flush_work |
52 | #define flush_workqueue linux_flush_workqueue | | 53 | #define flush_workqueue linux_flush_workqueue |
53 | #define queue_delayed_work linux_queue_delayed_work | | 54 | #define queue_delayed_work linux_queue_delayed_work |
54 | #define mod_delayed_work linux_mod_delayed_work | | 55 | #define mod_delayed_work linux_mod_delayed_work |
55 | #define queue_work linux_queue_work | | 56 | #define queue_work linux_queue_work |
56 | #define schedule_delayed_work linux_schedule_delayed_work | | 57 | #define schedule_delayed_work linux_schedule_delayed_work |
57 | #define schedule_work linux_schedule_work | | 58 | #define schedule_work linux_schedule_work |
58 | #define system_long_wq linux_system_long_wq | | 59 | #define system_long_wq linux_system_long_wq |
59 | #define system_power_efficient_wq linux_system_power_efficient_wq | | 60 | #define system_power_efficient_wq linux_system_power_efficient_wq |
60 | #define system_unbound_wq linux_system_unbound_wq | | 61 | #define system_unbound_wq linux_system_unbound_wq |
61 | #define system_wq linux_system_wq | | 62 | #define system_wq linux_system_wq |
62 | #define to_delayed_work linux_to_delayed_work | | 63 | #define to_delayed_work linux_to_delayed_work |
| | | 64 | #define work_pending linux_work_pending |
63 | | | 65 | |
64 | struct workqueue_struct; | | 66 | struct workqueue_struct; |
65 | | | 67 | |
66 | struct work_struct { | | 68 | struct work_struct { |
67 | volatile uintptr_t work_owner; | | 69 | volatile uintptr_t work_owner; |
68 | TAILQ_ENTRY(work_struct) work_entry; | | 70 | TAILQ_ENTRY(work_struct) work_entry; |
69 | void (*func)(struct work_struct *); /* Linux API name */ | | 71 | void (*func)(struct work_struct *); /* Linux API name */ |
70 | }; | | 72 | }; |
71 | | | 73 | |
72 | struct delayed_work { | | 74 | struct delayed_work { |
73 | struct work_struct work; /* Linux API name */ | | 75 | struct work_struct work; /* Linux API name */ |
74 | struct callout dw_callout; | | 76 | struct callout dw_callout; |
75 | TAILQ_ENTRY(delayed_work) dw_entry; | | 77 | TAILQ_ENTRY(delayed_work) dw_entry; |
| @@ -101,36 +103,38 @@ void linux_workqueue_fini(void); | | | @@ -101,36 +103,38 @@ void linux_workqueue_fini(void); |
101 | | | 103 | |
102 | struct workqueue_struct * | | 104 | struct workqueue_struct * |
103 | alloc_ordered_workqueue(const char *, int); | | 105 | alloc_ordered_workqueue(const char *, int); |
104 | void destroy_workqueue(struct workqueue_struct *); | | 106 | void destroy_workqueue(struct workqueue_struct *); |
105 | void flush_workqueue(struct workqueue_struct *); | | 107 | void flush_workqueue(struct workqueue_struct *); |
106 | void flush_scheduled_work(void); | | 108 | void flush_scheduled_work(void); |
107 | | | 109 | |
108 | void INIT_WORK(struct work_struct *, void (*)(struct work_struct *)); | | 110 | void INIT_WORK(struct work_struct *, void (*)(struct work_struct *)); |
109 | bool schedule_work(struct work_struct *); | | 111 | bool schedule_work(struct work_struct *); |
110 | bool queue_work(struct workqueue_struct *, struct work_struct *); | | 112 | bool queue_work(struct workqueue_struct *, struct work_struct *); |
111 | bool cancel_work(struct work_struct *); | | 113 | bool cancel_work(struct work_struct *); |
112 | bool cancel_work_sync(struct work_struct *); | | 114 | bool cancel_work_sync(struct work_struct *); |
113 | bool flush_work(struct work_struct *); | | 115 | bool flush_work(struct work_struct *); |
| | | 116 | bool work_pending(struct work_struct *); |
114 | | | 117 | |
115 | void INIT_DELAYED_WORK(struct delayed_work *, | | 118 | void INIT_DELAYED_WORK(struct delayed_work *, |
116 | void (*)(struct work_struct *)); | | 119 | void (*)(struct work_struct *)); |
117 | bool schedule_delayed_work(struct delayed_work *, unsigned long); | | 120 | bool schedule_delayed_work(struct delayed_work *, unsigned long); |
118 | bool queue_delayed_work(struct workqueue_struct *, struct delayed_work *, | | 121 | bool queue_delayed_work(struct workqueue_struct *, struct delayed_work *, |
119 | unsigned long ticks); | | 122 | unsigned long ticks); |
120 | bool mod_delayed_work(struct workqueue_struct *, struct delayed_work *, | | 123 | bool mod_delayed_work(struct workqueue_struct *, struct delayed_work *, |
121 | unsigned long ticks); | | 124 | unsigned long ticks); |
122 | bool cancel_delayed_work(struct delayed_work *); | | 125 | bool cancel_delayed_work(struct delayed_work *); |
123 | bool cancel_delayed_work_sync(struct delayed_work *); | | 126 | bool cancel_delayed_work_sync(struct delayed_work *); |
124 | bool flush_delayed_work(struct delayed_work *); | | 127 | bool flush_delayed_work(struct delayed_work *); |
| | | 128 | bool delayed_work_pending(struct delayed_work *); |
125 | | | 129 | |
126 | struct work_struct * | | 130 | struct work_struct * |
127 | current_work(void); | | 131 | current_work(void); |
128 | | | 132 | |
129 | #define INIT_WORK_ONSTACK INIT_WORK | | 133 | #define INIT_WORK_ONSTACK INIT_WORK |
130 | | | 134 | |
131 | static inline void | | 135 | static inline void |
132 | destroy_work_on_stack(struct work_struct *work) | | 136 | destroy_work_on_stack(struct work_struct *work) |
133 | { | | 137 | { |
134 | } | | 138 | } |
135 | | | 139 | |
136 | #endif /* _LINUX_WORKQUEUE_H_ */ | | 140 | #endif /* _LINUX_WORKQUEUE_H_ */ |