Re: [PATCH] caching daemon release and nsswitch patches

From: Michael Bushkov <bushman_at_rsu.ru>
Date: Mon, 29 Aug 2005 12:16:01 +0400 (MSD)
Hi, Doug!
> I'm not sure what guidelines were given to you when you started the project, 
> but in reviewing your work the first thing I noticed was that you are not 
> following the guidelines in the style(9) man page. You should read that page, 
> and spend an afternoon reformatting your code to fit what is described there. 
> The most common error you've made is not following the 80 column rule, which 
> hopefully should be easily fixed. While one could argue with the specific 
> items in that page, and quite possibly be right, the idea of having a style 
> guideline is more to have a common format that we can all work towards than 
> to have a perfect format that we can all agree on. By reformatting your code 
> to fit this guideline you will greatly increase the chances that it will be 
> welcomed into the tree with open arms.
>
> The other style area that you should look at is your man pages. If you look 
> in /usr/share/examples/mdoc you will find the FreeBSD style guidelines for 
> man pages. The line wrapping issue comes into play here as well. We generally 
> don't go past column 60 in man pages, since that reduces CVS repo churn for 
> corrections down the road. Also, any time you have a full stop (period) at 
> the end of a sentence, you should start a new line. I think that you are also 
> using some macros that I'm not familiar with, although I'm not an mdoc 
> expert.

Thank you very much for your suggestions - I'll reformat the code and man 
files. I've seemed to forget about style(9) in some places :(

>
> The other area that I'm interested in is how you plan to have cached interact 
> with DNS lookups, /etc/hosts, named, etc. If there was a project plan posted 
> somewhere on this already and I missed it, please accept my apologies, and 
> send along a reference. If not, I'm very interested to hear what your plans 
> are.
>

There is some information in my project's description here:
http://wikitest.freebsd.org/moin.cgi/NsswitchAndCachingTechnicalDetails

The "Integrating nsswitch and caching" describes the way that I use to 
make cached work. It can actually interact with any nsswitch database. 
All we need is to supply the special structure (in patches it is usually 
called "cache_info") with 3 functions pointers (*_id_func, *_marshal_func, 
*_unmarshal_func). These functions are used by nsdispatch during the 
caching of sccessful results. id_func identifies the key - the unique 
identifier, which will identify the data in the cache. And 
marshal_func/unmarshal_func pack/unpack data into/from the (char 
*)buffer. So almost all data, that go through nsdispatch calls, can be 
cached. And "struct hostent" and "struct addrinfo" are no exceptions to 
this rule. I already have the patch with *_id_func, *_marshal and 
*_unmarshal_func implemented for the "hosts" nsswitch database. I'll send 
it to the list along with the corrected version of the cached a bit later 
(in about 12 hours).

P.S. the patched version of nsdispatch uses the functions that are 
implemented in nscache.c and nscachedcli.c files (they are present in the 
patch).

With best regards,
Michael
Received on Mon Aug 29 2005 - 06:12:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:42 UTC