MEDIUM: fd: remove the EV_FD_COND_* primitives
These primitives were initially introduced so that callers were able to
conditionally set/disable polling on a file descriptor and check in return
what the state was. It's been long since we last had an "if" on this, and
all pollers' functions were the same for cond_* and their systematic
counter parts, except that this required a check and a specific return
value that are not always necessary.
So let's simplify the FD API by removing this now unused distinction and
by making all specific functions return void.
diff --git a/include/proto/fd.h b/include/proto/fd.h
index 1cba33b..ffbb8e1 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -73,8 +73,6 @@
#define EV_FD_SET(fd, ev) (cur_poller.set((fd), (ev)))
#define EV_FD_CLR(fd, ev) (cur_poller.clr((fd), (ev)))
#define EV_FD_ISSET(fd, ev) (cur_poller.is_set((fd), (ev)))
-#define EV_FD_COND_S(fd, ev) (cur_poller.cond_s((fd), (ev)))
-#define EV_FD_COND_C(fd, ev) (cur_poller.cond_c((fd), (ev)))
#define EV_FD_REM(fd) (cur_poller.rem(fd))
#define EV_FD_CLO(fd) (cur_poller.clo(fd))
diff --git a/include/types/fd.h b/include/types/fd.h
index 684b77a..2e350b8 100644
--- a/include/types/fd.h
+++ b/include/types/fd.h
@@ -91,10 +91,6 @@
* poller should set it to 100.
* - <private> is initialized by the poller's init() function, and cleaned by
* the term() function.
- * - cond_s() checks if fd was not set then sets it and returns 1. Otherwise
- * it returns 0. It may be the same as set().
- * - cond_c() checks if fd was set then clears it and returns 1. Otherwise
- * it returns 0. It may be the same as clr().
* - clo() should be used to do indicate the poller that fd will be closed. It
* may be the same as rem() on some pollers.
* - poll() calls the poller, expiring at <exp>
@@ -102,10 +98,8 @@
struct poller {
void *private; /* any private data for the poller */
int REGPRM2 (*is_set)(const int fd, int dir); /* check if <fd> is being polled for dir <dir> */
- int REGPRM2 (*set)(const int fd, int dir); /* set polling on <fd> for <dir> */
- int REGPRM2 (*clr)(const int fd, int dir); /* clear polling on <fd> for <dir> */
- int REGPRM2 (*cond_s)(const int fd, int dir); /* set polling on <fd> for <dir> if unset */
- int REGPRM2 (*cond_c)(const int fd, int dir); /* clear polling on <fd> for <dir> if set */
+ void REGPRM2 (*set)(const int fd, int dir); /* set polling on <fd> for <dir> */
+ void REGPRM2 (*clr)(const int fd, int dir); /* clear polling on <fd> for <dir> */
void REGPRM1 (*rem)(const int fd); /* remove any polling on <fd> */
void REGPRM1 (*clo)(const int fd); /* mark <fd> as closed */
void REGPRM2 (*poll)(struct poller *p, int exp); /* the poller itself */