On 1/31/20 6:52 AM, Glauber Costa wrote: > On Thu, Jan 30, 2020 at 11:31 AM Jens Axboe <axboe@xxxxxxxxx> wrote: >> >> On 1/30/20 9:29 AM, Glauber Costa wrote: >>> On Thu, Jan 30, 2020 at 11:13 AM Jens Axboe <axboe@xxxxxxxxx> wrote: >>>> >>>> On 1/30/20 9:00 AM, Glauber Costa wrote: >>>>> It is common for an application using an ever-evolving interface to want >>>>> to inquire about the presence of certain functionality it plans to use. >>>>> >>>>> Information about opcodes is stored in a io_uring_probe structure. There >>>>> is usually some boilerplate involved in initializing one, and then using >>>>> it to check if it is enabled. >>>>> >>>>> This patch adds two new helper functions: one that returns a pointer to >>>>> a io_uring_probe (or null if it probe is not available), and another one >>>>> that given a probe checks if the opcode is supported. >>>> >>>> This looks good, I committed it with minor changes. >>>> >>>> On top of this, we should have a helper that doesn't need a ring. So >>>> basically one that just sets up a ring, calls io_uring_get_probe(), >>>> then tears down the ring. >>>> >>> I'd be happy to follow up with that. >>> >>> Just to be sure, the information returned by probe should be able to outlive the >>> tear down of the ring, right ? >> >> Yeah, same lifetime as the helper you have now, caller must free it once >> done. > > Well, in hindsight, I should have called that > io_uring_get_probe_ring() so io_uring_get_probe() > doesn't take a ring. Just change it - we just added it yesterday, and it's not released yet. I don't break anything that's been in a release, and I maintain compatibility between releases, but we can change it now. > Alternatively, to keep things in a single function, I can change > io_uring_get_probe() so that if it > ring is NULL, we do our own allocation. > > I actually kind of like that. Would that work for you ? Not a huge deal to me, we can go that route. -- Jens Axboe