]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: stream_interface: remove si_fd() and its references
authorWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 18:27:15 +0000 (19:27 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2012 19:53:29 +0000 (20:53 +0100)
si_fd() is not used a lot, and breaks builds on OpenBSD 5.2 which
defines this name for its own purpose. It's easy enough to remove
this one-liner function, so let's do it.

include/proto/stream_interface.h
src/dumpstats.c
src/frontend.c
src/proto_http.c
src/session.c
src/stream_interface.c

index 0d00fe2e81b52d5da34fe93c0e015d8a45e0ad76..9cc39f53ff5e9cc5d042eeca83ca78dbce06f3d2 100644 (file)
@@ -56,11 +56,6 @@ static inline const struct protocol *si_ctrl(struct stream_interface *si)
        return si->conn->ctrl;
 }
 
-static inline int si_fd(struct stream_interface *si)
-{
-       return si->conn->t.sock.fd;
-}
-
 static inline void si_prepare_conn(struct stream_interface *si, const struct protocol *ctrl, const struct xprt_ops *xprt)
 {
        si->ops = &si_conn_ops;
index 0ee664164a30ca7d69e3033114cfdd7cbe2ca3e6..306fc61dbd7644017a88dce6d12db510e7418a5b 100644 (file)
@@ -3463,7 +3463,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si)
                             &sess->si[0],
                             sess->si[0].state,
                             sess->si[0].flags,
-                            si_fd(&sess->si[0]),
+                            sess->si[0].conn->t.sock.fd,
                             sess->si[0].exp ?
                                     tick_is_expired(sess->si[0].exp, now_ms) ? "<PAST>" :
                                             human_time(TICKS_TO_MS(sess->si[0].exp - now_ms),
@@ -3475,7 +3475,7 @@ static int stats_dump_full_sess_to_buffer(struct stream_interface *si)
                             &sess->si[1],
                             sess->si[1].state,
                             sess->si[1].flags,
-                            si_fd(&sess->si[1]),
+                            sess->si[1].conn->t.sock.fd,
                             sess->si[1].exp ?
                                     tick_is_expired(sess->si[1].exp, now_ms) ? "<PAST>" :
                                             human_time(TICKS_TO_MS(sess->si[1].exp - now_ms),
@@ -3704,7 +3704,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
                                     " s0=[%d,%1xh,fd=%d,ex=%s]",
                                     curr_sess->si[0].state,
                                     curr_sess->si[0].flags,
-                                    si_fd(&curr_sess->si[0]),
+                                    curr_sess->si[0].conn->t.sock.fd,
                                     curr_sess->si[0].exp ?
                                     human_time(TICKS_TO_MS(curr_sess->si[0].exp - now_ms),
                                                TICKS_TO_MS(1000)) : "");
@@ -3713,7 +3713,7 @@ static int stats_dump_sess_to_buffer(struct stream_interface *si)
                                     " s1=[%d,%1xh,fd=%d,ex=%s]",
                                     curr_sess->si[1].state,
                                     curr_sess->si[1].flags,
-                                    si_fd(&curr_sess->si[1]),
+                                    curr_sess->si[1].conn->t.sock.fd,
                                     curr_sess->si[1].exp ?
                                     human_time(TICKS_TO_MS(curr_sess->si[1].exp - now_ms),
                                                TICKS_TO_MS(1000)) : "");
