]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
5 years agoREORG: include: move cfgparse.h to haproxy/cfgparse.h
Willy Tarreau [Thu, 4 Jun 2020 22:00:29 +0000 (00:00 +0200)] 
REORG: include: move cfgparse.h to haproxy/cfgparse.h

There's no point splitting the file in two since only cfgparse uses the
types defined there. A few call places were updated and cleaned up. All
of them were in C files which register keywords.

There is nothing left in common/ now so this directory must not be used
anymore.

5 years agoREORG: include: move stream.h to haproxy/stream{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 21:46:14 +0000 (23:46 +0200)] 
REORG: include: move stream.h to haproxy/stream{,-t}.h

This one was not easy because it was embarking many includes with it,
which other files would automatically find. At least global.h, arg.h
and tools.h were identified. 93 total locations were identified, 8
additional includes had to be added.

In the rare files where it was possible to finalize the sorting of
includes by adjusting only one or two extra lines, it was done. But
all files would need to be rechecked and cleaned up now.

It was the last set of files in types/ and proto/ and these directories
must not be reused anymore.

5 years agoREORG: include: move server.h to haproxy/server{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 21:20:13 +0000 (23:20 +0200)] 
REORG: include: move server.h to haproxy/server{,-t}.h

extern struct dict server_name_dict was moved from the type file to the
main file. A handful of inlined functions were moved at the bottom of
the file. Call places were updated to use server-t.h when relevant, or
to simply drop the entry when not needed.

5 years agoREORG: include: move queue.h to haproxy/queue{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 20:59:39 +0000 (22:59 +0200)] 
REORG: include: move queue.h to haproxy/queue{,-t}.h

Nothing outstanding here. A number of call places were not justified and
removed.

5 years agoREORG: include: move backend.h to haproxy/backend{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 20:50:02 +0000 (22:50 +0200)] 
REORG: include: move backend.h to haproxy/backend{,-t}.h

The files remained mostly unchanged since they were OK. However, half of
the users didn't need to include them, and about as many actually needed
to have it and used to find functions like srv_currently_usable() through
a long chain that broke when moving the file.

5 years agoREORG: include: move spoe.h to haproxy/spoe{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 20:35:49 +0000 (22:35 +0200)] 
REORG: include: move spoe.h to haproxy/spoe{,-t}.h

Only minor change was to make sure all defines were before the structs
in spoe-t.h, everything else went smoothly.

5 years agoREORG: include: move proxy.h to haproxy/proxy{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 20:29:18 +0000 (22:29 +0200)] 
REORG: include: move proxy.h to haproxy/proxy{,-t}.h

This one is particularly difficult to split because it provides all the
functions used to manipulate a proxy state and to retrieve names or IDs
for error reporting, and as such, it was included in 73 files (down to
68 after cleanup). It would deserve a small cleanup though the cut points
are not obvious at the moment given the number of structs involved in
the struct proxy itself.

5 years agoREORG: include: move log.h to haproxy/log{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 20:01:04 +0000 (22:01 +0200)] 
REORG: include: move log.h to haproxy/log{,-t}.h

The current state of the logging is a real mess. The main problem is
that almost all files include log.h just in order to have access to
the alert/warning functions like ha_alert() etc, and don't care about
logs. But log.h also deals with real logging as well as log-format and
depends on stream.h and various other things. As such it forces a few
heavy files like stream.h to be loaded early and to hide missing
dependencies depending where it's loaded. Among the missing ones is
syslog.h which was often automatically included resulting in no less
than 3 users missing it.

Among 76 users, only 5 could be removed, and probably 70 don't need the
full set of dependencies.

A good approach would consist in splitting that file in 3 parts:
  - one for error output ("errors" ?).
  - one for log_format processing
  - and one for actual logging.

5 years agoREORG: include: move fcgi-app.h to haproxy/fcgi-app{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 19:33:21 +0000 (21:33 +0200)] 
REORG: include: move fcgi-app.h to haproxy/fcgi-app{,-t}.h

Only arg-t.h was missing from the types to get arg_list.

5 years agoREORG: include: move filters.h to haproxy/filters{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 19:29:29 +0000 (21:29 +0200)] 
REORG: include: move filters.h to haproxy/filters{,-t}.h

Just a minor change, moved the macro definitions upwards. A few caller
files were updated since they didn't need to include it.

5 years agoREORG: include: move http_ana.h to haproxy/http_ana{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 19:21:03 +0000 (21:21 +0200)] 
REORG: include: move http_ana.h to haproxy/http_ana{,-t}.h

It was moved without any change, however many callers didn't need it at
all. This was a consequence of the split of proto_http.c into several
parts that resulted in many locations to still reference it.

5 years agoREORG: include: move channel.h to haproxy/channel{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 19:07:02 +0000 (21:07 +0200)] 
REORG: include: move channel.h to haproxy/channel{,-t}.h

The files were moved with no change. The callers were cleaned up a bit
and a few of them had channel.h removed since not needed.

