Merge "Keep ioprio_value; <linux/ioprio.h> relies on this." into main am: 8fbdc58733 am: 211b6433db am: 289b4ef5f9

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2787554

Change-Id: I32ac9794aa4137020a7be58bc7a8e2bf89f980db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Elliott Hughes 2023-10-13 17:35:09 +00:00 committed by Automerger Merge Worker
commit 7140fb9501
2 changed files with 9 additions and 2 deletions

View file

@ -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",
]
)

View file

@ -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