index 652718c73bbfa733a2d6e58d0e5ed95f77db682a..a85cccee018c547a49f35b31997db54b821aeaf2 100644 (file)
@@ -52,7 +52,7 @@
  */
 int frontend_accept(struct session *s)
 {
-       int cfd = si_fd(&s->si[0]);
+       int cfd = s->si[0].conn->t.sock.fd;
 
        tv_zero(&s->logs.tv_request);
        s->logs.t_queue = -1;
index d768b87ac0ea6d10ff70994205caa3ac2153401d..8e96ae684d414902e60226020917154845f1f28d 100644 (file)
@@ -2392,7 +2392,7 @@ int http_wait_for_request(struct session *s, struct channel *req, int an_bit)
                         * previously disabled it, otherwise we might cause the client
                         * to delay next data.
                         */
-                       setsockopt(si_fd(&s->si[0]), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
+                       setsockopt(s->si[0].conn->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
                }
 #endif
 
@@ -3706,7 +3706,7 @@ int http_process_request(struct session *s, struct channel *req, int an_bit)
                if ((s->listener->options & LI_O_NOQUICKACK) &&
                    ((msg->flags & HTTP_MSGF_TE_CHNK) ||
                     (msg->body_len > req->buf->i - txn->req.eoh - 2)))
-                       setsockopt(si_fd(&s->si[0]), IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
+                       setsockopt(s->si[0].conn->t.sock.fd, IPPROTO_TCP, TCP_QUICKACK, &one, sizeof(one));
 #endif
        }
 
@@ -7657,7 +7657,8 @@ void debug_hdr(const char *dir, struct session *t, const char *start, const char
 {
        int max;
        chunk_printf(&trash, "%08x:%s.%s[%04x:%04x]: ", t->uniq_id, t->be->id,
-                     dir, (unsigned  short)si_fd(t->req->prod), (unsigned short)si_fd(t->req->cons));
+                     dir, (unsigned  short)t->req->prod->conn->t.sock.fd,
+                    (unsigned short)t->req->cons->conn->t.sock.fd);
 
        for (max = 0; start + max < end; max++)
                if (start[max] == '\r' || start[max] == '\n')
index 6bb44f021afd305b7d5a6e428d7f315236bd7fc7..772adf6b5c565744d3ff717614f19def48a26e87 100644 (file)
@@ -778,7 +778,7 @@ static int sess_update_st_con_tcp(struct session *s, struct stream_interface *si
                }
                si->exp   = TICK_ETERNITY;
                si->state = SI_ST_CER;
-               fd_delete(si_fd(si));
+               fd_delete(si->conn->t.sock.fd);
 
                conn_xprt_close(si->conn);
                if (si->release)
@@ -2322,8 +2322,8 @@ struct task *process_session(struct task *t)
                    s->si[1].prev_state == SI_ST_EST) {
                        chunk_printf(&trash, "%08x:%s.srvcls[%04x:%04x]\n",
                                      s->uniq_id, s->be->id,
-                                     (unsigned short)si_fd(&s->si[0]),
-                                     (unsigned short)si_fd(&s->si[1]));
+                                     (unsigned short)s->si[0].conn->t.sock.fd,
+                                     (unsigned short)s->si[1].conn->t.sock.fd);
                        if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
                }
 
@@ -2331,8 +2331,8 @@ struct task *process_session(struct task *t)
                    s->si[0].prev_state == SI_ST_EST) {
                        chunk_printf(&trash, "%08x:%s.clicls[%04x:%04x]\n",
                                      s->uniq_id, s->be->id,
-                                     (unsigned short)si_fd(&s->si[0]),
-                                     (unsigned short)si_fd(&s->si[1]));
+                                     (unsigned short)s->si[0].conn->t.sock.fd,
+                                     (unsigned short)s->si[1].conn->t.sock.fd);
                        if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
                }
        }
@@ -2439,7 +2439,8 @@ struct task *process_session(struct task *t)
                     (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
                chunk_printf(&trash, "%08x:%s.closed[%04x:%04x]\n",
                              s->uniq_id, s->be->id,
-                             (unsigned short)si_fd(s->req->prod), (unsigned short)si_fd(s->req->cons));
+                             (unsigned short)s->req->prod->conn->t.sock.fd,
+                             (unsigned short)s->req->cons->conn->t.sock.fd);
                if (write(1, trash.str, trash.len) < 0) /* shut gcc warning */;
        }
 
