diff --git a/src/io/uring/Operation.hxx b/src/io/uring/Operation.hxx index aeb059ffb..92be7fb92 100644 --- a/src/io/uring/Operation.hxx +++ b/src/io/uring/Operation.hxx @@ -4,6 +4,8 @@ #pragma once +#include <cassert> + namespace Uring { class CancellableOperation; @@ -33,6 +35,16 @@ public: return cancellable != nullptr; } + /** + * Returns the data pointer that can be passed to + * io_uring_prep_cancel(). + */ + void *GetUringData() const noexcept { + assert(IsUringPending()); + + return cancellable; + } + /** * Cancel the operation. OnUringCompletion() will not be * invoked. This is a no-op if none is pending.