5 years agoREORG: include: move stream_interface.h to haproxy/stream_interface{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 18:45:39 +0000 (20:45 +0200)] 
REORG: include: move stream_interface.h to haproxy/stream_interface{,-t}.h

Almost no changes, removed stdlib and added buf-t and connection-t to
the types to avoid a warning.

5 years agoREORG: include: move ssl_sock.h to haproxy/ssl_sock{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 18:30:20 +0000 (20:30 +0200)] 
REORG: include: move ssl_sock.h to haproxy/ssl_sock{,-t}.h

Almost nothing changed, just moved a static inline at the end and moved
an export from the types to the main file.

5 years agoREORG: include: move lb_map.h to haproxy/lb_map{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 18:22:59 +0000 (20:22 +0200)] 
REORG: include: move lb_map.h to haproxy/lb_map{,-t}.h

Nothing was changed.

5 years agoREORG: include: move cli.h to haproxy/cli{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 18:19:54 +0000 (20:19 +0200)] 
REORG: include: move cli.h to haproxy/cli{,-t}.h

Almost no change except moving the cli_kw struct definition after the
defines. Almost all users had both types&proto included, which is not
surprizing since this code is old and it used to be the norm a decade
ago. These places were cleaned.

5 years agoREORG: include: move stats.h to haproxy/stats{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 17:58:55 +0000 (19:58 +0200)] 
REORG: include: move stats.h to haproxy/stats{,-t}.h

Just some minor reordering, and the usual cleanup of call places for
those which didn't need it. We don't include the whole tools.h into
stats-t anymore but just tools-t.h.

5 years agoREORG: move applet.h to haproxy/applet{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 17:42:41 +0000 (19:42 +0200)] 
REORG: move applet.h to haproxy/applet{,-t}.h

The type file was slightly tidied. The cli-specific APPCTX_CLI_ST1_* flag
definitions were moved to cli.h. The type file was adjusted to include
buf-t.h and not the huge buf.h. A few call places were fixed because they
did not need this include.

5 years agoREORG: include: split common/uri_auth.h into haproxy/uri_auth{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 17:27:34 +0000 (19:27 +0200)] 
REORG: include: split common/uri_auth.h into haproxy/uri_auth{,-t}.h

Initially it looked like this could have been placed into auth.h or
stats.h but it's not the case as it's what makes the link between them
and the HTTP layer. However the file needed to be split in two. Quite
a number of call places were dropped because these were mostly leftovers
from the early days where the stats and cli were packed together.

5 years agoREORG: include: move acl.h to haproxy/acl.h{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 17:11:43 +0000 (19:11 +0200)] 
REORG: include: move acl.h to haproxy/acl.h{,-t}.h

The files were moved almost as-is, just dropping arg-t and auth-t from
acl-t but keeping arg-t in acl.h. It was useful to revisit the call places
since a handful of files used to continue to include acl.h while they did
not need it at all. Struct stream was only made a forward declaration
since not otherwise needed.

5 years agoREORG: include: move trace.h to haproxy/trace{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 17:02:42 +0000 (19:02 +0200)] 
REORG: include: move trace.h to haproxy/trace{,-t}.h

Only thread-t was added to satisfy THREAD_LOCAL but the rest was OK.

5 years agoREORG: include: move session.h to haproxy/session{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 16:58:52 +0000 (18:58 +0200)] 
REORG: include: move session.h to haproxy/session{,-t}.h

Almost no change was needed beyond a little bit of reordering of the
types file and adjustments to use session-t instead of session at a
few places.

5 years agoREORG: include: move stick_table.h to haproxy/stick_table{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 16:46:44 +0000 (18:46 +0200)] 
REORG: include: move stick_table.h to haproxy/stick_table{,-t}.h

The stktable_types[] array declaration was moved to the main file as
it had nothing to do in the types. A few declarations were reordered
in the types file so that defines were before the structs. Thread-t
was added since there are a few __decl_thread(). The loss of peers.h
revealed that cfgparse-listen needed it.

5 years agoREORG: include: move peers.h to haproxy/peers{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 16:38:21 +0000 (18:38 +0200)] 
REORG: include: move peers.h to haproxy/peers{,-t}.h

The cfg_peers external declaration was moved to the main file instead
of the type one. A few types were still missing from the proto, causing
warnings in the functions prototypes (proxy, stick_table).

5 years agoREORG: include: move http_fetch.h to haproxy/http_fetch.h
Willy Tarreau [Thu, 4 Jun 2020 16:26:43 +0000 (18:26 +0200)] 
REORG: include: move http_fetch.h to haproxy/http_fetch.h

There's no type file for this trivial one. The unneeded dependency on
htx.h was dropped.

5 years agoREORG: include: move checks.h to haproxy/check{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 16:21:56 +0000 (18:21 +0200)] 
REORG: include: move checks.h to haproxy/check{,-t}.h

All includes that were not absolutely necessary were removed because
checks.h happens to very often be part of dependency loops. A warning
was added about this in check-t.h. The fields, enums and structs were
a bit tidied because it's particularly tedious to find anything there.
It would make sense to split this in two or more files (at least
extract tcp-checks).

