[PATCH] Generate more of loadparm

Andrew Bartlett abartlet at samba.org
Mon Oct 14 02:50:52 MDT 2013


On Mon, 2013-10-14 at 09:30 +0200, Volker Lendecke wrote:
> On Mon, Oct 14, 2013 at 04:51:47PM +1300, Andrew Bartlett wrote:
> > Metze,
> > 
> > I noticed in your schannel-wip branch that you have a patch to try and
> > finish the s3/lp_ctx glue.  I figured I would help out by getting this
> > all automated, as I also needed an additional parameter passed though. 
> > 
> > In the attached patches, I auto-generate that, and I also auto-generate
> > all the lp_*() function prototypes, as a number were missing.  
> > 
> > I look forward to the day when this is all much more consistent and
> > generated along with our documentation, but for now I think this is a
> > move in the right direction.  Certainly it highlights well the dreaded
> > manually handled exceptions!
> 
> Why perl and not python these days? And -- can we get at
> least a minimum amount of hints for developers how all this
> mess is supposed to work? I am horrendously scared by all
> this.

I would love to swap more perl for python, but for the moment this
borrows from a working perl infrastructure.  

What I can do is try and write up some documentation, to explain which
parts expand with CPP and which other parts expand with perl.  I've
written some initial notes below:  Where do you think it should go long
term?  

The net result however is that to add or change an option, you only have
to modify lib/param/param_table.c and lib/param/param_functions.c.  The
rest is generated for you.  The glue I've automated more of today allows
you to call lpcfg_*() from common code, and have that read the 'right'
parameter table.  This is done via function pointers.  

This was done to allow merging from both ends - merging more parts of
the loadparm handling, and merging code that needs to read the smb.conf,
without having to do it all at once. 

The regular format of the CPP macros in param_functions.c is used to
generate up the prototypes (mkproto.pl, mks3param_proto.pl), the service
and globals table (mkparamdefs.pl), the glue table (mmks3param.pl) and
the initilisation of the glue table (mks3param_ctx_table.pl). 

I have tried combining some of these, but it just makes the scripts more
complex. 

The CPP macros are defined in and expand in lib/param/loadparm.c and
source3/param/loadparm.c to read the values from the generated
stuctures.  They are CPP #included into these files so that the same
macro has two definitions, depending on the system it is loading into. 

I realise this probably worries you more than re-assures you, and I
agree it need improvement, but I hope you can now understand a little of
how it works. 

Thanks,

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org




More information about the samba-technical mailing list