tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: config(5) break down



> Perhaps a first step would be using config(1) and files.* to generate
> the module makefiles instead of maintaining them by hand...

cube@ said he did this part long time ago.  The thing is that only fixing
these tools don't solve all problems magically.  We have to fix wrong instances
around the tree.

>  > Broken config(5) files will be named like "<module>.conf", because files.*
>  > namespace is insufficient.  For example pci.kmod can't use files.pci.
> 
> Huh? I don't understand.

Let's see the real examples.  sys/conf/files has this:

        file    net/zlib.c      (ppp & ppp_deflate) | ipsec | opencrypto | 
vnd_compression

This means that net/zlib.c is used by several modules (or subsystems or
whatever you call).  This is a problem because this is just a conditional
build.  The ownership of the file "net/zlib.c" is not clearly defined.

We should "normalize" this as:

        define  zlib
        file    net/zlib.c      zlib

And make users (ppp, ipsec, ...) "depends on" the collection "zlib".  Now
the ownership is clear.

What does (ppp & ppp_deflate) mean?  It is an expression when ppp and
PPP_DEFLATE is set by users.  This is redundant, because PPP_DEFLATE doesn't
work without ppp.  So this can be "normalized" as:

        define  ppp
        file    net/if_ppp.c    ppp
        defpseudo ppp:          ppp

        define  ppp_deflate:    ppp, zlib
        file    net/ppp-deflate.c
        defflag PPP_DEFLATE:    ppp_deflate

Now we define a module "ppp_deflate" which depends on "ppp" and "zlib".  To
make dependency really work, the depended modules must be already defined.
To make sure, we have to split files into pieces and "include" dependencies.

net/zlib.conf
        ----------------------------------------------------------------
        ifndef  zlib
        define  zlib
        file    net/zlib.c      zlib
        endif   # zlib
        ----------------------------------------------------------------

net/ppp.conf
        ----------------------------------------------------------------
        ifndef  ppp
        define  ppp
        file    net/if_ppp.c    ppp
        defpseudo ppp:          ppp
        endif   # ppp
        ----------------------------------------------------------------

ppp_deflate.conf
        ----------------------------------------------------------------
        include "net/ppp.conf"
        include "net/zlib.conf"
        ifndef  ppp_deflate
        define  ppp_deflate:    ppp, zlib
        file    net/ppp-deflate.c
        defflag PPP_DEFLATE:    ppp_deflate
        endif   # ppp_deflate
        ----------------------------------------------------------------

These split config(5) files are considered to be almost ready to be modular,
because file onwership is clearly defined, and its dependency are defined.

Masao

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index