The file was renamed to the singular because it was one of the rare
exceptions to have an "s" appended to its name compared to the struct
name.

5 years agoREORG: include: move connection.h to haproxy/connection{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 16:02:10 +0000 (18:02 +0200)] 
REORG: include: move connection.h to haproxy/connection{,-t}.h

The type file is becoming a mess, half of it is for the proxy protocol,
another good part describes conn_streams and mux ops, it would deserve
being split again. At least it was reordered so that elements are easier
to find, with the PP-stuff left at the end. The MAX_SEND_FD macro was moved
to compat.h as it's said to be the value for Linux.

5 years agoREORG: include: move tcp_rules.h to haproxy/tcp_rules.h
Willy Tarreau [Thu, 4 Jun 2020 15:42:48 +0000 (17:42 +0200)] 
REORG: include: move tcp_rules.h to haproxy/tcp_rules.h

There's no type file on this one which is pretty simple.

5 years agoREORG: include: move signal.h to haproxy/signal{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 15:37:26 +0000 (17:37 +0200)] 
REORG: include: move signal.h to haproxy/signal{,-t}.h

No change was necessary. Include from wdt.c was dropped since unneeded.

5 years agoREORG: include: move proto_tcp.h to haproxy/proto_tcp.h
Willy Tarreau [Thu, 4 Jun 2020 15:31:04 +0000 (17:31 +0200)] 
REORG: include: move proto_tcp.h to haproxy/proto_tcp.h

There was no type file. This one really is trivial. A few missing
includes were added to satisfy the exported functions prototypes.

5 years agoREORG: include: move task.h to haproxy/task{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 15:25:40 +0000 (17:25 +0200)] 
REORG: include: move task.h to haproxy/task{,-t}.h

The TASK_IS_TASKLET() macro was moved to the proto file instead of the
type one. The proto part was a bit reordered to remove a number of ugly
forward declaration of static inline functions. About a tens of C and H
files had their dependency dropped since they were not using anything
from task.h.

5 years agoREORG: include: split global.h into haproxy/global{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 15:05:57 +0000 (17:05 +0200)] 
REORG: include: split global.h into haproxy/global{,-t}.h

global.h was one of the messiest files, it has accumulated tons of
implicit dependencies and declares many globals that make almost all
other file include it. It managed to silence a dependency loop between
server.h and proxy.h by being well placed to pre-define the required
structs, forcing struct proxy and struct server to be forward-declared
in a significant number of files.

It was split in to, one which is the global struct definition and the
few macros and flags, and the rest containing the functions prototypes.

The UNIX_MAX_PATH definition was moved to compat.h.

5 years agoREORG: include: move vars.h to haproxy/vars{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 14:25:31 +0000 (16:25 +0200)] 
REORG: include: move vars.h to haproxy/vars{,-t}.h

A few includes (sessions.h, stream.h, api-t.h) were added for arguments
that were first declared in function prototypes.

5 years agoREORG: include: move protocol_buffers.h to haproxy/protobuf{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 14:06:59 +0000 (16:06 +0200)] 
REORG: include: move protocol_buffers.h to haproxy/protobuf{,-t}.h

There is no C file for this one, the code was placed into sample.c which
thus has a dependency on this file which itself includes sample.h. Probably
that it would be wise to split that later.

5 years agoREORG: include: move sample.h to haproxy/sample{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 13:33:47 +0000 (15:33 +0200)] 
REORG: include: move sample.h to haproxy/sample{,-t}.h

This one is particularly tricky to move because everyone uses it
and it depends on a lot of other types. For example it cannot include
arg-t.h and must absolutely only rely on forward declarations to avoid
dependency loops between vars -> sample_data -> arg. In order to address
this one, it would be nice to split the sample_data part out of sample.h.

5 years agoREORG: include: move payload.h to haproxy/payload.h
Willy Tarreau [Thu, 4 Jun 2020 13:13:30 +0000 (15:13 +0200)] 
REORG: include: move payload.h to haproxy/payload.h

There's no type file, it only contains fetch_rdp_cookie_name() and
val_payload_lv() which probably ought to move somewhere else instead
of staying there.

5 years agoREORG: include: move map to haproxy/map{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 13:10:43 +0000 (15:10 +0200)] 
REORG: include: move map to haproxy/map{,-t}.h

Only small cleanups, and removal of a few includes from files that
didn't need them.

5 years agoREORG: include: move pattern.h to haproxy/pattern{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 13:06:28 +0000 (15:06 +0200)] 
REORG: include: move pattern.h to haproxy/pattern{,-t}.h

It was moved as-is, except for extern declaration of pattern_reference.
A few C files used to include it but didn't need it anymore after having
been split apart so this was cleaned.

5 years agoREORG: include: move listener.h to haproxy/listener{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:58:24 +0000 (14:58 +0200)] 
REORG: include: move listener.h to haproxy/listener{,-t}.h

stdlib and list were missing from listener.h, otherwise it was OK.

