| 1 |
/* |
| 2 |
* task_work compatibility defines and inlines |
| 3 |
* Copyright (C) 2012 Red Hat Inc. |
| 4 |
* |
| 5 |
* This file is part of systemtap, and is free software. You can |
| 6 |
* redistribute it and/or modify it under the terms of the GNU General |
| 7 |
* Public License (GPL); either version 2, or (at your option) any |
| 8 |
* later version. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef _TASK_WORK_COMPATIBILITY_H_ |
| 12 |
#define _TASK_WORK_COMPATIBILITY_H_ |
| 13 |
|
| 14 |
#include <linux/task_work.h> |
| 15 |
|
| 16 |
/* |
| 17 |
* Define all the old task_work stuff in terms of the new |
| 18 |
* interface/names - except for the name of the structure |
| 19 |
* itself. Originally the task_work stuff had a custom structure, |
| 20 |
* called 'struct task_work'. The new interface uses a common |
| 21 |
* structure, 'struct callback_head'. If we define 'callback_head' to |
| 22 |
* be a 'task_work', then we could never use the common structure on |
| 23 |
* systems with the old interface. |
| 24 |
*/ |
| 25 |
|
| 26 |
#ifdef STAPCONF_TASK_WORK_STRUCT |
| 27 |
|
| 28 |
static inline void |
| 29 |
stp_init_task_work(struct task_work *twork, task_work_func_t func) |
| 30 |
{ |
| 31 |
init_task_work(twork, func, NULL); |
| 32 |
} |
| 33 |
|
| 34 |
#else /* !STAPCONF_TASK_WORK_STRUCT */ |
| 35 |
|
| 36 |
#define task_work callback_head |
| 37 |
|
| 38 |
static inline void |
| 39 |
stp_init_task_work(struct task_work *twork, task_work_func_t func) |
| 40 |
{ |
| 41 |
init_task_work(twork, func); |
| 42 |
} |
| 43 |
|
| 44 |
#endif /* !STAPCONF_TASK_WORK_STRUCT */ |
| 45 |
|
| 46 |
#ifndef STAPCONF_TWA_RESUME |
| 47 |
#define TWA_RESUME true |
| 48 |
#endif |
| 49 |
|
| 50 |
#endif /* _TASK_WORK_COMPATIBILITY_H_ */ |