]> git.proxmox.com Git - mirror_ovs.git/blame - lib/ovsdb-error.h
netdev-offload-tc: Use single 'once' variable for probing tc features
[mirror_ovs.git] / lib / ovsdb-error.h
CommitLineData
3865965d 1/* Copyright (c) 2009, 2010, 2011, 2016, 2017 Nicira, Inc.
f85f8ebb
BP
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef OVSDB_ERROR_H
17#define OVSDB_ERROR_H 1
18
19#include "compiler.h"
20
21struct json;
22
23struct ovsdb_error *ovsdb_error(const char *tag, const char *details, ...)
cab50449
TG
24 OVS_PRINTF_FORMAT(2, 3)
25 OVS_WARN_UNUSED_RESULT;
f85f8ebb 26struct ovsdb_error *ovsdb_io_error(int error, const char *details, ...)
cab50449
TG
27 OVS_PRINTF_FORMAT(2, 3)
28 OVS_WARN_UNUSED_RESULT;
f85f8ebb
BP
29struct ovsdb_error *ovsdb_syntax_error(const struct json *, const char *tag,
30 const char *details, ...)
cab50449
TG
31 OVS_PRINTF_FORMAT(3, 4)
32 OVS_WARN_UNUSED_RESULT;
f85f8ebb
BP
33
34struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error,
35 const char *details, ...)
cab50449 36 OVS_PRINTF_FORMAT(2, 3);
f85f8ebb 37
1dd5b71d
BP
38struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error,
39 const char *file, int line,
f85f8ebb 40 const char *details, ...)
cab50449
TG
41 OVS_PRINTF_FORMAT(4, 5)
42 OVS_WARN_UNUSED_RESULT;
1dd5b71d 43
d6db7b3c
LR
44struct ovsdb_error *ovsdb_perm_error(const char *details, ...)
45 OVS_PRINTF_FORMAT(1, 2)
46 OVS_WARN_UNUSED_RESULT;
47
1dd5b71d
BP
48/* Returns a pointer to an ovsdb_error that represents an internal error for
49 * the current file name and line number with MSG as the associated message.
50 * The caller is responsible for freeing the internal error. */
51#define OVSDB_BUG(MSG) \
52 ovsdb_internal_error(NULL, __FILE__, __LINE__, "%s", MSG)
53
54/* Returns a pointer to an ovsdb_error that represents an internal error for
55 * the current file name and line number, with MSG as the associated message.
56 * If ERROR is nonnull then the internal error is wrapped around ERROR. Takes
57 * ownership of ERROR. The caller is responsible for freeing the returned
58 * error. */
59#define OVSDB_WRAP_BUG(MSG, ERROR) \
60 ovsdb_internal_error(ERROR, __FILE__, __LINE__, "%s", MSG)
f85f8ebb
BP
61
62void ovsdb_error_destroy(struct ovsdb_error *);
63struct ovsdb_error *ovsdb_error_clone(const struct ovsdb_error *)
cab50449 64 OVS_WARN_UNUSED_RESULT;
f85f8ebb
BP
65
66char *ovsdb_error_to_string(const struct ovsdb_error *);
3865965d 67char *ovsdb_error_to_string_free(struct ovsdb_error *);
f85f8ebb 68struct json *ovsdb_error_to_json(const struct ovsdb_error *);
201891c3 69struct json *ovsdb_error_to_json_free(struct ovsdb_error *);
f85f8ebb
BP
70
71const char *ovsdb_error_get_tag(const struct ovsdb_error *);
72
80af01ed
BP
73void ovsdb_error_assert(struct ovsdb_error *);
74
f85f8ebb 75#endif /* ovsdb-error.h */