From 07ca24ec59573ed33cf1f96dfadccb00341227b4 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Wed, 16 Nov 2022 12:37:53 -0700 Subject: [PATCH] thread: Add spdk_thread_get_interrupt_fd_group that returns spdk_fd_group Return the real spdk_fd_group object so it can later be nested. Change-Id: I84c8a174c7d177799fa484b350269082c61b18a5 Signed-off-by: Ben Walker Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15474 Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris Reviewed-by: John Levon --- include/spdk/thread.h | 12 ++++++++++++ lib/thread/spdk_thread.map | 1 + lib/thread/thread.c | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/include/spdk/thread.h b/include/spdk/thread.h index 784c5c443..c40780036 100644 --- a/include/spdk/thread.h +++ b/include/spdk/thread.h @@ -15,6 +15,7 @@ #include #endif +#include "spdk/fd_group.h" #include "spdk/stdinc.h" #include "spdk/assert.h" #include "spdk/cpuset.h" @@ -874,6 +875,17 @@ int spdk_interrupt_set_event_types(struct spdk_interrupt *intr, */ int spdk_thread_get_interrupt_fd(struct spdk_thread *thread); +/** + * Return an fd_group that becomes ready whenever any of the registered + * interrupt file descriptors are ready + * + * + * \param thread The thread to get. + * + * \return The spdk_fd_group of the thread itself. + */ +struct spdk_fd_group *spdk_thread_get_interrupt_fd_group(struct spdk_thread *thread); + /** * Set SPDK run as event driven mode * diff --git a/lib/thread/spdk_thread.map b/lib/thread/spdk_thread.map index 040dbd7ec..abe047bd1 100644 --- a/lib/thread/spdk_thread.map +++ b/lib/thread/spdk_thread.map @@ -55,6 +55,7 @@ spdk_interrupt_unregister; spdk_interrupt_set_event_types; spdk_thread_get_interrupt_fd; + spdk_thread_get_interrupt_fd_group; spdk_interrupt_mode_enable; spdk_interrupt_mode_is_enabled; spdk_spin_init; diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 2033a6ddb..ea514e3bd 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -2877,6 +2877,12 @@ spdk_thread_get_interrupt_fd(struct spdk_thread *thread) return spdk_fd_group_get_fd(thread->fgrp); } +struct spdk_fd_group * +spdk_thread_get_interrupt_fd_group(struct spdk_thread *thread) +{ + return thread->fgrp; +} + static bool g_interrupt_mode = false; int