From: Valentine Krasnobaeva Date: Mon, 5 Aug 2024 08:03:00 +0000 (+0200) Subject: MINOR: cfgparse: add struct cfgfile to represent config in memory X-Git-Tag: v3.1-dev5~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70b842e847b4c39121c1a75bec7b60eb48298d0a;p=thirdparty%2Fhaproxy.git MINOR: cfgparse: add struct cfgfile to represent config in memory This and following commits serve to prepare loading configuration files in memory, before parsing them, as we may need to parse some parts of configuration in different moments of the startup sequence. This is a case of the new master-worker initialization process. Here we need to read at first only the global and the program sections and only after some steps (forking worker, etc) the rest of the configuration. Add a new structure cfgfile to keep configuration files metadata and content, loaded somewhere in a memory. Instances of filled cfgfile structures could be chained in a list, as the order in which they were loaded is important. --- diff --git a/include/haproxy/cfgparse.h b/include/haproxy/cfgparse.h index 5f0fa97e08..bafe985df2 100644 --- a/include/haproxy/cfgparse.h +++ b/include/haproxy/cfgparse.h @@ -90,6 +90,14 @@ struct cfg_postparser { int (*func)(); }; +/* store in memory config files meta data and content */ +struct cfgfile { + struct list list; + char *filename; /* config file name */ + char *content; /* allocated str with config file content */ + ssize_t size; /* size of stored file or error indication (-1) */ +}; + extern struct list postparsers; extern int cfg_maxpconn; extern int cfg_maxconn;