CLEANUP: stconn: rename cs_{i,o}{b,c} to sc_{i,o}{b,c}
We're starting to propagate the stream connector's new name through the
API. Most call places of these functions that retrieve the channel or its
buffer are in applets. The local variable names are not changed in order
to keep the changes small and reviewable. There were ~92 uses of cs_ic(),
~96 of cs_oc() (due to co_get*() being less factorizable than ci_put*),
and ~5 accesses to the buffer itself.
diff --git a/src/applet.c b/src/applet.c
index 5253739..fe1fc62 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -173,11 +173,11 @@
cs_rx_buff_rdy(cs);
/* was already allocated another way ? if so, don't take this one */
- if (c_size(cs_ic(cs)) || cs_ic(cs)->pipe)
+ if (c_size(sc_ic(cs)) || sc_ic(cs)->pipe)
return 0;
/* allocation possible now ? */
- if (!b_alloc(&cs_ic(cs)->buf)) {
+ if (!b_alloc(&sc_ic(cs)->buf)) {
cs_rx_buff_blk(cs);
return 0;
}
@@ -230,29 +230,29 @@
if (!cs_alloc_ibuf(cs, &app->buffer_wait))
cs_rx_endp_more(cs);
- count = co_data(cs_oc(cs));
+ count = co_data(sc_oc(cs));
app->applet->fct(app);
/* now check if the applet has released some room and forgot to
* notify the other side about it.
*/
- if (count != co_data(cs_oc(cs))) {
- cs_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
+ if (count != co_data(sc_oc(cs))) {
+ sc_oc(cs)->flags |= CF_WRITE_PARTIAL | CF_WROTE_DATA;
cs_rx_room_rdy(cs_opposite(cs));
}
/* measure the call rate and check for anomalies when too high */
rate = update_freq_ctr(&app->call_rate, 1);
if (rate >= 100000 && app->call_rate.prev_ctr && // looped more than 100k times over last second
- ((b_size(cs_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_BUFF)) || // asks for a buffer which is present
- (b_size(cs_ib(cs)) && !b_data(cs_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_ROOM)) || // asks for room in an empty buffer
- (b_data(cs_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present
- (!b_data(cs_ib(cs)) && b_data(cs_ob(cs)) && // didn't return anything ...
- (cs_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
+ ((b_size(sc_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_BUFF)) || // asks for a buffer which is present
+ (b_size(sc_ib(cs)) && !b_data(sc_ib(cs)) && se_fl_test(app->sedesc, SE_FL_RXBLK_ROOM)) || // asks for room in an empty buffer
+ (b_data(sc_ob(cs)) && cs_tx_endp_ready(cs) && !cs_tx_blocked(cs)) || // asks for data already present
+ (!b_data(sc_ib(cs)) && b_data(sc_ob(cs)) && // didn't return anything ...
+ (sc_oc(cs)->flags & (CF_WRITE_PARTIAL|CF_SHUTW_NOW)) == CF_SHUTW_NOW))) { // ... and left data pending after a shut
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));
}
cs->app_ops->wake(cs);
- channel_release_buffer(cs_ic(cs), &app->buffer_wait);
+ channel_release_buffer(sc_ic(cs), &app->buffer_wait);
return t;
}