MAJOR: fd: replace all EV_FD_* macros with new fd_*_* inline calls
These functions have a more explicity meaning and will offer provisions
for explicit polling.
EV_FD_ISSET() has been left for now as it is still in use in checks.
diff --git a/include/proto/fd.h b/include/proto/fd.h
index ffbb8e1..072d3f6 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -1,23 +1,23 @@
/*
- include/proto/fd.h
- File descriptors states.
-
- Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation, version 2.1
- exclusively.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+ * include/proto/fd.h
+ * File descriptors states.
+ *
+ * Copyright (C) 2000-2012 Willy Tarreau - w@1wt.eu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
#ifndef _PROTO_FD_H
#define _PROTO_FD_H
@@ -70,12 +70,33 @@
*/
void run_poller();
-#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_REM(fd) (cur_poller.rem(fd))
-#define EV_FD_CLO(fd) (cur_poller.clo(fd))
+
+/* event manipulation primitives for use by I/O callbacks */
+static inline void fd_want_recv(int fd)
+{
+ cur_poller.set(fd, DIR_RD);
+}
+
+static inline void fd_stop_recv(int fd)
+{
+ cur_poller.clr(fd, DIR_RD);
+}
+
+static inline void fd_want_send(int fd)
+{
+ cur_poller.set(fd, DIR_WR);
+}
+
+static inline void fd_stop_send(int fd)
+{
+ cur_poller.clr(fd, DIR_WR);
+}
+static inline void fd_stop_both(int fd)
+{
+ cur_poller.rem(fd);
+}
/* Prepares <fd> for being polled */
static inline void fd_insert(int fd)
diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h
index 724c27f..3ddc56d 100644
--- a/include/proto/stream_interface.h
+++ b/include/proto/stream_interface.h
@@ -167,14 +167,14 @@
static inline void si_shutr(struct stream_interface *si)
{
if (stream_int_shutr(si))
- EV_FD_CLR(si_fd(si), DIR_RD);
+ fd_stop_recv(si_fd(si));
}
/* Sends a shutw to the connection using the data layer */
static inline void si_shutw(struct stream_interface *si)
{
if (stream_int_shutw(si))
- EV_FD_CLR(si_fd(si), DIR_WR);
+ fd_stop_send(si_fd(si));
}
/* Calls the data state update on the stream interfaace */