X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fconf.h;h=2e8a5ca8889e77066556234f584feaf5d2bb8afe;hb=1ca423dc7562584d7747416951855a47eef09e1f;hp=4254f05c6426549402367e7fda2b9aab4beeac91;hpb=731e7fbc3e2a8c1b03a4657002a6a701b502ff07;p=libucw.git diff --git a/ucw/conf.h b/ucw/conf.h index 4254f05c..2e8a5ca8 100644 --- a/ucw/conf.h +++ b/ucw/conf.h @@ -13,6 +13,38 @@ #include +#ifdef CONFIG_UCW_CLEAN_ABI +#define cf_close_group ucw_cf_close_group +#define cf_declare_rel_section ucw_cf_declare_rel_section +#define cf_declare_section ucw_cf_declare_section +#define cf_delete_context ucw_cf_delete_context +#define cf_dump_sections ucw_cf_dump_sections +#define cf_find_item ucw_cf_find_item +#define cf_get_pool ucw_cf_get_pool +#define cf_init_section ucw_cf_init_section +#define cf_journal_block ucw_cf_journal_block +#define cf_journal_commit_transaction ucw_cf_journal_commit_transaction +#define cf_journal_new_transaction ucw_cf_journal_new_transaction +#define cf_journal_rollback_transaction ucw_cf_journal_rollback_transaction +#define cf_load ucw_cf_load +#define cf_malloc ucw_cf_malloc +#define cf_malloc_zero ucw_cf_malloc_zero +#define cf_modify_item ucw_cf_modify_item +#define cf_new_context ucw_cf_new_context +#define cf_open_group ucw_cf_open_group +#define cf_parse_double ucw_cf_parse_double +#define cf_parse_int ucw_cf_parse_int +#define cf_parse_ip ucw_cf_parse_ip +#define cf_parse_u64 ucw_cf_parse_u64 +#define cf_printf ucw_cf_printf +#define cf_reload ucw_cf_reload +#define cf_revert ucw_cf_revert +#define cf_set ucw_cf_set +#define cf_set_journalling ucw_cf_set_journalling +#define cf_strdup ucw_cf_strdup +#define cf_switch_context ucw_cf_switch_context +#endif + struct mempool; /*** @@ -392,7 +424,7 @@ struct cf_section { /** A section. **/ #define CF_ANY_NUM -0x7fffffff #define DARY_LEN(a) ((uns*)a)[-1] /** Length of an dynamic array. **/ -#define DARY_ALLOC(type,len,val...) ((struct { uns l; type a[len]; }) { .l = len, .a = { val } }).a +#define DARY_ALLOC(type,len,val...) ((struct { byte pad[ALIGN_TO(sizeof(uns), CPU_STRUCT_ALIGN) - sizeof(uns)]; uns l; type a[len]; }) { .l = len, .a = { val } }).a // creates a static instance of a dynamic array /*** @@ -488,8 +520,17 @@ void cf_journal_rollback_transaction(uns new_pool, struct cf_journal_item *oldj) * If @allow_unknown is set to 0 and a variable not described in @sec * is found in the configuration file, it produces an error. * If you set it to 1, all such variables are ignored. + * + * Please note that a single section definition cannot be used in multiple + * configuration contexts simultaneously. **/ void cf_declare_section(const char *name, struct cf_section *sec, uns allow_unknown); +/** + * Like @cf_declare_section(), but instead of item pointers, the section + * contains offsets relative to @ptr. In other words, it does the same + * as `CF_SECTION`, but for top-level sections. + **/ +void cf_declare_rel_section(const char *name, struct cf_section *sec, void *ptr, uns allow_unknown); /** * If you have a section in a structure and you want to initialize it * (eg. if you want a copy of default values outside the configuration),