X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=uci.h;h=65fb7d34cb1fb00a8804de0a2197ef5fb4a01725;hp=c558696ea78e235285dcd6eadc66c0e00b140679;hb=bc7b118f0a40709c985b54c96d826e9057c9f0dd;hpb=a1ce94eed364952e8998def4e964ecb6b33b977d diff --git a/uci.h b/uci.h index c558696..65fb7d3 100644 --- a/uci.h +++ b/uci.h @@ -50,6 +50,11 @@ struct uci_parse_context; extern struct uci_context *uci_alloc(void); /** + * uci_free: Free the uci context including all of its data + */ +extern void uci_free(struct uci_context *ctx); + +/** * uci_perror: Print the last uci error that occured * @ctx: uci context * @str: string to print before the error message @@ -62,15 +67,29 @@ extern void uci_perror(struct uci_context *ctx, const char *str); * @ctx: uci context * @name: name of the config file (relative to the config directory) */ -int uci_load(struct uci_context *ctx, const char *name); +extern int uci_load(struct uci_context *ctx, const char *name, struct uci_config **cfg); + +/** + * uci_unload: Unload a config file from the uci context + * + * @ctx: uci context + * @name: name of the config file + */ +extern int uci_unload(struct uci_context *ctx, const char *name); /** * uci_cleanup: Clean up after an error * * @ctx: uci context */ -int uci_cleanup(struct uci_context *ctx); +extern int uci_cleanup(struct uci_context *ctx); +/** + * uci_list_configs: List available uci config files + * + * @ctx: uci context + */ +extern char **uci_list_configs(); /* UCI data structures */ @@ -84,8 +103,6 @@ struct uci_context /* private: */ int errno; jmp_buf trap; - jmp_buf trap_saved; - int saved; }; struct uci_parse_context @@ -95,6 +112,7 @@ struct uci_parse_context /* private: */ struct uci_config *cfg; + struct uci_section *section; FILE *file; char *buf; char *reason; @@ -131,7 +149,7 @@ struct uci_option #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -#define uci_list_empty(list) (list->next == ptr) +#define uci_list_empty(list) ((list)->next == (list)) #define uci_list_entry(_type, _ptr) \ ((struct uci_ ## _type *) ((char *)(_ptr) - offsetof(struct uci_ ## _type,list)))