From: Willy Tarreau Date: Thu, 4 Jun 2020 06:32:23 +0000 (+0200) Subject: REORG: include: move pipe.h to haproxy/pipe{,-t}.h X-Git-Tag: v2.2-dev9~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=551271d99c3afd1abcc71522c3367e125f880da6;p=thirdparty%2Fhaproxy.git REORG: include: move pipe.h to haproxy/pipe{,-t}.h No change was needed beyond a minor cleanup. --- diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c index 916e5c706c..65eb44da20 100644 --- a/contrib/prometheus-exporter/service-prometheus.c +++ b/contrib/prometheus-exporter/service-prometheus.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/haproxy/pipe-t.h b/include/haproxy/pipe-t.h new file mode 100644 index 0000000000..1a1fcfdaea --- /dev/null +++ b/include/haproxy/pipe-t.h @@ -0,0 +1,43 @@ +/* + * include/haproxy/pipe-t.h + * Pipe management - types definitions. + * + * Copyright (C) 2000-2020 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 _HAPROXY_PIPE_T_H +#define _HAPROXY_PIPE_T_H + +/* A pipe is described by its read and write FDs, and the data remaining in it. + * The FDs are valid if there are data pending. The user is not allowed to + * change the FDs. + */ +struct pipe { + int data; /* number of bytes present in the pipe */ + int prod; /* FD the producer must write to ; -1 if none */ + int cons; /* FD the consumer must read from ; -1 if none */ + struct pipe *next; +}; + +#endif /* _HAPROXY_PIPE_T_H */ + +/* + * Local variables: + * c-indent-level: 8 + * c-basic-offset: 8 + * End: + */ diff --git a/include/haproxy/pipe.h b/include/haproxy/pipe.h new file mode 100644 index 0000000000..12bd8ea701 --- /dev/null +++ b/include/haproxy/pipe.h @@ -0,0 +1,54 @@ +/* + * include/haproxy/pipe.h + * Pipe management - exported functions + * + * Copyright (C) 2000-2020 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 _HAPROXY_PIPE_H +#define _HAPROXY_PIPE_H + +#include +#include + +extern int pipes_used; /* # of pipes in use (2 fds each) */ +extern int pipes_free; /* # of pipes unused (2 fds each) */ + +/* return a pre-allocated empty pipe. Try to allocate one if there isn't any + * left. NULL is returned if a pipe could not be allocated. + */ +struct pipe *get_pipe(); + +/* destroy a pipe, possibly because an error was encountered on it. Its FDs + * will be closed and it will not be reinjected into the live pool. + */ +void kill_pipe(struct pipe *p); + +/* put back a unused pipe into the live pool. If it still has data in it, it is + * closed and not reinjected into the live pool. The caller is not allowed to + * use it once released. + */ +void put_pipe(struct pipe *p); + +#endif /* _HAPROXY_PIPE_H */ + +/* + * Local variables: + * c-indent-level: 8 + * c-basic-offset: 8 + * End: + */ diff --git a/include/proto/pipe.h b/include/proto/pipe.h deleted file mode 100644 index 4dd3dd6402..0000000000 --- a/include/proto/pipe.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - include/proto/pipe.h - Pipe management - - Copyright (C) 2000-2009 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_PIPE_H -#define _PROTO_PIPE_H - -#include -#include - -extern int pipes_used; /* # of pipes in use (2 fds each) */ -extern int pipes_free; /* # of pipes unused (2 fds each) */ - -/* return a pre-allocated empty pipe. Try to allocate one if there isn't any - * left. NULL is returned if a pipe could not be allocated. - */ -struct pipe *get_pipe(); - -/* destroy a pipe, possibly because an error was encountered on it. Its FDs - * will be closed and it will not be reinjected into the live pool. - */ -void kill_pipe(struct pipe *p); - -/* put back a unused pipe into the live pool. If it still has data in it, it is - * closed and not reinjected into the live pool. The caller is not allowed to - * use it once released. - */ -void put_pipe(struct pipe *p); - -#endif /* _PROTO_PIPE_H */ - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * End: - */ diff --git a/include/types/pipe.h b/include/types/pipe.h deleted file mode 100644 index c6460298ac..0000000000 --- a/include/types/pipe.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - include/types/pipe.h - Pipe management. - - Copyright (C) 2000-2009 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 _TYPES_PIPE_H -#define _TYPES_PIPE_H - -#include - -/* A pipe is described by its read and write FDs, and the data remaining in it. - * The FDs are valid if there are data pending. The user is not allowed to - * change the FDs. - */ -struct pipe { - int data; /* number of bytes present in the pipe */ - int prod; /* FD the producer must write to ; -1 if none */ - int cons; /* FD the consumer must read from ; -1 if none */ - struct pipe *next; -}; - -#endif /* _TYPES_PIPE_H */ - -/* - * Local variables: - * c-indent-level: 8 - * c-basic-offset: 8 - * End: - */ diff --git a/src/cli.c b/src/cli.c index bdfb270919..afb42b590c 100644 --- a/src/cli.c +++ b/src/cli.c @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/mux_h1.c b/src/mux_h1.c index ef22ccee18..f2ba338447 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -18,7 +18,7 @@ #include -#include +#include #include #include diff --git a/src/pipe.c b/src/pipe.c index 6fe7b05249..992c77bd56 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -18,7 +18,7 @@ #include #include -#include +#include DECLARE_STATIC_POOL(pool_head_pipe, "pipe", sizeof(struct pipe)); diff --git a/src/raw_sock.c b/src/raw_sock.c index c1af72a2cc..3c64d3cab9 100644 --- a/src/raw_sock.c +++ b/src/raw_sock.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/stats.c b/src/stats.c index 115b9adebc..fa193bcc8d 100644 --- a/src/stats.c +++ b/src/stats.c @@ -57,7 +57,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/stream.c b/src/stream.c index 904eaef03a..b3c6a0c034 100644 --- a/src/stream.c +++ b/src/stream.c @@ -52,7 +52,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/stream_interface.c b/src/stream_interface.c index 921b19111e..157fa51fc4 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -30,13 +30,13 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include /* functions used by default on a detached stream-interface */ static void stream_int_shutr(struct stream_interface *si);