From: hno <> Date: Sat, 6 Jan 2001 18:09:43 +0000 (+0000) Subject: How to add global cbdata types, and clarified that CBDATA_TYPE only adds X-Git-Tag: SQUID_3_0_PRE1~1687 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f51d9cf5db22f005a3745615260bf392c923a5a;p=thirdparty%2Fsquid.git How to add global cbdata types, and clarified that CBDATA_TYPE only adds a local definition (file or block scope). --- diff --git a/doc/Programming-Guide/prog-guide.sgml b/doc/Programming-Guide/prog-guide.sgml index 7e13416274..9dee8e0ead 100644 --- a/doc/Programming-Guide/prog-guide.sgml +++ b/doc/Programming-Guide/prog-guide.sgml @@ -2,7 +2,7 @@
Squid Programmers Guide Duane Wessels, Squid Developers -$Id: prog-guide.sgml,v 1.31 2001/01/06 00:30:37 hno Exp $ +$Id: prog-guide.sgml,v 1.32 2001/01/06 11:09:43 hno Exp $ Squid is a WWW Cache application developed by the National Laboratory @@ -2097,21 +2097,36 @@ coupling between the storage layer and the replacement policy. then call - To add new data types to the allocator one uses the macros - CBDATA_TYPE and CBDATA_INIT_TYPE. + To add new module specific data types to the allocator one uses the + macros CBDATA_TYPE and CBDATA_INIT_TYPE. These creates a local cbdata + definition (file or block scope). Any CBDATA_ALLOC calls must be made + within this scope. However, cbdataFree might be called from anywhere. - /* Somewhere at the scope the cbdata type needs to exists, usually - * global + /* First the cbdata type needs to be defined in the module. This + * is usually done at file scope, but it can also be local to a + * function or block.. */ CBDATA_TYPE(type_of_data); /* Then in the code somewhere before the first allocation - * (can be called multiple times) + * (can be called multiple times with only a minimal overhead) */ CBDATA_INIT_TYPE(type_of_data); +

+ To add new global data types one have to add them to the + cbdata_type enum in enums.h, and a corresponding + CREATE_CBDATA call in cbdata.c:cbdataInit(). + +

+ TODO: Restructure the free function so there is one free function + associated with the whole cbdata type rather than per allocation. + +

+ TODO: Add macros for global definitions outside cbdata.c. + Cache Manager