]> git.ozlabs.org Git - ccan/commitdiff
ccan/io: rename io_op to io_plan.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)
This is a better description, since it's I/O we plan to do next.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
19 files changed:
ccan/io/_info
ccan/io/backend.h
ccan/io/benchmarks/run-different-speed.c
ccan/io/benchmarks/run-length-prefix.c
ccan/io/benchmarks/run-loop.c
ccan/io/io.c
ccan/io/io.h
ccan/io/poll.c
ccan/io/test/run-01-start-finish.c
ccan/io/test/run-02-read.c
ccan/io/test/run-03-readpartial.c
ccan/io/test/run-04-writepartial.c
ccan/io/test/run-05-write.c
ccan/io/test/run-06-idle.c
ccan/io/test/run-07-break.c
ccan/io/test/run-10-many.c
ccan/io/test/run-12-bidir.c
ccan/io/test/run-13-all-idle.c
ccan/io/test/run-15-timeout.c

index d596b4deb11d401b40b3d2210eab80c8ceedff69..935705f1639a5a4e2cde93e54aa6adca444bda4e 100644 (file)
  * };
  *
  * // This reads from stdin.
- * static struct io_op *wake_writer(struct io_conn *, struct stdin_buffer *);
+ * static struct io_plan *wake_writer(struct io_conn *, struct stdin_buffer *);
  * // This writes the stdin buffer to the child.
- * static struct io_op *write_to_child(struct io_conn *c,
- *                                    struct stdin_buffer *b);
- * static struct io_op *read_stdin(struct io_conn *c, struct stdin_buffer *b)
+ * static struct io_plan *write_to_child(struct io_conn *c,
+ *                                      struct stdin_buffer *b);
+ * static struct io_plan *read_stdin(struct io_conn *c, struct stdin_buffer *b)
  * {
  *     assert(c == b->reader);
  *     b->len = sizeof(b->inbuf);
@@ -44,7 +44,7 @@
  *                            io_next(c, wake_writer, b));
  * }
  *
- * static struct io_op *wake_writer(struct io_conn *c, struct stdin_buffer *b)
+ * static struct io_plan *wake_writer(struct io_conn *c, struct stdin_buffer *b)
  * {
  *     assert(c == b->reader);
  *     io_wake(b->writer, write_to_child, b);
  *     b->reader = NULL;
  * }
  *
- * static struct io_op *wake_reader(struct io_conn *c, struct stdin_buffer *b)
+ * static struct io_plan *wake_reader(struct io_conn *c, struct stdin_buffer *b)
  * {
  *     assert(c == b->writer);
  *     io_wake(b->reader, read_stdin, b);
  *     return io_idle(c);
  * }
  *
- * static struct io_op *write_to_child(struct io_conn *conn,
- *                                   struct stdin_buffer *b)
+ * static struct io_plan *write_to_child(struct io_conn *conn,
+ *                                     struct stdin_buffer *b)
  * {
  *     assert(conn == b->writer);
  *     if (!b->reader)
@@ -74,8 +74,8 @@
  *     return io_write(b->inbuf, b->len, io_next(conn, wake_reader, b));
  * }
  *
- * static struct io_op *start_writer(struct io_conn *conn,
- *                                  struct stdin_buffer *b)
+ * static struct io_plan *start_writer(struct io_conn *conn,
+ *                                    struct stdin_buffer *b)
  * {
  *     assert(conn == b->writer);
  *     return io_idle(conn);
@@ -88,8 +88,8 @@
  * }
  *
  * // This reads from the child and saves it into buffer.
