Mike and I spent some time talking about how to move forward with AioContext vs. glib. I think the best proposal so far is to add a common API on top of the *aio* interfaces and the existing qemu_set_fd_handler main loop functions.
Then we get code sharing while still having multiple main loop implementations until we can converge on a single one since the users will consume the same interface at least. The only thing standing in the way is the inability to map the semantics of io_flush. I think an easy way to do this is to keep track of the events registered through *aio* and let aio_flush() block as long as any event is registered. That's precisely what this series starts to do. It's untested and extremely incomplete but I wanted to get some feedback first before we put any serious effort into this and make sure it's an agreeable approach.