Thread (60 messages) flat view 60 messages, 8 authors, 2024-10-28

Re: [PATCH v1 03/14] futex: Flag conversion

From: Peter Zijlstra <peterz@infradead.org>
Date: 2023-07-31 16:28:24
Also in: linux-arch, linux-mm, lkml

On Mon, Jul 31, 2023 at 06:21:56PM +0200, Thomas Gleixner wrote:
On Fri, Jul 21 2023 at 12:22, Peter Zijlstra wrote:
quoted
+
+static inline bool futex_flags_valid(unsigned int flags)
+{
+	/* Only 64bit futexes for 64bit code */
+	if (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()) {
+		if ((flags & FLAGS_SIZE_MASK) == FLAGS_SIZE_64)
+			return false;
+	}
+
+	/* Only 32bit futexes are implemented -- for now */
+	if ((flags & FLAGS_SIZE_MASK) != FLAGS_SIZE_32)
+		return false;
+
+	return true;
+}
+
+static inline unsigned int futex_size(unsigned int flags)
+{
+	unsigned int size = flags & FLAGS_SIZE_MASK;
+	return 1 << size; /* {0,1,2,3} -> {1,2,4,8} */
Lacks a new line and the comment is both misplaced and kinda obvious, no?
Yeah, it was a more complicated transform at some point, I'll fix.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help