- * static struct io_op *read_from_child(struct io_conn *conn,
- *                                     struct buffer *b)
+ * static struct io_plan *read_from_child(struct io_conn *conn,
+ *                                       struct buffer *b)
  * {
  *     b->off += b->rlen;
  *
index a36dee9b1a727c5dc0658fd7d418884b4eccb29d..3c5b3f8b781bb38ab014fee995b9272ad4164c28 100644 (file)
@@ -9,7 +9,7 @@ struct fd {
        bool listener;
        size_t backend_info;
 
-       struct io_op *(*next)(struct io_conn *, void *arg);
+       struct io_plan *(*next)(struct io_conn *, void *arg);
        void *next_arg;
 
        void (*finish)(struct io_conn *, void *arg);
@@ -37,7 +37,7 @@ enum io_state {
        PROCESSING /* We expect them to change this now. */
 };
 
-static inline enum io_state from_ioop(struct io_op *op)
+static inline enum io_state from_ioplan(struct io_plan *op)
 {
        return (enum io_state)(long)op;
 }
@@ -66,7 +66,7 @@ struct io_timeout {
        struct timer timer;
        struct io_conn *conn;
 
-       struct io_op *(*next)(struct io_conn *, void *arg);
+       struct io_plan *(*next)(struct io_conn *, void *arg);
        void *next_arg;
 };
 
@@ -97,9 +97,9 @@ bool add_listener(struct io_listener *l);
 bool add_conn(struct io_conn *c);
 bool add_duplex(struct io_conn *c);
 void del_listener(struct io_listener *l);
-void backend_set_state(struct io_conn *conn, struct io_op *op);
+void backend_set_state(struct io_conn *conn, struct io_plan *op);
 void backend_add_timeout(struct io_conn *conn, struct timespec ts);
 void backend_del_timeout(struct io_conn *conn);
 
-struct io_op *do_ready(struct io_conn *conn);
+struct io_plan *do_ready(struct io_conn *conn);
 #endif /* CCAN_IO_BACKEND_H */
index e21b1dd9a1da96356f45f8488069bed165879124..cbc9ad6a9f81c6cc531afe7d258a91d4163ef544 100644 (file)
@@ -25,21 +25,21 @@ struct client {
        char reply_buffer[REPLY_SIZE];
 };
 
-static struct io_op *write_reply(struct io_conn *conn, struct client *client);
-static struct io_op *read_request(struct io_conn *conn, struct client *client)
+static struct io_plan *write_reply(struct io_conn *conn, struct client *client);
+static struct io_plan *read_request(struct io_conn *conn, struct client *client)
 {
        return io_read(client->request_buffer, REQUEST_SIZE,
                       io_next(conn, write_reply, client));
 }
 
 /* once we're done, loop again. */
-static struct io_op *write_complete(struct io_conn *conn, struct client *client)
+static struct io_plan *write_complete(struct io_conn *conn, struct client *client)
 {
        completed++;
        return read_request(conn, client);
 }
 
-static struct io_op *write_reply(struct io_conn *conn, struct client *client)
+static struct io_plan *write_reply(struct io_conn *conn, struct client *client)
 {
        return io_write(client->reply_buffer, REPLY_SIZE,
                        io_next(conn, write_complete, client));
@@ -106,12 +106,12 @@ static void sigalarm(int sig)
        write(timeout[1], "1", 1);
 }
 
-static struct io_op *do_timeout(struct io_conn *conn, char *buf)
+static struct io_plan *do_timeout(struct io_conn *conn, char *buf)
 {
        return io_break(conn, NULL);
 }
 
-static struct io_op *do_timeout_read(struct io_conn *conn, char *buf)
+static struct io_plan *do_timeout_read(struct io_conn *conn, char *buf)
 {
        return io_read(buf, 1, io_next(conn, do_timeout, buf));
 }
index 7d0336348e0028a922afe777b427f4ffa42628ed..8a276839395223dfb403db4e5102b9d4c6eae890 100644 (file)
@@ -25,28 +25,28 @@ struct client {
        char *request_buffer;
 };
 
-static struct io_op *write_reply(struct io_conn *conn, struct client *client);
-static struct io_op *read_body(struct io_conn *conn, struct client *client)
+static struct io_plan *write_reply(struct io_conn *conn, struct client *client);
+static struct io_plan *read_body(struct io_conn *conn, struct client *client)
 {
        assert(client->len <= REQUEST_MAX);
        return io_read(client->request_buffer, client->len,
                       io_next(conn, write_reply, client));
 }
 
-static struct io_op *read_header(struct io_conn *conn, struct client *client)
+static struct io_plan *read_header(struct io_conn *conn, struct client *client)
 {
        return io_read(&client->len, sizeof(client->len),
                       io_next(conn, read_body, client));
 }
 
 /* once we're done, loop again. */
-static struct io_op *write_complete(struct io_conn *conn, struct client *client)
+static struct io_plan *write_complete(struct io_conn *conn, struct client *client)
 {
        completed++;
        return read_header(conn, client);
 }
 
-static struct io_op *write_reply(struct io_conn *conn, struct client *client)
+static struct io_plan *write_reply(struct io_conn *conn, struct client *client)
 {
        return io_write(&client->len, sizeof(client->len),
                        io_next(conn, write_complete, client));
@@ -112,12 +112,12 @@ static void sigalarm(int sig)
        write(timeout[1], "1", 1);
 }
 
-static struct io_op *do_timeout(struct io_conn *conn, char *buf)
+static struct io_plan *do_timeout(struct io_conn *conn, char *buf)
 {
        return io_break(conn, NULL);
 }
 
-static struct io_op *do_timeout_read(struct io_conn *conn, char *buf)
+static struct io_plan *do_timeout_read(struct io_conn *conn, char *buf)
 {
        return io_read(buf, 1, io_next(conn, do_timeout, buf));
 }
index 9af564c736d3a226535d9e13c14fd1d8df312177..7b1aef5a96acb46171e9ca4df1babad8c746520d 100644 (file)
@@ -16,10 +16,10 @@ struct buffer {
        char buf[32];
 };
 
-static struct io_op *poke_writer(struct io_conn *conn, struct buffer *buf);
-static struct io_op *poke_reader(struct io_conn *conn, struct buffer *buf);
+static struct io_plan *poke_writer(struct io_conn *conn, struct buffer *buf);
+static struct io_plan *poke_reader(struct io_conn *conn, struct buffer *buf);
 
-static struct io_op *do_read(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *do_read(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->reader);
 
@@ -27,7 +27,7 @@ static struct io_op *do_read(struct io_conn *conn, struct buffer *buf)
                       io_next(conn, poke_writer, buf));
 }
 
-static struct io_op *do_write(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *do_write(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->writer);
 
@@ -35,7 +35,7 @@ static struct io_op *do_write(struct io_conn *conn, struct buffer *buf)
                        io_next(conn, poke_reader, buf));
 }
 
