file: make uci commits atomic
[project/uci.git] / uci_blob.h
1 /*
2 * blob.c - uci <-> blobmsg conversion layer
3 * Copyright (C) 2012-2013 Felix Fietkau <nbd@openwrt.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License version 2.1
7 * as published by the Free Software Foundation
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 */
14 #ifndef __UCI_BLOB_H
15 #define __UCI_BLOB_H
16
17 #include <libubox/blobmsg.h>
18 #include "uci.h"
19
20 struct uci_blob_param_info {
21 enum blobmsg_type type;
22 };
23
24 struct uci_blob_param_list {
25 int n_params;
26 const struct blobmsg_policy *params;
27 const struct uci_blob_param_info *info;
28
29 int n_next;
30 const struct uci_blob_param_list *next[];
31 };
32
33 int uci_to_blob(struct blob_buf *b, struct uci_section *s,
34 const struct uci_blob_param_list *p);
35 bool uci_blob_check_equal(struct blob_attr *c1, struct blob_attr *c2,
36 const struct uci_blob_param_list *config);
37 bool uci_blob_diff(struct blob_attr **tb1, struct blob_attr **tb2,
38 const struct uci_blob_param_list *config,
39 unsigned long *diff_bits);
40
41 #endif