X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fovsdb-error.h;h=2bc259a548c42dce49bf4a90a0b8d2789b9b31f8;hb=ee98038f54a9eec4f30b32dd222530ea757c5d1b;hp=7e2523e3c96bf562dcebb2f2d00f9fbdb63597ab;hpb=c69ee87c10818267f991236201150b1fa51ae519;p=cascardo%2Fovs.git diff --git a/lib/ovsdb-error.h b/lib/ovsdb-error.h index 7e2523e3c..2bc259a54 100644 --- a/lib/ovsdb-error.h +++ b/lib/ovsdb-error.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009 Nicira Networks +/* Copyright (c) 2009, 2010, 2011 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,33 +21,49 @@ struct json; struct ovsdb_error *ovsdb_error(const char *tag, const char *details, ...) - PRINTF_FORMAT(2, 3) - WARN_UNUSED_RESULT; + OVS_PRINTF_FORMAT(2, 3) + OVS_WARN_UNUSED_RESULT; struct ovsdb_error *ovsdb_io_error(int error, const char *details, ...) - PRINTF_FORMAT(2, 3) - WARN_UNUSED_RESULT; + OVS_PRINTF_FORMAT(2, 3) + OVS_WARN_UNUSED_RESULT; struct ovsdb_error *ovsdb_syntax_error(const struct json *, const char *tag, const char *details, ...) - PRINTF_FORMAT(3, 4) - WARN_UNUSED_RESULT; + OVS_PRINTF_FORMAT(3, 4) + OVS_WARN_UNUSED_RESULT; struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error, const char *details, ...) - PRINTF_FORMAT(2, 3); + OVS_PRINTF_FORMAT(2, 3); -struct ovsdb_error *ovsdb_internal_error(const char *file, int line, +struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error, + const char *file, int line, const char *details, ...) - PRINTF_FORMAT(3, 4) - WARN_UNUSED_RESULT; -#define OVSDB_BUG(MSG) ovsdb_internal_error(__FILE__, __LINE__, "%s", MSG) + OVS_PRINTF_FORMAT(4, 5) + OVS_WARN_UNUSED_RESULT; + +/* Returns a pointer to an ovsdb_error that represents an internal error for + * the current file name and line number with MSG as the associated message. + * The caller is responsible for freeing the internal error. */ +#define OVSDB_BUG(MSG) \ + ovsdb_internal_error(NULL, __FILE__, __LINE__, "%s", MSG) + +/* Returns a pointer to an ovsdb_error that represents an internal error for + * the current file name and line number, with MSG as the associated message. + * If ERROR is nonnull then the internal error is wrapped around ERROR. Takes + * ownership of ERROR. The caller is responsible for freeing the returned + * error. */ +#define OVSDB_WRAP_BUG(MSG, ERROR) \ + ovsdb_internal_error(ERROR, __FILE__, __LINE__, "%s", MSG) void ovsdb_error_destroy(struct ovsdb_error *); struct ovsdb_error *ovsdb_error_clone(const struct ovsdb_error *) - WARN_UNUSED_RESULT; + OVS_WARN_UNUSED_RESULT; char *ovsdb_error_to_string(const struct ovsdb_error *); struct json *ovsdb_error_to_json(const struct ovsdb_error *); const char *ovsdb_error_get_tag(const struct ovsdb_error *); +void ovsdb_error_assert(struct ovsdb_error *); + #endif /* ovsdb-error.h */