confoig.h squid.h design

From: Amos Jeffries <squid3@dont-contact.us>
Date: Wed, 23 Apr 2008 16:31:49 +1200 (NZST)

I've reached a crunch point in my 3.2-planned cleanups of the core include
structures. And need some input on the design going ahead.

This revolves around earlier discussion on squid.h and config.h. I'll
recap relevant bits so you don't have to research. It sort of overlaps
with Alex's published directory re-organisation.

As it exists now in 3.1 files pseudo-randomly include a combination of
squid.h, config.h, globals.h, typedefs.h, defines.h, structs.h, enums.h,
and some include/squid_*.h according to their immediate needs. So far I
have tweaked away removing as many of these include-dependencies as
possible. Which has left me at the position of choosing a squid-wide
global header.

Earlier discussion lead down the side path as to which if squid.h and
config.h was best to use as a global include guaranteed to be first. I've
picked config.h for now due to it having the simplest structure and looks
like someone has already attempted to remodel the includes with it.
(For the purpose of clarity and understanding I am keeping squid.h and
config.h named as-is until the very end)

First step is to generate a new folder, for this proposal I'll call it
'squidbits'.

It would eventually reside in Alex's ./compat directory as
./compat/squidbits. and is modelled on the kernel bits folder insofar as
nothing around squid is supposed to reference it directly and it contains
all the 'expert only' compat and type setup code needed.

That sub-directory would contain a file for each OS requiring OS-specific
tuning.
 * squidbits/mswin.h
 * squidbits/bsd.h (shared *BSD tuning)
 * squidbits/linux.h (shared 'nix tuning)
 * squidbits/freebsd.h (FreeBSD-only tuning)

And some bits-files for specific tuning.
 * squidbits/fdsetsize.h (for the global FD_SETSIZE logics currently in
config.h)
 * squidbits/resinit.h (for the global res_init logics currently in config.h)
 * others maybe for logics currently in squid.h

Secondly migrating the existing config.h to do a guaranteed short sequence
of actions:
 * include autoconf.h (autotools generated settings)
 * include version.h (release maintainer generated settings)
 * define OS-specific macros (ie #define _SQUID_FREEBSD_)
 * include squidbits/types.h (currently squid_types.h)
 * include squidbits/* for each OS.

It already has the first 4 sections, but the last section about squidbits
will be added in place of the existing direct-code which has so muddled
squid.h and is already starting to grow in config.h

This means config.h guaranteed:
 * is the ONLY place to include anything from squidbits/*
 * can be placed cleanly at the top of every .cc
 * stays clean of any lengthy compat code in itself

Finally, is to seamlessly rename (squid.h -> old_dirty_squid.h) and
(config.h -> squid.h)
then continue the cleanups removing stuff from old_dirty_squid.h

Any forseen problems or issues before I attempt this?

My public branches for testing are all listed at:
  http://treenet.co.nz/projects/squid/

Guido:
 I have seen the squid_mswin.h include currently in the 'OS-specific
macros' section.
Wrapping the code that include can be moved down at least to above the
types section (done). It also looks like it duplicates many of the general
definitions made in squid_types.h. Can you confirm that it works if moved
after the squid_types.h include and tweaked?

Amos
Received on Wed Apr 23 2008 - 04:31:52 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT