summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMax Kellermann <max.kellermann@ionos.com>2023-09-21 09:57:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-31 16:17:09 -0800
commit6f5c4aaddd637d3e19a222312ba170ab851437dd (patch)
treecc5fa944112e650cda8cbf0b4a651a95648559d0 /include
parent28f010dc50df0f7987c04112114fcfa7e0803566 (diff)
downloadlinux-stable-6f5c4aaddd637d3e19a222312ba170ab851437dd.tar.gz
linux-stable-6f5c4aaddd637d3e19a222312ba170ab851437dd.tar.bz2
linux-stable-6f5c4aaddd637d3e19a222312ba170ab851437dd.zip
fs/pipe: move check to pipe_has_watch_queue()
[ Upstream commit b4bd6b4bac8edd61eb8f7b836969d12c0c6af165 ] This declutters the code by reducing the number of #ifdefs and makes the watch_queue checks simpler. This has no runtime effect; the machine code is identical. Signed-off-by: Max Kellermann <max.kellermann@ionos.com> Message-Id: <20230921075755.1378787-2-max.kellermann@ionos.com> Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Christian Brauner <brauner@kernel.org> Stable-dep-of: e95aada4cb93 ("pipe: wakeup wr_wait after setting max_usage") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/pipe_fs_i.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 28b3c6a67397..1f1e7ae95320 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -125,6 +125,22 @@ struct pipe_buf_operations {
};
/**
+ * pipe_has_watch_queue - Check whether the pipe is a watch_queue,
+ * i.e. it was created with O_NOTIFICATION_PIPE
+ * @pipe: The pipe to check
+ *
+ * Return: true if pipe is a watch queue, false otherwise.
+ */
+static inline bool pipe_has_watch_queue(const struct pipe_inode_info *pipe)
+{
+#ifdef CONFIG_WATCH_QUEUE
+ return pipe->watch_queue != NULL;
+#else
+ return false;
+#endif
+}
+
+/**
* pipe_empty - Return true if the pipe is empty
* @head: The pipe ring head pointer
* @tail: The pipe ring tail pointer