Merge "Keep ioprio_value; <linux/ioprio.h> relies on this." into main
This commit is contained in:
commit
8fbdc58733
2 changed files with 9 additions and 2 deletions
|
@ -63,6 +63,7 @@ kernel_token_replacements = {
|
|||
# The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>.
|
||||
"__unused": "__linux_unused",
|
||||
# The kernel usage of C++ keywords causes problems for C++ code so rename.
|
||||
"class": "__linux_class",
|
||||
"private": "__linux_private",
|
||||
"virtual": "__linux_virtual",
|
||||
# The non-64 stuff is legacy; msqid64_ds/ipc64_perm is what userspace wants.
|
||||
|
@ -125,6 +126,8 @@ kernel_known_generic_statics = set(
|
|||
# These are required to support the above functions.
|
||||
"__fswahw32",
|
||||
"__fswahb32",
|
||||
# This is used by various macros in <linux/ioprio.h>.
|
||||
"ioprio_value",
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -61,6 +61,10 @@ enum {
|
|||
IOPRIO_HINT_DEV_DURATION_LIMIT_7 = 7,
|
||||
};
|
||||
#define IOPRIO_BAD_VALUE(val,max) ((val) < 0 || (val) >= (max))
|
||||
#define IOPRIO_PRIO_VALUE(class,level) ioprio_value(class, level, IOPRIO_HINT_NONE)
|
||||
#define IOPRIO_PRIO_VALUE_HINT(class,level,hint) ioprio_value(class, level, hint)
|
||||
static __always_inline __u16 ioprio_value(int __linux_class, int level, int hint) {
|
||||
if(IOPRIO_BAD_VALUE(__linux_class, IOPRIO_NR_CLASSES) || IOPRIO_BAD_VALUE(level, IOPRIO_NR_LEVELS) || IOPRIO_BAD_VALUE(hint, IOPRIO_NR_HINTS)) return IOPRIO_CLASS_INVALID << IOPRIO_CLASS_SHIFT;
|
||||
return(__linux_class << IOPRIO_CLASS_SHIFT) | (hint << IOPRIO_HINT_SHIFT) | level;
|
||||
}
|
||||
#define IOPRIO_PRIO_VALUE(class,level) ioprio_value(__linux_class, level, IOPRIO_HINT_NONE)
|
||||
#define IOPRIO_PRIO_VALUE_HINT(class,level,hint) ioprio_value(__linux_class, level, hint)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue