CLEANUP: connection: rename subscription events values and event field
The SUB_CAN_SEND/SUB_CAN_RECV enum values have been confusing a few
times, especially when checking them on reading. After some discussion,
it appears that calling them SUB_RETRY_SEND/SUB_RETRY_RECV more
accurately reflects their purpose since these events may only appear
after a first attempt to perform the I/O operation has failed or was
not completed.
In addition the wait_reason field in struct wait_event which carries
them makes one think that a single reason may happen at once while
it is in fact a set of events. Since the struct is called wait_event
it makes sense that this field is called "events" to indicate it's the
list of events we're subscribed to.
Last, the values for SUB_RETRY_RECV/SEND were swapped so that value
1 corresponds to recv and 2 to send, as is done almost everywhere else
in the code an in the shutdown() call.
diff --git a/include/types/connection.h b/include/types/connection.h
index 3b7f4e1..430e92a 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -47,16 +47,19 @@
struct session;
struct pipe;
+/* Note: subscribing to these events is only valid after the caller has really
+ * attempted to perform the operation, and failed to proceed or complete.
+ */
enum sub_event_type {
- SUB_CAN_SEND = 0x00000001, /* Schedule the tasklet when we can send more */
- SUB_CAN_RECV = 0x00000002, /* Schedule the tasklet when we can recv more */
- SUB_CALL_UNSUBSCRIBE = 0x00000004, /* The mux wants its unsubscribe() method to be called before destruction of the underlying object */
+ SUB_RETRY_RECV = 0x00000001, /* Schedule the tasklet when we can attempt to recv again */
+ SUB_RETRY_SEND = 0x00000002, /* Schedule the tasklet when we can attempt to send again */
+ SUB_CALL_UNSUBSCRIBE = 0x00000004, /* The mux wants its unsubscribe() method to be called before destruction of the underlying object */
};
struct wait_event {
struct tasklet *task;
void *handle; /* To be used by the callee */
- int wait_reason;
+ int events; /* set of enum sub_event_type above */
};
/* A connection handle is how we differentiate two connections on the lower