X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=io_uring_engine.h;h=bcb10581cd84c716c0d109d3f266446d141167e5;hb=4696bbc48870f367ca6b03f0a1c17b270d647ab3;hp=470bacf9f4c450cb49d9a25185e8100eb4b073b3;hpb=acce03bb32917e21f2d1d49c5a460d3cd2f72a11;p=plocate diff --git a/io_uring_engine.h b/io_uring_engine.h index 470bacf..bcb1058 100644 --- a/io_uring_engine.h +++ b/io_uring_engine.h @@ -7,6 +7,7 @@ #include #include #include +#include struct io_uring_sqe; #ifndef WITHOUT_URING @@ -18,11 +19,9 @@ public: IOUringEngine(size_t slop_bytes); void submit_read(int fd, size_t len, off_t offset, std::function cb); - // NOTE: We just do the stat() to get the data into the dentry cache for fast access; - // we don't care about the return value. Thus, the callback has no parameter lists. - // If we have no io_uring, the callback will be made immediately, with no stat() call - // being done. - void submit_stat(const char *path, std::function cb); + // NOTE: We just do the stat() to get the data into the dentry cache for fast access, + // or to check whether the file exists. Thus, the callback has only an OK/not OK boolean. + void submit_stat(const char *path, std::function cb); bool get_supports_stat() { return supports_stat; } void finish(); @@ -31,7 +30,7 @@ public: private: #ifndef WITHOUT_URING void submit_read_internal(io_uring_sqe *sqe, int fd, size_t len, off_t offset, std::function cb); - void submit_stat_internal(io_uring_sqe *sqe, char *path, std::function cb); + void submit_stat_internal(io_uring_sqe *sqe, char *path, std::function cb); io_uring ring; #endif @@ -49,7 +48,7 @@ private: struct QueuedStat { char *pathname; // Owned by us. - std::function cb; + std::function cb; }; std::queue queued_stats; @@ -60,7 +59,7 @@ private: Op op; std::function read_cb; - std::function stat_cb; + std::function stat_cb; union { struct {