const struct btf_member *member,
void *kdata, const void *udata)
{
+ u32 moff = __btf_member_bit_offset(t, member) / 8;
+ const struct io_uring_ops *uops = udata;
+ struct io_uring_ops *ops = kdata;
+
+ switch (moff) {
+ case offsetof(struct io_uring_ops, ring_fd):
+ ops->ring_fd = uops->ring_fd;
+ return 1;
+ }
+ return 0;
Possible to pass in here whether the ring fd is registered or not? Such
that it can be used in bpf_io_reg() as well.
Unregistration needs to be sync'ed with waiters, and that can easily+static int io_register_bpf_ops(struct io_ring_ctx *ctx, struct io_uring_ops *ops)
+{
+ if (ctx->bpf_ops)
+ return -EBUSY;
+ if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
+ return -EOPNOTSUPP;
+
+ percpu_ref_get(&ctx->refs);
+ ops->ctx = ctx;
+ ctx->bpf_ops = ops;
return 0;
}
Haven't looked too deeply yet, but what's the dependency with
DEFER_TASKRUN?