-static struct io_op *poke_writer(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *poke_writer(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->reader);
 
@@ -49,7 +49,7 @@ static struct io_op *poke_writer(struct io_conn *conn, struct buffer *buf)
        return io_idle(conn);
 }
 
-static struct io_op *poke_reader(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *poke_reader(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->writer);
        /* You read. */
@@ -62,7 +62,7 @@ static struct io_op *poke_reader(struct io_conn *conn, struct buffer *buf)
        return io_idle(conn);
 }
 
-static struct io_op *reader(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *reader(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->reader);
 
index 84c2ccad0c2c0ac032201ab6fb8bce44a05f1a23..210e55876bf083c354a6ce8c4436f14149782920 100644 (file)
@@ -12,8 +12,8 @@
 void *io_loop_return;
 
 struct io_listener *io_new_listener_(int fd,
-                                    struct io_op *(*start)(struct io_conn *,
-                                                           void *arg),
+                                    struct io_plan *(*start)(struct io_conn *,
+                                                             void *arg),
                                     void (*finish)(struct io_conn *, void *),
                                     void *arg)
 {
@@ -42,7 +42,7 @@ void io_close_listener(struct io_listener *l)
 }
 
 struct io_conn *io_new_conn_(int fd,
-                            struct io_op *(*start)(struct io_conn *, void *),
+                            struct io_plan *(*start)(struct io_conn *, void *),
                             void (*finish)(struct io_conn *, void *),
                             void *arg)
 {
@@ -67,7 +67,7 @@ struct io_conn *io_new_conn_(int fd,
 }
 
 struct io_conn *io_duplex_(struct io_conn *old,
-                            struct io_op *(*start)(struct io_conn *, void *),
+                            struct io_plan *(*start)(struct io_conn *, void *),
                             void (*finish)(struct io_conn *, void *),
                             void *arg)
 {
@@ -101,9 +101,9 @@ static inline struct io_next *to_ionext(struct io_conn *conn)
        return (struct io_next *)conn;
 }
 
-static inline struct io_op *to_ioop(enum io_state state)
+static inline struct io_plan *to_ioplan(enum io_state state)
 {
-       return (struct io_op *)(long)state;
+       return (struct io_plan *)(long)state;
 }
 
 static inline struct io_conn *from_ionext(struct io_next *next)
@@ -112,7 +112,7 @@ static inline struct io_conn *from_ionext(struct io_next *next)
 }
 
 struct io_next *io_next_(struct io_conn *conn,
-                        struct io_op *(*next)(struct io_conn *, void *),
+                        struct io_plan *(*next)(struct io_conn *, void *),
                         void *arg)
 {
        conn->fd.next = next;
@@ -122,7 +122,7 @@ struct io_next *io_next_(struct io_conn *conn,
 }
 
 bool io_timeout_(struct io_conn *conn, struct timespec ts,
-                struct io_op *(*next)(struct io_conn *, void *), void *arg)
+                struct io_plan *(*next)(struct io_conn *, void *), void *arg)
 {
        if (!conn->timeout) {
                conn->timeout = malloc(sizeof(*conn->timeout));
@@ -138,48 +138,48 @@ bool io_timeout_(struct io_conn *conn, struct timespec ts,
 }
 
 /* Queue some data to be written. */
-struct io_op *io_write(const void *data, size_t len, struct io_next *next)
+struct io_plan *io_write(const void *data, size_t len, struct io_next *next)
 {
        struct io_conn *conn = from_ionext(next);
        conn->u.write.buf = data;
        conn->u.write.len = len;
-       return to_ioop(WRITE);
+       return to_ioplan(WRITE);
 }
 
 /* Queue a request to read into a buffer. */
-struct io_op *io_read(void *data, size_t len, struct io_next *next)
+struct io_plan *io_read(void *data, size_t len, struct io_next *next)
 {
        struct io_conn *conn = from_ionext(next);
        conn->u.read.buf = data;
        conn->u.read.len = len;
-       return to_ioop(READ);
+       return to_ioplan(READ);
 }
 
 /* Queue a partial request to read into a buffer. */
-struct io_op *io_read_partial(void *data, size_t *len, struct io_next *next)
+struct io_plan *io_read_partial(void *data, size_t *len, struct io_next *next)
 {
        struct io_conn *conn = from_ionext(next);
        conn->u.readpart.buf = data;
        conn->u.readpart.lenp = len;
-       return to_ioop(READPART);
+       return to_ioplan(READPART);
 }
 
 /* Queue a partial write request. */
-struct io_op *io_write_partial(const void *data, size_t *len, struct io_next *next)
+struct io_plan *io_write_partial(const void *data, size_t *len, struct io_next *next)
 {
        struct io_conn *conn = from_ionext(next);
        conn->u.writepart.buf = data;
        conn->u.writepart.lenp = len;
-       return to_ioop(WRITEPART);
+       return to_ioplan(WRITEPART);
 }
 
-struct io_op *io_idle(struct io_conn *conn)
+struct io_plan *io_idle(struct io_conn *conn)
 {
-       return to_ioop(IDLE);
+       return to_ioplan(IDLE);
 }
 
 void io_wake_(struct io_conn *conn,
-             struct io_op *(*next)(struct io_conn *, void *), void *arg)
+             struct io_plan *(*next)(struct io_conn *, void *), void *arg)
 
 {
        /* It might have finished, but we haven't called its finish() yet. */
@@ -188,17 +188,17 @@ void io_wake_(struct io_conn *conn,
        assert(conn->state == IDLE);
        conn->fd.next = next;
        conn->fd.next_arg = arg;
-       backend_set_state(conn, to_ioop(NEXT));
+       backend_set_state(conn, to_ioplan(NEXT));
 }
 
-static struct io_op *do_next(struct io_conn *conn)
+static struct io_plan *do_next(struct io_conn *conn)
 {
        if (timeout_active(conn))
                backend_del_timeout(conn);
        return conn->fd.next(conn, conn->fd.next_arg);
 }
 
-struct io_op *do_ready(struct io_conn *conn)
+struct io_plan *do_ready(struct io_conn *conn)
 {
        ssize_t ret;
        bool finished;
@@ -243,20 +243,20 @@ struct io_op *do_ready(struct io_conn *conn)
 
        if (finished)
                return do_next(conn);
-       return to_ioop(conn->state);
+       return to_ioplan(conn->state);
 }
 
 /* Useful next functions. */
 /* Close the connection, we're done. */
-struct io_op *io_close(struct io_conn *conn, void *arg)
+struct io_plan *io_close(struct io_conn *conn, void *arg)
 {
-       return to_ioop(FINISHED);
+       return to_ioplan(FINISHED);
 }
 
 /* Exit the loop, returning this (non-NULL) arg. */
-struct io_op *io_break(void *arg, struct io_next *next)
+struct io_plan *io_break(void *arg, struct io_next *next)
 {
        io_loop_return = arg;
 
-       return to_ioop(NEXT);
+       return to_ioplan(NEXT);
 }
index a481c5f3de67d7f671e0017ca29d035f568f98a0..629023f92b6c0073ea2203c78293bf72305e2cb2 100644 (file)
@@ -7,12 +7,11 @@
 #include <unistd.h>
 
 /**
- * struct io_op - pointer to return from io functions.
+ * struct io_plan - pointer to return from a setup function.
  *
- * This undefined structure is just to help the compiler check that you
- * really do return the result of an io-queueing method.
+ * A plan of what IO to do, when.
  */
-struct io_op;
+struct io_plan;
 
 /**
  * struct io_next - pointer to what we're going to do next.
@@ -40,13 +39,13 @@ struct io_next;
  */
 #define io_new_conn(fd, start, finish, arg)                            \
        io_new_conn_((fd),                                              \
-                    typesafe_cb_preargs(struct io_op *, void *,        \
+                    typesafe_cb_preargs(struct io_plan *, void *,      \
                                         (start), (arg), struct io_conn *), \
                     typesafe_cb_preargs(void, void *, (finish), (arg), \
                                         struct io_conn *),             \
                     (arg))
 struct io_conn *io_new_conn_(int fd,
-                            struct io_op *(*start)(struct io_conn *, void *),
+                            struct io_plan *(*start)(struct io_conn *, void *),
                             void (*finish)(struct io_conn *, void *),
                             void *arg);
 
@@ -64,15 +63,15 @@ struct io_conn *io_new_conn_(int fd,
  */
 #define io_new_listener(fd, start, finish, arg)                                \
        io_new_listener_((fd),                                          \
-                        typesafe_cb_preargs(struct io_op *, void *,    \
+                        typesafe_cb_preargs(struct io_plan *, void *,  \
                                             (start), (arg),            \
                                             struct io_conn *),         \
                         typesafe_cb_preargs(void, void *, (finish),    \
                                             (arg), struct io_conn *),  \
                         (arg))
 struct io_listener *io_new_listener_(int fd,
-                                    struct io_op *(*start)(struct io_conn *,
-                                                           void *arg),
+                                    struct io_plan *(*start)(struct io_conn *,
+                                                             void *arg),
                                     void (*finish)(struct io_conn *,
                                                    void *arg),
                                     void *arg);
@@ -97,7 +96,7 @@ void io_close_listener(struct io_listener *listener);
  *
  * Note that the I/O may actually be done immediately.
  */
-struct io_op *io_write(const void *data, size_t len, struct io_next *next);
+struct io_plan *io_write(const void *data, size_t len, struct io_next *next);
 
 /**
  * io_read - queue buffer to be read.
@@ -111,7 +110,7 @@ struct io_op *io_write(const void *data, size_t len, struct io_next *next);
  *
  * Note that the I/O may actually be done immediately.
  */
-struct io_op *io_read(void *data, size_t len, struct io_next *next);
+struct io_plan *io_read(void *data, size_t len, struct io_next *next);
 
 /**
  * io_read_partial - queue buffer to be read (partial OK).
@@ -125,7 +124,7 @@ struct io_op *io_read(void *data, size_t len, struct io_next *next);
  *
  * Note that the I/O may actually be done immediately.
  */
-struct io_op *io_read_partial(void *data, size_t *len, struct io_next *next);
+struct io_plan *io_read_partial(void *data, size_t *len, struct io_next *next);
 
 /**
  * io_write_partial - queue data to be written (partial OK).
@@ -139,7 +138,7 @@ struct io_op *io_read_partial(void *data, size_t *len, struct io_next *next);
  *
  * Note that the I/O may actually be done immediately.
  */
-struct io_op *io_write_partial(const void *data, size_t *len,
+struct io_plan *io_write_partial(const void *data, size_t *len,
                               struct io_next *next);
 
 /**
@@ -150,7 +149,7 @@ struct io_op *io_write_partial(const void *data, size_t *len,
  * later call io_read/io_write etc. (or io_close) on it, in which case
  * it will do that.
  */
-struct io_op *io_idle(struct io_conn *conn);
+struct io_plan *io_idle(struct io_conn *conn);
 
 /**
  * io_timeout - set timeout function if the callback doesn't fire.
@@ -168,13 +167,13 @@ struct io_op *io_idle(struct io_conn *conn);
  */
 #define io_timeout(conn, ts, next, arg) \
        io_timeout_((conn), (ts),                                       \
-                   typesafe_cb_preargs(struct io_op *, void *,         \
+                   typesafe_cb_preargs(struct io_plan *, void *,       \
                                        (next), (arg),                  \
                                        struct io_conn *),              \
                    (arg))
 
 bool io_timeout_(struct io_conn *conn, struct timespec ts,
-                struct io_op *(*next)(struct io_conn *, void *), void *arg);
+                struct io_plan *(*next)(struct io_conn *, void *), void *arg);
 
 /**
  * io_duplex - split an fd into two connections.
@@ -192,14 +191,14 @@ bool io_timeout_(struct io_conn *conn, struct timespec ts,
  */
 #define io_duplex(conn, start, finish, arg)                            \
        io_duplex_((conn),                                              \
-                  typesafe_cb_preargs(struct io_op *, void *,          \
+                  typesafe_cb_preargs(struct io_plan *, void *,        \
                                       (start), (arg), struct io_conn *), \
                   typesafe_cb_preargs(void, void *, (finish), (arg),   \
                                       struct io_conn *),               \
                   (arg))
 
 struct io_conn *io_duplex_(struct io_conn *conn,
-                          struct io_op *(*start)(struct io_conn *, void *),
+                          struct io_plan *(*start)(struct io_conn *, void *),
                           void (*finish)(struct io_conn *, void *),
                           void *arg);
 
@@ -214,11 +213,11 @@ struct io_conn *io_duplex_(struct io_conn *conn,
  */
 #define io_wake(conn, next, arg)                                       \
        io_wake_((conn),                                                \
-                typesafe_cb_preargs(struct io_op *, void *,            \
+                typesafe_cb_preargs(struct io_plan *, void *,          \
                                     (next), (arg), struct io_conn *),  \
                 (arg))
 void io_wake_(struct io_conn *conn,
-             struct io_op *(*next)(struct io_conn *, void *), void *arg);
+             struct io_plan *(*next)(struct io_conn *, void *), void *arg);
 
 /**
  * io_break - return from io_loop()
@@ -231,7 +230,7 @@ void io_wake_(struct io_conn *conn,
  *
  * If io_loop() is called again, then @next will be called.
  */
-struct io_op *io_break(void *arg, struct io_next *next);
+struct io_plan *io_break(void *arg, struct io_next *next);
 
 /**
  * io_next - indicate what callback to call next.
@@ -249,11 +248,11 @@ struct io_op *io_break(void *arg, struct io_next *next);
  */
 #define io_next(conn, next, arg)                                       \
        io_next_((conn),                                                \
-                typesafe_cb_preargs(struct io_op *, void *,            \
+                typesafe_cb_preargs(struct io_plan *, void *,          \
                                     (next), (arg), struct io_conn *),  \
                 (arg))
 struct io_next *io_next_(struct io_conn *conn,
-                        struct io_op *(*next)(struct io_conn *, void *arg),
+                        struct io_plan *(*next)(struct io_conn *, void *arg),
                         void *arg);
 
 /* FIXME: io_recvfrom/io_sendto */
@@ -269,7 +268,7 @@ struct io_next *io_next_(struct io_conn *conn,
  * It's common to 'return io_close(...)' from a @next function, but
  * io_close can also be used as an argument to io_next().
  */
-struct io_op *io_close(struct io_conn *, void *unused);
+struct io_plan *io_close(struct io_conn *, void *unused);
 
 /**
  * io_loop - process fds until all closed on io_break.
index 94536728d91f48956902b74ab52fa66185e0d57f..9cef3ce36ee5894523cd82f41937390e1f4e9d0b 100644 (file)
@@ -126,9 +126,9 @@ static int pollmask(enum io_state state)
        }
 }
 
-void backend_set_state(struct io_conn *conn, struct io_op *op)
+void backend_set_state(struct io_conn *conn, struct io_plan *plan)
 {
-       enum io_state state = from_ioop(op);
+       enum io_state state = from_ioplan(plan);
        struct pollfd *pfd = &pollfds[conn->fd.backend_info];
 
        if (pfd->events)
index 03a1e3280bbb1d81908c2767854b4a017ef058e3..837a12698faf13f76e4904a6fa0a94c42648b6d3 100644 (file)
@@ -6,7 +6,7 @@
 #include <sys/wait.h>
 #include <stdio.h>
 
-static struct io_op *start_ok(struct io_conn *conn, int *state)
+static struct io_plan *start_ok(struct io_conn *conn, int *state)
 {
        ok1(*state == 0);
        (*state)++;
index e59ccb38b275589fc9b9be640a5c1fb7dd81b0dd..3f376fe659a73d611b7b4c660b5dc7e49d6e68aa 100644 (file)
@@ -11,7 +11,7 @@ struct data {
        char buf[4];
 };
 
-static struct io_op *start_ok(struct io_conn *conn, struct data *d)
+static struct io_plan *start_ok(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;
index cc1857c57a8bad386e804328a889e264a7220761..4898eb80665a608cf45525092db7eb547e2e2095 100644 (file)
@@ -12,7 +12,7 @@ struct data {
        char buf[4];
 };
 
-static struct io_op *start_ok(struct io_conn *conn, struct data *d)
+static struct io_plan *start_ok(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;
index daa81e7c7e4f428b26a12bf6f2492dacb46277aa..ae0b462c14f761ab4ca18bb24f3c77273966f376 100644 (file)
@@ -12,7 +12,7 @@ struct data {
        char *buf;
 };
 
-static struct io_op *start_ok(struct io_conn *conn, struct data *d)
+static struct io_plan *start_ok(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;
index 83c8c4cab0e3348618fd7a68468e05bb14201355..0e1c4a5e4bf64d1c1bc6afc6388ca757a95e5e1e 100644 (file)
@@ -12,7 +12,7 @@ struct data {
        char *buf;
 };
 
-static struct io_op *start_ok(struct io_conn *conn, struct data *d)
+static struct io_plan *start_ok(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;
index e6144dee8c354dab55be9500cdb3318cb56cb5d1..efe052b47fa95642c1ae7c6b131ea0fdac8eb373 100644 (file)
@@ -16,14 +16,14 @@ struct data {
        char buf[4];
 };
 
-static struct io_op *do_read(struct io_conn *conn, struct data *d)
+static struct io_plan *do_read(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 2 || d->state == 3);
        d->state++;
        return io_read(d->buf, sizeof(d->buf), io_next(conn, io_close, d));
 }
 
-static struct io_op *start_waker(struct io_conn *conn, struct data *d)
+static struct io_plan *start_waker(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 1);
        d->state++;
@@ -38,7 +38,7 @@ static void finish_waker(struct io_conn *conn, struct data *d)
        d->state++;
 }
 
-static struct io_op *start_idle(struct io_conn *conn, struct data *d)
+static struct io_plan *start_idle(struct io_conn *conn, struct data *d)
 {
        int fd;
 
index cf3d251a7f25e3f871648743f2d5326cb8b71afa..7e9824d5a8ef0185611043dffcd07b52da7484c6 100644 (file)
@@ -11,14 +11,14 @@ struct data {
        char buf[4];
 };
 
-static struct io_op *do_read(struct io_conn *conn, struct data *d)
+static struct io_plan *do_read(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 1);
        d->state++;
        return io_read(d->buf, sizeof(d->buf), io_next(conn, io_close, d));
 }
 
-static struct io_op *start_break(struct io_conn *conn, struct data *d)
+static struct io_plan *start_break(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;
index 6a972ba82da10ef8900c6f3f8bc3ea17b49a7061..63c539634f92ad98e592d6a17b7063ffb162ad13 100644 (file)
@@ -15,10 +15,10 @@ struct buffer {
        char buf[32];
 };
 
-static struct io_op *poke_writer(struct io_conn *conn, struct buffer *buf);
-static struct io_op *poke_reader(struct io_conn *conn, struct buffer *buf);
+static struct io_plan *poke_writer(struct io_conn *conn, struct buffer *buf);
+static struct io_plan *poke_reader(struct io_conn *conn, struct buffer *buf);
 
-static struct io_op *do_read(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *do_read(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->reader);
 
@@ -26,7 +26,7 @@ static struct io_op *do_read(struct io_conn *conn, struct buffer *buf)
                       io_next(conn, poke_writer, buf));
 }
 
-static struct io_op *do_write(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *do_write(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->writer);
 
@@ -34,7 +34,7 @@ static struct io_op *do_write(struct io_conn *conn, struct buffer *buf)
                        io_next(conn, poke_reader, buf));
 }
 
-static struct io_op *poke_writer(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *poke_writer(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->reader);
 
@@ -48,7 +48,7 @@ static struct io_op *poke_writer(struct io_conn *conn, struct buffer *buf)
        return io_idle(conn);
 }
 
-static struct io_op *poke_reader(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *poke_reader(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->writer);
        /* You read. */
@@ -61,7 +61,7 @@ static struct io_op *poke_reader(struct io_conn *conn, struct buffer *buf)
        return io_idle(conn);
 }
 
-static struct io_op *reader(struct io_conn *conn, struct buffer *buf)
+static struct io_plan *reader(struct io_conn *conn, struct buffer *buf)
 {
        assert(conn == buf->reader);
 
index f9cf4e591148fe9e66e2defacf86457f2728cfa2..3e769beb19920f0b3ae61cfdf1880d56f9a2bba1 100644 (file)
@@ -18,13 +18,13 @@ static void finish_ok(struct io_conn *conn, struct data *d)
        d->state++;
 }
 
-static struct io_op *write_out(struct io_conn *conn, struct data *d)
+static struct io_plan *write_out(struct io_conn *conn, struct data *d)
 {
        d->state++;
        return io_write(d->wbuf, sizeof(d->wbuf), io_next(conn, io_close, d));
 }
 
-static struct io_op *start_ok(struct io_conn *conn, struct data *d)
+static struct io_plan *start_ok(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;
index b6a52a55790da4aec03d35e53eede81b6990e2cf..48be71dda7340a0671436aa101bd80edf6fddf4f 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <signal.h>
 
-static struct io_op *start(struct io_conn *conn, void *unused)
+static struct io_plan *start(struct io_conn *conn, void *unused)
 {
        return io_idle(conn);
 }
index b5e0dc3f060b983f75d1cbca24b1e0b56ac4dbef..e8897c95759e3f3a58ce1905d321fd162d19776a 100644 (file)
@@ -15,14 +15,14 @@ struct data {
 };
 
 
-static struct io_op *no_timeout(struct io_conn *conn, struct data *d)
+static struct io_plan *no_timeout(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 1);
        d->state++;
        return io_close(conn, d);
 }
 
-static struct io_op *timeout(struct io_conn *conn, struct data *d)
+static struct io_plan *timeout(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 1);
        d->state++;
@@ -30,7 +30,7 @@ static struct io_op *timeout(struct io_conn *conn, struct data *d)
        return io_close(conn, d);
 }
 
-static struct io_op *start_ok(struct io_conn *conn, struct data *d)
+static struct io_plan *start_ok(struct io_conn *conn, struct data *d)
 {
        ok1(d->state == 0);
        d->state++;