]> pilppa.org Git - uci.git/blobdiff - uci.h
add reorder to lua api
[uci.git] / uci.h
diff --git a/uci.h b/uci.h
index 66ad752c395725ad94d9a859bcb3c654763f3743..a04da29ff26bd2026fc3c7a3b5ee238acd8d81b7 100644 (file)
--- a/uci.h
+++ b/uci.h
@@ -83,6 +83,16 @@ extern void uci_free_context(struct uci_context *ctx);
  */
 extern void uci_perror(struct uci_context *ctx, const char *str);
 
+/**
+ * uci_geterror: Get an error string for the last uci error
+ * @ctx: uci context
+ * @dest: target pointer for the string
+ * @str: prefix for the error message
+ *
+ * Note: string must be freed by the caller
+ */
+extern void uci_get_errorstr(struct uci_context *ctx, char **dest, const char *str);
+
 /**
  * uci_import: Import uci config data from a stream
  * @ctx: uci context
@@ -167,6 +177,14 @@ extern int uci_set(struct uci_context *ctx, struct uci_ptr *ptr);
  */
 extern int uci_add_list(struct uci_context *ctx, struct uci_ptr *ptr);
 
+/**
+ * uci_reorder: Reposition a section
+ * @ctx: uci context
+ * @s: uci section to reposition
+ * @pos: new position in the section list
+ */
+extern int uci_reorder_section(struct uci_context *ctx, struct uci_section *s, int pos);
+
 /**
  * uci_rename: Rename an element
  * @ctx: uci context
@@ -379,6 +397,7 @@ enum uci_command {
        UCI_CMD_REMOVE,
        UCI_CMD_CHANGE,
        UCI_CMD_RENAME,
+       UCI_CMD_REORDER,
        UCI_CMD_LIST_ADD,
 };
 
@@ -422,8 +441,10 @@ struct uci_ptr
  * @type:   the type of the container struct this is embedded in.
  * @member: the name of the member within the struct.
  */
+#ifndef container_of
 #define container_of(ptr, type, member) \
        ((type *) ((char *)ptr - offsetof(type,member)))
+#endif
 
 
 /**