5 years agoREORG: include: move lb_fwrr.h to haproxy/lb_fwrr{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:45:03 +0000 (14:45 +0200)] 
REORG: include: move lb_fwrr.h to haproxy/lb_fwrr{,-t}.h

Nothing fancy, includes were already OK. The proto didn't reference the
type, this was fixed. Still references proxy.h and server.h from types/.

5 years agoREORG: include: move lb_fwlc.h to haproxy/lb_fwlc{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:41:04 +0000 (14:41 +0200)] 
REORG: include: move lb_fwlc.h to haproxy/lb_fwlc{,-t}.h

Nothing fancy, includes were already OK. The proto didn't reference the
type, this was fixed. Still references proxy.h and server.h from types/.

5 years agoREORG: include: move lb_fas.h to haproxy/lb_fas{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:37:38 +0000 (14:37 +0200)] 
REORG: include: move lb_fas.h to haproxy/lb_fas{,-t}.h

Nothing fancy, includes were already OK. The proto didn't reference the
type, this was fixed. Still references proxy.h and server.h from types/.

5 years agoREORG: include: move lb_chash.h to haproxy/lb_chash{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:34:27 +0000 (14:34 +0200)] 
REORG: include: move lb_chash.h to haproxy/lb_chash{,-t}.h

Nothing fancy, includes were already OK. The proto didn't reference the
type, this was fixed. Still references proxy.h and server.h from types/.

5 years agoREORG: move ssl_crtlist.h to haproxy/ssl_crtlist{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:29:23 +0000 (14:29 +0200)] 
REORG: move ssl_crtlist.h to haproxy/ssl_crtlist{,-t}.h

These files were already clean as well. Just added ebptnode which is
needed in crtlist_entry.

5 years agoREORG: include: move ssl_ckch.h to haproxy/ssl_ckch{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:25:47 +0000 (14:25 +0200)] 
REORG: include: move ssl_ckch.h to haproxy/ssl_ckch{,-t}.h

buf-t and ebmbtree were included.

5 years agoREORG: include: move ssl_utils.h to haproxy/ssl_utils.h
Willy Tarreau [Thu, 4 Jun 2020 12:21:22 +0000 (14:21 +0200)] 
REORG: include: move ssl_utils.h to haproxy/ssl_utils.h

Just added buf-t and openssl-compat for the missing types that appear
in the prototypes.

5 years agoREORG: include: move mworker.h to haproxy/mworker{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 12:07:37 +0000 (14:07 +0200)] 
REORG: include: move mworker.h to haproxy/mworker{,-t}.h

One function prototype makes reference to struct mworker_proc which was
not defined there but in global.h instead. This definition, along with
the PROC_O_* fields were moved to mworker-t.h instead.

5 years agoCLEANUP: include: remove unused mux_pt.h
Willy Tarreau [Thu, 4 Jun 2020 12:04:31 +0000 (14:04 +0200)] 
CLEANUP: include: remove unused mux_pt.h

It used to be needed to export mux_pt_ops when it was the only way to
detect a mux but that's no longer the case.

5 years agoREORG: include: move http_rules.h to haproxy/http_rules.h
Willy Tarreau [Thu, 4 Jun 2020 09:40:28 +0000 (11:40 +0200)] 
REORG: include: move http_rules.h to haproxy/http_rules.h

There was no include file. This one still includes types/proxy.h.

5 years agoREORG: include: move obj_type.h to haproxy/obj_type{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 09:29:21 +0000 (11:29 +0200)] 
REORG: include: move obj_type.h to haproxy/obj_type{,-t}.h