index 5a7bbc6f131aaa3aafc72ec734d7f5168c758c9e..8e1fd98dc65a2cded5c23fa2e995ff7c7917a246 100644 (file)
@@ -248,7 +248,7 @@ int stream_int_shutr(struct stream_interface *si)
        if (si->ob->flags & CF_SHUTW) {
                conn_xprt_close(si->conn);
                if (conn->ctrl)
-                       fd_delete(si_fd(si));
+                       fd_delete(si->conn->t.sock.fd);
                si->state = SI_ST_DIS;
                si->exp = TICK_ETERNITY;
 
@@ -307,7 +307,7 @@ int stream_int_shutw(struct stream_interface *si)
                } else if (si->flags & SI_FL_NOLINGER) {
                        si->flags &= ~SI_FL_NOLINGER;
                        if (conn->ctrl) {
-                               setsockopt(si_fd(si), SOL_SOCKET, SO_LINGER,
+                               setsockopt(si->conn->t.sock.fd, SOL_SOCKET, SO_LINGER,
                                           (struct linger *) &nolinger, sizeof(struct linger));
                        }
                        /* unclean data-layer shutdown */
@@ -321,7 +321,7 @@ int stream_int_shutw(struct stream_interface *si)
                        if (!(si->flags & SI_FL_NOHALF)) {
                                /* We shutdown transport layer */
                                if (conn->ctrl)
-                                       shutdown(si_fd(si), SHUT_WR);
+                                       shutdown(si->conn->t.sock.fd, SHUT_WR);
 
                                if (!(si->ib->flags & (CF_SHUTR|CF_DONT_READ))) {
                                        /* OK just a shutw, but we want the caller
@@ -339,7 +339,7 @@ int stream_int_shutw(struct stream_interface *si)
                 */
                conn_xprt_close(si->conn);
                if (conn->ctrl)
-                       fd_delete(si_fd(si));
+                       fd_delete(si->conn->t.sock.fd);
                /* fall through */
        case SI_ST_CER:
        case SI_ST_QUE:
@@ -857,14 +857,14 @@ static void stream_int_chk_snd_conn(struct stream_interface *si)
 
        if (!ob->pipe &&                          /* spliced data wants to be forwarded ASAP */
            (!(si->flags & SI_FL_WAIT_DATA) ||    /* not waiting for data */
-            (fdtab[si_fd(si)].ev & FD_POLL_OUT)))   /* we'll be called anyway */
+            (fdtab[si->conn->t.sock.fd].ev & FD_POLL_OUT)))   /* we'll be called anyway */
                return;
 
        if (!(si->conn->flags & CO_FL_HANDSHAKE) && si_conn_send_loop(si->conn) < 0) {
                /* Write error on the file descriptor. We mark the FD as STERROR so
                 * that we don't use it anymore and we notify the task.
                 */
-               fdtab[si_fd(si)].ev &= ~FD_POLL_STICKY;
+               fdtab[si->conn->t.sock.fd].ev &= ~FD_POLL_STICKY;
                __conn_data_stop_both(si->conn);
                si->flags |= SI_FL_ERR;
                si->conn->flags |= CO_FL_ERROR;
@@ -1207,7 +1207,7 @@ void stream_sock_read0(struct stream_interface *si)
                /* we want to immediately forward this close to the write side */
                if (si->flags & SI_FL_NOLINGER) {
                        si->flags &= ~SI_FL_NOLINGER;
-                       setsockopt(si_fd(si), SOL_SOCKET, SO_LINGER,
+                       setsockopt(si->conn->t.sock.fd, SOL_SOCKET, SO_LINGER,
                                   (struct linger *) &nolinger, sizeof(struct linger));
                }
                /* force flag on ssl to keep session in cache */
@@ -1222,7 +1222,7 @@ void stream_sock_read0(struct stream_interface *si)
 
  do_close:
        conn_xprt_close(si->conn);
-       fd_delete(si_fd(si));
+       fd_delete(si->conn->t.sock.fd);
        si->state = SI_ST_DIS;
        si->exp = TICK_ETERNITY;
        if (si->release)