- * struct io_plan - one half of I/O to do
- * @status: the status of this plan.
- * @io: function to call when fd becomes read/writable, returns 0 to be
- * called again, 1 if it's finished, and -1 on error (fd will be closed)
- * @next: the next function which is called if io returns 1.
- * @next_arg: the argument to @next
- * @u1, @u2: scratch space for @io.
+ * io_plan_arg - get a conn's io_plan_arg for a given direction.
+ * @conn: the connection.
+ * @dir: IO_IN or IO_OUT.
+ *
+ * This is how an io helper gets scratch space to store into; you must call
+ * io_set_plan() when you've initialized it.
+ *
+ * Example:
+ * // Simple helper to read a single char.
+ * static int do_readchar(int fd, struct io_plan_arg *arg)
+ * {
+ * return read(fd, arg->u1.cp, 1) <= 0 ? -1 : 1;
+ * }
+ *
+ * struct io_plan *io_read_char_(struct io_conn *conn, char *in,
+ * struct io_plan *(*next)(struct io_conn*,void*),
+ * void *arg)
+ * {
+ * struct io_plan_arg *arg = io_get_plan_arg(conn, IO_IN);
+ *
+ * // Store information we need in the plan unions u1 and u2.
+ * arg->u1.cp = in;
+ *
+ * return io_set_plan(conn, IO_IN, do_readchar, next, arg);
+ * }