]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: add struct cfgfile to represent config in memory
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 5 Aug 2024 08:03:00 +0000 (10:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Aug 2024 16:41:41 +0000 (18:41 +0200)
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.

include/haproxy/cfgparse.h

index 5f0fa97e0848fdcc8a6342393a95b3c7ee6b44ed..bafe985df246c82aaec9e65c3a183927791738e3 100644 (file)
@@ -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;