No change was necessary. It still includes lots of types/* files.

5 years agoREORG: include: move frontend.h to haproxy/frontend.h
Willy Tarreau [Thu, 4 Jun 2020 09:23:07 +0000 (11:23 +0200)] 
REORG: include: move frontend.h to haproxy/frontend.h

There was no type file for this one, it only contains frontend_accept().

5 years agoREORG: include: move capture.h to haproxy/capture{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 09:18:28 +0000 (11:18 +0200)] 
REORG: include: move capture.h to haproxy/capture{,-t}.h

The file was split into two since it contains a variable declaration.

5 years agoREORG: include: split mailers.h into haproxy/mailers{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 09:09:42 +0000 (11:09 +0200)] 
REORG: include: split mailers.h into haproxy/mailers{,-t}.h

The file mostly contained struct definitions but there was also a
variable export. Most of the stuff currently lies in checks.h and
should definitely move here!

5 years agoREORG: include: move counters.h to haproxy/counters-t.h
Willy Tarreau [Thu, 4 Jun 2020 09:01:17 +0000 (11:01 +0200)] 
REORG: include: move counters.h to haproxy/counters-t.h

Since these are only type definitions, let's move them to counters-t.h
and reserve counters.h for when functions will be needed.

5 years agoREORG: include: move flt_http_comp.h to haproxy/
Willy Tarreau [Thu, 4 Jun 2020 08:57:05 +0000 (10:57 +0200)] 
REORG: include: move flt_http_comp.h to haproxy/

There was no type definition for this file which was moved as-is.

5 years agoREORG: include: move dns.h to haproxy/dns{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 08:53:16 +0000 (10:53 +0200)] 
REORG: include: move dns.h to haproxy/dns{,-t}.h

The files were moved as-is.

5 years agoREORG: include: move auth.h to haproxy/auth{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 08:36:03 +0000 (10:36 +0200)] 
REORG: include: move auth.h to haproxy/auth{,-t}.h

The STATS_DEFAULT_REALM and STATS_DEFAULT_URI were moved to defaults.h.
It was required to include types/pattern.h and types/sample.h since they
are mentioned in function prototypes.

It would be wise to merge this with uri_auth.h later.

5 years agoREORG: include: move arg.h to haproxy/arg{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 08:19:23 +0000 (10:19 +0200)] 
REORG: include: move arg.h to haproxy/arg{,-t}.h

Almost no change was needed; chunk.h was replaced with buf-t.h.
It dpeends on types/vars.h and types/protocol_buffers.h.

5 years agoREORG: include: move action.h to haproxy/action{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 08:15:32 +0000 (10:15 +0200)] 
REORG: include: move action.h to haproxy/action{,-t}.h

List.h was missing for LIST_ADDQ(). A few unneeded includes of action.h
were removed from certain files.

This one still relies on applet.h and stick-table.h.

5 years agoREORG: include: move hlua_fcn.h to haproxy/hlua_fcn.h
Willy Tarreau [Thu, 4 Jun 2020 08:05:25 +0000 (10:05 +0200)] 
REORG: include: move hlua_fcn.h to haproxy/hlua_fcn.h

Added lua.h which was missing from the includes.

5 years agoREORG: include: move hlua.h to haproxy/hlua{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 07:20:54 +0000 (09:20 +0200)] 
REORG: include: move hlua.h to haproxy/hlua{,-t}.h

This one required a few more includes as it uses list and ebpt_node.
It still references lots of types/ files for now.

5 years agoREORG: include: move http_htx.h to haproxy/http_htx{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 07:08:41 +0000 (09:08 +0200)] 
REORG: include: move http_htx.h to haproxy/http_htx{,-t}.h

A few includes had to be added, namely list-t.h in the type file and
types/proxy.h in the proto file. actions.h was including http-htx.h
but didn't need it so it was dropped.

5 years agoREORG: include: move h1_htx.h to haproxy/h1_htx.h
Willy Tarreau [Thu, 4 Jun 2020 07:00:02 +0000 (09:00 +0200)] 
REORG: include: move h1_htx.h to haproxy/h1_htx.h

This one didn't have a type file. A few missing includes were
added (htx, types).

5 years agoREORG: include: move compression.h to haproxy/compression{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 06:52:38 +0000 (08:52 +0200)] 
REORG: include: move compression.h to haproxy/compression{,-t}.h

No change was needed.

5 years agoREORG: include: move proto/proto_sockpair.h to haproxy/proto_sockpair.h
Willy Tarreau [Thu, 4 Jun 2020 06:41:30 +0000 (08:41 +0200)] 
REORG: include: move proto/proto_sockpair.h to haproxy/proto_sockpair.h

This one didn't have any types file and was moved as-is.

5 years agoREORG: include: move proto_udp.h to haproxy/proto_udp{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 06:36:05 +0000 (08:36 +0200)] 
REORG: include: move proto_udp.h to haproxy/proto_udp{,-t}.h

No change was needed.

5 years agoCLEANUP: include: remove empty raw_sock.h
Willy Tarreau [Thu, 4 Jun 2020 06:34:19 +0000 (08:34 +0200)] 
CLEANUP: include: remove empty raw_sock.h

This one only contained an include for types/stream_interface.h, which
was already present in its 3 users.

5 years agoREORG: include: move pipe.h to haproxy/pipe{,-t}.h
Willy Tarreau [Thu, 4 Jun 2020 06:32:23 +0000 (08:32 +0200)] 
REORG: include: move pipe.h to haproxy/pipe{,-t}.h

No change was needed beyond a minor cleanup.

5 years agoREORG: include: move sink.h to haproxy/sink{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 18:02:28 +0000 (20:02 +0200)] 
REORG: include: move sink.h to haproxy/sink{,-t}.h

The sink files could be moved with almost no change at since they
didn't rely on anything fancy. ssize_t required sys/types.h and
thread.h was needed for the locks.

5 years agoREORG: include: move ring to haproxy/ring{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 17:43:35 +0000 (19:43 +0200)] 
REORG: include: move ring to haproxy/ring{,-t}.h

Some includes were wrong in the type definition but beyond this no
change was needed.

5 years agoREORG: include: move fd.h to haproxy/fd{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 17:33:00 +0000 (19:33 +0200)] 
REORG: include: move fd.h to haproxy/fd{,-t}.h

A few includes were missing in each file. A definition of
struct polled_mask was moved to fd-t.h. The MAX_POLLERS macro was
moved to defaults.h

Stdio used to be silently inherited from whatever path but it's needed
for list_pollers() which takes a FILE* and which can thus not be
forward-declared.

5 years agoREORG: include: move port_range.h to haproxy/port_range{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 17:20:59 +0000 (19:20 +0200)] 
REORG: include: move port_range.h to haproxy/port_range{,-t}.h

The port ranges didn't depend on anything. However they were missing
some includes such as stdlib and api-t.h which were added.

5 years agoREORG: include: move shctx to haproxy/shctx{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 16:38:48 +0000 (18:38 +0200)] 
REORG: include: move shctx to haproxy/shctx{,-t}.h

Minor cleanups were applied, some includes were missing from the types
file and some were incorrect in a few C files (duplicated or not using
path).

5 years agoREORG: include: move dict.h to hparoxy/dict{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 16:23:19 +0000 (18:23 +0200)] 
REORG: include: move dict.h to hparoxy/dict{,-t}.h

This was entirely free-standing. haproxy/api-t.h was added for size_t.

5 years agoREORG: tools: split common/standard.h into haproxy/tools{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 16:09:46 +0000 (18:09 +0200)] 
REORG: tools: split common/standard.h into haproxy/tools{,-t}.h

And also rename standard.c to tools.c. The original split between
tools.h and standard.h dates from version 1.3-dev and was mostly an
accident. This patch moves the files back to what they were expected
to be, and takes care of not changing anything else. However this
time tools.h was split between functions and types, because it contains
a small number of commonly used macros and structures (e.g. name_desc)
which in turn cause the massive list of includes of tools.h to conflict
with the callers.

They remain the ugliest files of the whole project and definitely need
to be cleaned and split apart. A few types are defined there only for
functions provided there, and some parts are even OS-specific and should
move somewhere else, such as the symbol resolution code.

5 years agoREORG: include: move protocol.h to haproxy/protocol{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 13:26:55 +0000 (15:26 +0200)] 
REORG: include: move protocol.h to haproxy/protocol{,-t}.h

The protocol.h files are pretty low in the dependency and (sadly) used
by some files from common/. Almost nothing was changed except lifting a
few comments.

5 years agoREORG: include: move common/fcgi.h to haproxy/
Willy Tarreau [Wed, 3 Jun 2020 12:56:08 +0000 (14:56 +0200)] 
REORG: include: move common/fcgi.h to haproxy/

The file was moved almost verbatim (only stdio.h was dropped as useless).
It was not split between types and functions because it's only included
from direct C code (fcgi.c and mux_fcgi.c) as well as fcgi_app.h, included
from the same ones, which should also be remerged as a single one.

5 years agoREORG: include: move common/h2.h to haproxy/h2.h
Willy Tarreau [Wed, 3 Jun 2020 10:04:01 +0000 (12:04 +0200)] 
REORG: include: move common/h2.h to haproxy/h2.h

No change was performed, the file is only included from C files and
currently doesn't need to be split into types+functions.

5 years agoREORG: include: move hpack*.h to haproxy/ and split hpack-tbl
Willy Tarreau [Wed, 3 Jun 2020 07:09:57 +0000 (09:09 +0200)] 
REORG: include: move hpack*.h to haproxy/ and split hpack-tbl

The various hpack files are self-contained, but hpack-tbl was one of
those showing difficulties when pools were added because that began
to add quite some dependencies. Now when built in standalone mode,
it still uses the bare minimum pool definitions and doesn't require
to know the prototypes anymore when only the structures are needed.
Thus the files were moved verbatim except for hpack-tbl which was
split between types and prototypes.

5 years agoREORG: include: split common/htx.h into haproxy/htx{,-t}.h
Willy Tarreau [Wed, 3 Jun 2020 06:44:35 +0000 (08:44 +0200)] 
REORG: include: split common/htx.h into haproxy/htx{,-t}.h

Most of the file was a large set of HTX elements manipulation functions
and few types, so splitting them allowed to further reduce dependencies
and shrink the build time. Doing so revealed that a few files (h2.c,
mux_pt.c) needed haproxy/buf.h and were previously getting it through
htx.h. They were fixed.

5 years agoREORG: include: move common/h1.h to haproxy/h1.h
Willy Tarreau [Tue, 2 Jun 2020 17:33:08 +0000 (19:33 +0200)] 
REORG: include: move common/h1.h to haproxy/h1.h

The file was moved as-is. There was a wrong dependency on dynbuf.h
instead of buf.h which was addressed. There was no benefit to
splitting this between types and functions.

5 years agoREORG: include: split common/http-hdr.h into haproxy/http-hdr{,-t}.h
Willy Tarreau [Tue, 2 Jun 2020 17:25:28 +0000 (19:25 +0200)] 
REORG: include: split common/http-hdr.h into haproxy/http-hdr{,-t}.h

There's only one struct and 2 inline functions. It could have been
merged into http.h but that would have added a massive dependency on
the hpack parts for nothing, so better keep it this way since hpack
is already freestanding and portable.

5 years agoREORG: include: split common/http.h into haproxy/http{,-t}.h
Willy Tarreau [Tue, 2 Jun 2020 17:11:26 +0000 (19:11 +0200)] 
REORG: include: split common/http.h into haproxy/http{,-t}.h

So the enums and structs were placed into http-t.h and the functions
into http.h. This revealed that several files were dependeng on http.h
but not including it, as it was silently inherited via other files.

5 years agoREORG: include: move common/ticks.h to haproxy/ticks.h
Willy Tarreau [Tue, 2 Jun 2020 16:15:32 +0000 (18:15 +0200)] 
REORG: include: move common/ticks.h to haproxy/ticks.h

Nothing needed to be changed, there are no exported types.

5 years agoREORG: include: split common/xref.h into haproxy/xref{,-t}.h
Willy Tarreau [Tue, 2 Jun 2020 15:46:16 +0000 (17:46 +0200)] 
REORG: include: split common/xref.h into haproxy/xref{,-t}.h

The type is the only element needed by applet.h and hlua.h, while hlua.c
needs the various functions. XREF_BUSY was placed into the types as well
since it's better to have the special values there.

5 years agoREORG: include: split common/regex.h into haproxy/regex{,-t}.h
Willy Tarreau [Tue, 2 Jun 2020 15:32:26 +0000 (17:32 +0200)] 
REORG: include: split common/regex.h into haproxy/regex{,-t}.h

Regex are essentially included for myregex_t but it turns out that
several of the C files didn't include it directly, relying on the
one included by their own .h. This has been cleanly addressed so
that only the type is included by H files which need it, and adding
the missing includes for the other ones.

5 years agoREORG: include: move common/namespace.h to haproxy/namespace{,-t}.h
Willy Tarreau [Tue, 2 Jun 2020 15:02:59 +0000 (17:02 +0200)] 
REORG: include: move common/namespace.h to haproxy/namespace{,-t}.h

The type was moved out as it's used by standard.h for netns_entry.
Instead of just being a forward declaration when not used, it's an
empty struct, which makes gdb happier (the resulting stripped executable
is the same).

5 years agoREORG: include: move common/net_helper.h to haproxy/net_helper.h
Willy Tarreau [Tue, 2 Jun 2020 14:48:09 +0000 (16:48 +0200)] 
REORG: include: move common/net_helper.h to haproxy/net_helper.h

No change was necessary.

5 years agoREORG: include: move common/buffer.h to haproxy/dynbuf{,-t}.h
Willy Tarreau [Tue, 2 Jun 2020 09:28:02 +0000 (11:28 +0200)] 
REORG: include: move common/buffer.h to haproxy/dynbuf{,-t}.h

The pretty confusing "buffer.h" was in fact not the place to look for
the definition of "struct buffer" but the one responsible for dynamic
buffer allocation. As such it defines the struct buffer_wait and the
few functions to allocate a buffer or wait for one.

This patch moves it renaming it to dynbuf.h. The type definition was
moved to its own file since it's included in a number of other structs.

Doing this cleanup revealed that a significant number of files used to
rely on this one to inherit struct buffer through it but didn't need
anything from this file at all.

5 years agoREORG: include: move activity to haproxy/
Willy Tarreau [Tue, 2 Jun 2020 08:29:48 +0000 (10:29 +0200)] 
REORG: include: move activity to haproxy/

This moves types/activity.h to haproxy/activity-t.h and
proto/activity.h to haproxy/activity.h.

The macros defining the bit field values for the profiling variable
were moved to the type file to be more future-proof.

5 years agoREORG: include: move common/chunk.h to haproxy/chunk.h
Willy Tarreau [Tue, 2 Jun 2020 08:22:45 +0000 (10:22 +0200)] 
REORG: include: move common/chunk.h to haproxy/chunk.h

No change was necessary, it was already properly split.

5 years agoREORG: include: move common/memory.h to haproxy/pool.h
Willy Tarreau [Tue, 2 Jun 2020 07:38:52 +0000 (09:38 +0200)] 
REORG: include: move common/memory.h to haproxy/pool.h

Now the file is ready to be stored into its final destination. A few
minor reorderings were performed to keep the file properly organized,
making the various sections more visible (cache & lockless).

In addition and to stay consistent, memory.c was renamed to pool.c.

5 years agoMEDIUM: memory: make local pools independent on lockless pools
Willy Tarreau [Mon, 1 Jun 2020 17:00:28 +0000 (19:00 +0200)] 
MEDIUM: memory: make local pools independent on lockless pools

Till now the local pool caches were implemented only when lockless pools
were in use. This was mainly due to the difficulties to disentangle the
code parts. However the locked pools would further benefit from the local
cache, and having this would reduce the variants in the code.

This patch does just this. It adds a new debug macro DEBUG_NO_LOCAL_POOLS
to forcefully disable local pool caches, and makes sure that the high
level functions are now strictly the same between locked and lockless
(pool_alloc(), pool_alloc_dirty(), pool_free(), pool_get_first()). The
pool index calculation was moved inside the CONFIG_HAP_LOCAL_POOLS guards.
This allowed to move them out of the giant #ifdef and to significantly
reduce the code duplication.

A quick perf test shows that with locked pools the performance increases
by roughly 10% on 8 threads and gets closer to the lockless one.

5 years agoMINOR: memory: move pool-specific path of the locked pool_free() to __pool_free()
Willy Tarreau [Mon, 1 Jun 2020 16:35:24 +0000 (18:35 +0200)] 
MINOR: memory: move pool-specific path of the locked pool_free() to __pool_free()

pool_free() was not identical between locked and lockless pools. The
different was the call to __pool_free() in one case versus open-coded
accesses in the other, and the poisoning brought by commit da52035a45
("MINOR: memory: also poison the area on freeing") which unfortunately
did if only for the lockless path.

Let's now have __pool_free() to work on the global pool also in the
locked case so that the code is architected similarly.

5 years agoMEDIUM: memory: don't let pool_put_to_cache() free the objects itself
Willy Tarreau [Mon, 1 Jun 2020 16:16:57 +0000 (18:16 +0200)] 
MEDIUM: memory: don't let pool_put_to_cache() free the objects itself

Just as for the allocation path, the release path was not symmetrical.
It was not logical to have pool_put_to_cache() free the objects itself,
it was pool_free's job. In addition, just because of a variable export
issue, it the insertion of the object to free back into the local cache
couldn't be inlined while it was very cheap.

This patch just slightly reorganizes this code path by making pool_free()
decide whether or not to put the object back into the cache via
pool_put_to_cache() otherwise place it back to the global pool using
__pool_free().  Then pool_put_to_cache() adds the item to the local
cache and only calls pool_evict_from_cache() if the cache is too big.

5 years agoMINOR: memory: don't let __pool_get_first() pick from the cache
Willy Tarreau [Mon, 1 Jun 2020 15:51:05 +0000 (17:51 +0200)] 
MINOR: memory: don't let __pool_get_first() pick from the cache

When building with the local cache support, we have an asymmetry in
the allocation path which is that __pool_get_first() picks from the
cache while when no cache support is used, this one directly accesses
the shared area. It looks like it was done this way only to centralize
the call to __pool_get_from_cache() but this was not a good idea as it
complicates the splitting the code.

Let's move the cache access to the upper layer so thatt __pool_get_first()
remains agnostic to the cache support.

The call tree now looks like this with the cache enabled :

    pool_get_first()
      __pool_get_from_cache() // if cache enabled
      __pool_get_first()

    pool_alloc()
      pool_alloc_dirty()
        __pool_get_from_cache() // if cache enabled
        __pool_get_first()
        __pool_refill_alloc()

    __pool_free()
      pool_free_area()

    pool_put_to_cache()
      __pool_free()
      __pool_put_to_cache()

    pool_free()
      pool_put_to_cache()

With cache disabled, the pool_free() path still differs:

    pool_free()
      __pool_free_area()
      __pool_put_to_cache()

5 years agoREORG: memory: move the OS-level allocator to haproxy/pool-os.h
Willy Tarreau [Sat, 30 May 2020 16:56:17 +0000 (18:56 +0200)] 
REORG: memory: move the OS-level allocator to haproxy/pool-os.h

The memory.h file is particularly complex due to the combination of
debugging options. This patch extracts the OS-level interface and
places it into a new file: pool-os.h.

Doing this also moves pool_alloc_area() and pool_free_area() out of
the #ifndef CONFIG_HAP_LOCKLESS_POOLS, making them usable from
__pool_refill_alloc(), pool_free(), pool_flush() and pool_gc() instead
of having direct calls to malloc/free there that are hard to wrap for
debugging purposes.

5 years agoREORG: memory: move the pool type definitions to haproxy/pool-t.h
Willy Tarreau [Sat, 30 May 2020 16:27:03 +0000 (18:27 +0200)] 
REORG: memory: move the pool type definitions to haproxy/pool-t.h

This is the beginning of the move and cleanup of memory.h. This first
step only extracts type definitions and basic macros that are needed
by the files which reference a pool. They're moved to pool-t.h (since
"pool" is more obvious than "memory" when looking for pool-related
stuff). 3 files which didn't need to include the whole memory.h were
updated.

5 years agoCLEANUP: pool: include freq_ctr.h and remove locally duplicated functions
Willy Tarreau [Mon, 1 Jun 2020 10:35:03 +0000 (12:35 +0200)] 
CLEANUP: pool: include freq_ctr.h and remove locally duplicated functions

In memory.h we had to reimplement the swrate* functions just because of
a broken circular dependency around freq_ctr.h. Now that this one is
solved, let's get rid of this copy and use the original ones instead.

5 years agoREORG: include: move freq_ctr to haproxy/
Willy Tarreau [Mon, 1 Jun 2020 10:18:08 +0000 (12:18 +0200)] 
REORG: include: move freq_ctr to haproxy/

types/freq_ctr.h was moved to haproxy/freq_ctr-t.h and proto/freq_ctr.h
was moved to haproxy/freq_ctr.h. Files were updated accordingly, no other
change was applied.