mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 09:58:01 +00:00
Replace most uses of assert by ovs_assert.
This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
parent
4749f73d12
commit
cb22974d77
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009 Nicira, Inc.
|
||||
* Copyright (c) 2009, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -26,8 +26,6 @@
|
||||
|
||||
#include "aes128.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
static const uint32_t Te0[256] = {
|
||||
@ -748,7 +746,7 @@ aes128_schedule(struct aes128 *aes, const uint8_t key[16])
|
||||
rk[6] = rk[2] ^ rk[5];
|
||||
rk[7] = rk[3] ^ rk[6];
|
||||
}
|
||||
assert(rk == &aes->rk[40]);
|
||||
ovs_assert(rk == &aes->rk[40]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -533,7 +533,7 @@ bond_compose_learning_packet(struct bond *bond,
|
||||
tag_type tags = 0;
|
||||
struct flow flow;
|
||||
|
||||
assert(may_send_learning_packets(bond));
|
||||
ovs_assert(may_send_learning_packets(bond));
|
||||
|
||||
memset(&flow, 0, sizeof flow);
|
||||
memcpy(flow.dl_src, eth_src, ETH_ADDR_LEN);
|
||||
@ -1373,7 +1373,7 @@ bond_hash_tcp(const struct flow *flow, uint16_t vlan, uint32_t basis)
|
||||
static unsigned int
|
||||
bond_hash(const struct bond *bond, const struct flow *flow, uint16_t vlan)
|
||||
{
|
||||
assert(bond->balance == BM_TCP || bond->balance == BM_SLB);
|
||||
ovs_assert(bond->balance == BM_TCP || bond->balance == BM_SLB);
|
||||
|
||||
return (bond->balance == BM_TCP
|
||||
? bond_hash_tcp(flow, vlan, bond->basis)
|
||||
|
15
lib/byteq.c
15
lib/byteq.c
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2008, 2009 Nicira, Inc.
|
||||
/* Copyright (c) 2008, 2009, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -15,7 +15,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "byteq.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@ -65,7 +64,7 @@ byteq_is_full(const struct byteq *q)
|
||||
void
|
||||
byteq_put(struct byteq *q, uint8_t c)
|
||||
{
|
||||
assert(!byteq_is_full(q));
|
||||
ovs_assert(!byteq_is_full(q));
|
||||
*byteq_head(q) = c;
|
||||
q->head++;
|
||||
}
|
||||
@ -76,7 +75,7 @@ void
|
||||
byteq_putn(struct byteq *q, const void *p_, size_t n)
|
||||
{
|
||||
const uint8_t *p = p_;
|
||||
assert(byteq_avail(q) >= n);
|
||||
ovs_assert(byteq_avail(q) >= n);
|
||||
while (n > 0) {
|
||||
size_t chunk = MIN(n, byteq_headroom(q));
|
||||
memcpy(byteq_head(q), p, chunk);
|
||||
@ -100,7 +99,7 @@ uint8_t
|
||||
byteq_get(struct byteq *q)
|
||||
{
|
||||
uint8_t c;
|
||||
assert(!byteq_is_empty(q));
|
||||
ovs_assert(!byteq_is_empty(q));
|
||||
c = *byteq_tail(q);
|
||||
q->tail++;
|
||||
return c;
|
||||
@ -117,7 +116,7 @@ byteq_write(struct byteq *q, int fd)
|
||||
if (n > 0) {
|
||||
byteq_advance_tail(q, n);
|
||||
} else {
|
||||
assert(n < 0);
|
||||
ovs_assert(n < 0);
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
@ -165,7 +164,7 @@ byteq_tail(const struct byteq *q)
|
||||
void
|
||||
byteq_advance_tail(struct byteq *q, unsigned int n)
|
||||
{
|
||||
assert(byteq_tailroom(q) >= n);
|
||||
ovs_assert(byteq_tailroom(q) >= n);
|
||||
q->tail += n;
|
||||
}
|
||||
|
||||
@ -192,6 +191,6 @@ byteq_headroom(const struct byteq *q)
|
||||
void
|
||||
byteq_advance_head(struct byteq *q, unsigned int n)
|
||||
{
|
||||
assert(byteq_headroom(q) >= n);
|
||||
ovs_assert(byteq_headroom(q) >= n);
|
||||
q->head += n;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "cfm.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -190,7 +189,7 @@ cfm_generate_maid(struct cfm *cfm)
|
||||
md_len = strlen(ovs_md_name);
|
||||
ma_len = strlen(ovs_ma_name);
|
||||
|
||||
assert(md_len && ma_len && md_len + ma_len + 4 <= CCM_MAID_LEN);
|
||||
ovs_assert(md_len && ma_len && md_len + ma_len + 4 <= CCM_MAID_LEN);
|
||||
|
||||
cfm->maid[0] = 4; /* MD name string format. */
|
||||
cfm->maid[1] = md_len; /* MD name size. */
|
||||
@ -368,7 +367,7 @@ cfm_run(struct cfm *cfm)
|
||||
cfm->health = (rmp->num_health_ccm * 100) / exp_ccm_recvd;
|
||||
cfm->health = MIN(cfm->health, 100);
|
||||
rmp->num_health_ccm = 0;
|
||||
assert(cfm->health >= 0 && cfm->health <= 100);
|
||||
ovs_assert(cfm->health >= 0 && cfm->health <= 100);
|
||||
}
|
||||
cfm->health_interval = 0;
|
||||
}
|
||||
@ -466,7 +465,7 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
|
||||
}
|
||||
|
||||
if (cfm->ccm_interval == 0) {
|
||||
assert(cfm->extended);
|
||||
ovs_assert(cfm->extended);
|
||||
ccm->interval_ms_x = htons(cfm->ccm_interval_ms);
|
||||
} else {
|
||||
ccm->interval_ms_x = htons(0);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "classifier.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
#include "byte-order.h"
|
||||
@ -208,7 +207,7 @@ void
|
||||
classifier_insert(struct classifier *cls, struct cls_rule *rule)
|
||||
{
|
||||
struct cls_rule *displaced_rule = classifier_replace(cls, rule);
|
||||
assert(!displaced_rule);
|
||||
ovs_assert(!displaced_rule);
|
||||
}
|
||||
|
||||
/* Removes 'rule' from 'cls'. It is the caller's responsibility to destroy
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "daemon.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
@ -158,7 +157,9 @@ daemon_set_monitor(void)
|
||||
void
|
||||
daemon_save_fd(int fd)
|
||||
{
|
||||
assert(fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO);
|
||||
ovs_assert(fd == STDIN_FILENO ||
|
||||
fd == STDOUT_FILENO ||
|
||||
fd == STDERR_FILENO);
|
||||
save_fds[fd] = true;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "dpif-linux.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -958,7 +957,7 @@ dpif_linux_operate__(struct dpif *dpif_, struct dpif_op **ops, size_t n_ops)
|
||||
struct nl_transaction *txnsp[MAX_OPS];
|
||||
size_t i;
|
||||
|
||||
assert(n_ops <= MAX_OPS);
|
||||
ovs_assert(n_ops <= MAX_OPS);
|
||||
for (i = 0; i < n_ops; i++) {
|
||||
struct op_auxdata *aux = &auxes[i];
|
||||
struct dpif_op *op = ops[i];
|
||||
@ -1579,7 +1578,7 @@ dpif_linux_vport_transact(const struct dpif_linux_vport *request,
|
||||
struct ofpbuf *request_buf;
|
||||
int error;
|
||||
|
||||
assert((reply != NULL) == (bufp != NULL));
|
||||
ovs_assert((reply != NULL) == (bufp != NULL));
|
||||
|
||||
error = dpif_linux_init();
|
||||
if (error) {
|
||||
@ -1730,7 +1729,7 @@ dpif_linux_dp_transact(const struct dpif_linux_dp *request,
|
||||
struct ofpbuf *request_buf;
|
||||
int error;
|
||||
|
||||
assert((reply != NULL) == (bufp != NULL));
|
||||
ovs_assert((reply != NULL) == (bufp != NULL));
|
||||
|
||||
request_buf = ofpbuf_new(1024);
|
||||
dpif_linux_dp_to_ofpbuf(request, request_buf);
|
||||
@ -1851,9 +1850,9 @@ dpif_linux_flow_to_ofpbuf(const struct dpif_linux_flow *flow,
|
||||
}
|
||||
|
||||
/* We never need to send these to the kernel. */
|
||||
assert(!flow->stats);
|
||||
assert(!flow->tcp_flags);
|
||||
assert(!flow->used);
|
||||
ovs_assert(!flow->stats);
|
||||
ovs_assert(!flow->tcp_flags);
|
||||
ovs_assert(!flow->used);
|
||||
|
||||
if (flow->clear) {
|
||||
nl_msg_put_flag(buf, OVS_FLOW_ATTR_CLEAR);
|
||||
@ -1880,7 +1879,7 @@ dpif_linux_flow_transact(struct dpif_linux_flow *request,
|
||||
struct ofpbuf *request_buf;
|
||||
int error;
|
||||
|
||||
assert((reply != NULL) == (bufp != NULL));
|
||||
ovs_assert((reply != NULL) == (bufp != NULL));
|
||||
|
||||
if (reply) {
|
||||
request->nlmsg_flags |= NLM_F_ECHO;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "dpif.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@ -160,7 +159,7 @@ static void dp_netdev_execute_actions(struct dp_netdev *,
|
||||
static struct dpif_netdev *
|
||||
dpif_netdev_cast(const struct dpif *dpif)
|
||||
{
|
||||
assert(dpif->dpif_class->open == dpif_netdev_open);
|
||||
ovs_assert(dpif->dpif_class->open == dpif_netdev_open);
|
||||
return CONTAINER_OF(dpif, struct dpif_netdev, dpif);
|
||||
}
|
||||
|
||||
@ -289,7 +288,7 @@ dpif_netdev_open(const struct dpif_class *class, const char *name,
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
assert(dp != NULL);
|
||||
ovs_assert(dp != NULL);
|
||||
}
|
||||
} else {
|
||||
if (dp->class != class) {
|
||||
@ -337,7 +336,7 @@ static void
|
||||
dpif_netdev_close(struct dpif *dpif)
|
||||
{
|
||||
struct dp_netdev *dp = get_dp_netdev(dpif);
|
||||
assert(dp->open_cnt > 0);
|
||||
ovs_assert(dp->open_cnt > 0);
|
||||
if (--dp->open_cnt == 0 && dp->destroyed) {
|
||||
shash_find_and_delete(&dp_netdevs, dp->name);
|
||||
dp_netdev_free(dp);
|
||||
|
@ -22,7 +22,6 @@
|
||||
* exposed over OpenFlow as a single switch. Datapaths and the collections of
|
||||
* ports that they contain may be fixed or dynamic. */
|
||||
|
||||
#include <assert.h>
|
||||
#include "openflow/openflow.h"
|
||||
#include "dpif.h"
|
||||
#include "util.h"
|
||||
@ -49,7 +48,7 @@ void dpif_uninit(struct dpif *dpif, bool close);
|
||||
static inline void dpif_assert_class(const struct dpif *dpif,
|
||||
const struct dpif_class *dpif_class)
|
||||
{
|
||||
assert(dpif->dpif_class == dpif_class);
|
||||
ovs_assert(dpif->dpif_class == dpif_class);
|
||||
}
|
||||
|
||||
/* Datapath interface class structure, to be defined by each implementation of
|
||||
|
13
lib/dpif.c
13
lib/dpif.c
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "dpif-provider.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
@ -265,7 +264,7 @@ do_open(const char *name, const char *type, bool create, struct dpif **dpifp)
|
||||
error = registered_class->dpif_class->open(registered_class->dpif_class,
|
||||
name, create, &dpif);
|
||||
if (!error) {
|
||||
assert(dpif->dpif_class == registered_class->dpif_class);
|
||||
ovs_assert(dpif->dpif_class == registered_class->dpif_class);
|
||||
registered_class->refcount++;
|
||||
}
|
||||
|
||||
@ -329,8 +328,8 @@ dpif_close(struct dpif *dpif)
|
||||
|
||||
registered_class = shash_find_data(&dpif_classes,
|
||||
dpif->dpif_class->type);
|
||||
assert(registered_class);
|
||||
assert(registered_class->refcount);
|
||||
ovs_assert(registered_class);
|
||||
ovs_assert(registered_class->refcount);
|
||||
|
||||
registered_class->refcount--;
|
||||
dpif_uninit(dpif, true);
|
||||
@ -614,7 +613,7 @@ dpif_port_get_name(struct dpif *dpif, uint32_t port_no,
|
||||
struct dpif_port port;
|
||||
int error;
|
||||
|
||||
assert(name_size > 0);
|
||||
ovs_assert(name_size > 0);
|
||||
|
||||
error = dpif_port_query_by_number(dpif, port_no, &port);
|
||||
if (!error) {
|
||||
@ -821,8 +820,8 @@ dpif_flow_put__(struct dpif *dpif, const struct dpif_flow_put *put)
|
||||
int error;
|
||||
|
||||
COVERAGE_INC(dpif_flow_put);
|
||||
assert(!(put->flags & ~(DPIF_FP_CREATE | DPIF_FP_MODIFY
|
||||
| DPIF_FP_ZERO_STATS)));
|
||||
ovs_assert(!(put->flags & ~(DPIF_FP_CREATE | DPIF_FP_MODIFY
|
||||
| DPIF_FP_ZERO_STATS)));
|
||||
|
||||
error = dpif->dpif_class->flow_put(dpif, put);
|
||||
if (error && put->stats) {
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "dynamic-string.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@ -165,7 +164,7 @@ ds_put_format_valist(struct ds *ds, const char *format, va_list args_)
|
||||
needed = vsnprintf(&ds->string[ds->length], available, format, args);
|
||||
va_end(args);
|
||||
|
||||
assert(needed < available);
|
||||
ovs_assert(needed < available);
|
||||
ds->length += needed;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "fatal-signal.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
@ -112,7 +111,7 @@ fatal_signal_add_hook(void (*hook_cb)(void *aux), void (*cancel_cb)(void *aux),
|
||||
{
|
||||
fatal_signal_init();
|
||||
|
||||
assert(n_hooks < MAX_HOOKS);
|
||||
ovs_assert(n_hooks < MAX_HOOKS);
|
||||
hooks[n_hooks].hook_cb = hook_cb;
|
||||
hooks[n_hooks].cancel_cb = cancel_cb;
|
||||
hooks[n_hooks].aux = aux;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <config.h>
|
||||
#include <sys/types.h>
|
||||
#include "flow.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
@ -347,7 +346,7 @@ flow_extract(struct ofpbuf *packet, uint32_t skb_priority, uint32_t skb_mark,
|
||||
memset(flow, 0, sizeof *flow);
|
||||
|
||||
if (tnl) {
|
||||
assert(tnl != &flow->tunnel);
|
||||
ovs_assert(tnl != &flow->tunnel);
|
||||
flow->tunnel = *tnl;
|
||||
}
|
||||
flow->in_port = ofp_in_port;
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "hmap.h"
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "coverage.h"
|
||||
@ -91,8 +90,8 @@ resize(struct hmap *hmap, size_t new_mask)
|
||||
struct hmap tmp;
|
||||
size_t i;
|
||||
|
||||
assert(!(new_mask & (new_mask + 1)));
|
||||
assert(new_mask != SIZE_MAX);
|
||||
ovs_assert(!(new_mask & (new_mask + 1)));
|
||||
ovs_assert(new_mask != SIZE_MAX);
|
||||
|
||||
hmap_init(&tmp);
|
||||
if (new_mask) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Nicira, Inc.
|
||||
* Copyright (c) 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#include "hmapx.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
static struct hmapx_node *
|
||||
@ -119,7 +117,7 @@ void
|
||||
hmapx_add_assert(struct hmapx *map, void *data)
|
||||
{
|
||||
bool added OVS_UNUSED = hmapx_add(map, data);
|
||||
assert(added);
|
||||
ovs_assert(added);
|
||||
}
|
||||
|
||||
/* Removes all of the nodes from 'map'. */
|
||||
@ -159,7 +157,7 @@ void
|
||||
hmapx_find_and_delete_assert(struct hmapx *map, const void *data)
|
||||
{
|
||||
bool deleted OVS_UNUSED = hmapx_find_and_delete(map, data);
|
||||
assert(deleted);
|
||||
ovs_assert(deleted);
|
||||
}
|
||||
|
||||
/* Searches for 'data' in 'map'. Returns its node, if found, otherwise a null
|
||||
|
17
lib/json.c
17
lib/json.c
@ -18,7 +18,6 @@
|
||||
|
||||
#include "json.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
@ -288,42 +287,42 @@ json_object_put_string(struct json *json, const char *name, const char *value)
|
||||
const char *
|
||||
json_string(const struct json *json)
|
||||
{
|
||||
assert(json->type == JSON_STRING);
|
||||
ovs_assert(json->type == JSON_STRING);
|
||||
return json->u.string;
|
||||
}
|
||||
|
||||
struct json_array *
|
||||
json_array(const struct json *json)
|
||||
{
|
||||
assert(json->type == JSON_ARRAY);
|
||||
ovs_assert(json->type == JSON_ARRAY);
|
||||
return CONST_CAST(struct json_array *, &json->u.array);
|
||||
}
|
||||
|
||||
struct shash *
|
||||
json_object(const struct json *json)
|
||||
{
|
||||
assert(json->type == JSON_OBJECT);
|
||||
ovs_assert(json->type == JSON_OBJECT);
|
||||
return CONST_CAST(struct shash *, json->u.object);
|
||||
}
|
||||
|
||||
bool
|
||||
json_boolean(const struct json *json)
|
||||
{
|
||||
assert(json->type == JSON_TRUE || json->type == JSON_FALSE);
|
||||
ovs_assert(json->type == JSON_TRUE || json->type == JSON_FALSE);
|
||||
return json->type == JSON_TRUE;
|
||||
}
|
||||
|
||||
double
|
||||
json_real(const struct json *json)
|
||||
{
|
||||
assert(json->type == JSON_REAL || json->type == JSON_INTEGER);
|
||||
ovs_assert(json->type == JSON_REAL || json->type == JSON_INTEGER);
|
||||
return json->type == JSON_REAL ? json->u.real : json->u.integer;
|
||||
}
|
||||
|
||||
int64_t
|
||||
json_integer(const struct json *json)
|
||||
{
|
||||
assert(json->type == JSON_INTEGER);
|
||||
ovs_assert(json->type == JSON_INTEGER);
|
||||
return json->u.integer;
|
||||
}
|
||||
|
||||
@ -1130,8 +1129,8 @@ json_parser_finish(struct json_parser *p)
|
||||
}
|
||||
|
||||
if (!p->error) {
|
||||
assert(p->height == 1);
|
||||
assert(p->stack[0].json != NULL);
|
||||
ovs_assert(p->height == 1);
|
||||
ovs_assert(p->stack[0].json != NULL);
|
||||
json = p->stack[--p->height].json;
|
||||
} else {
|
||||
json = json_string_create_nocopy(p->error);
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "jsonrpc.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "byteq.h"
|
||||
@ -83,7 +82,7 @@ jsonrpc_open(struct stream *stream)
|
||||
{
|
||||
struct jsonrpc *rpc;
|
||||
|
||||
assert(stream != NULL);
|
||||
ovs_assert(stream != NULL);
|
||||
|
||||
rpc = xzalloc(sizeof *rpc);
|
||||
rpc->name = xstrdup(stream_get_name(stream));
|
||||
@ -473,7 +472,7 @@ jsonrpc_received(struct jsonrpc *rpc)
|
||||
static void
|
||||
jsonrpc_error(struct jsonrpc *rpc, int error)
|
||||
{
|
||||
assert(error);
|
||||
ovs_assert(error);
|
||||
if (!rpc->status) {
|
||||
rpc->status = error;
|
||||
jsonrpc_cleanup(rpc);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011 Nicira, Inc.
|
||||
/* Copyright (c) 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,7 +16,6 @@
|
||||
#include <config.h>
|
||||
#include "lacp.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "dynamic-string.h"
|
||||
@ -223,7 +222,7 @@ lacp_destroy(struct lacp *lacp)
|
||||
void
|
||||
lacp_configure(struct lacp *lacp, const struct lacp_settings *s)
|
||||
{
|
||||
assert(!eth_addr_is_zero(s->id));
|
||||
ovs_assert(!eth_addr_is_zero(s->id));
|
||||
|
||||
if (!lacp->name || strcmp(s->name, lacp->name)) {
|
||||
free(lacp->name);
|
||||
|
@ -409,7 +409,7 @@ send_features_request(struct lswitch *sw)
|
||||
struct ofp_switch_config *osc;
|
||||
int ofp_version = rconn_get_version(sw->rconn);
|
||||
|
||||
assert(ofp_version > 0 && ofp_version < 0xff);
|
||||
ovs_assert(ofp_version > 0 && ofp_version < 0xff);
|
||||
|
||||
/* Send OFPT_FEATURES_REQUEST. */
|
||||
b = ofpraw_alloc(OFPRAW_OFPT_FEATURES_REQUEST, ofp_version, 0);
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "list.h"
|
||||
#include <assert.h>
|
||||
|
||||
/* Initializes 'list' as an empty list. */
|
||||
void
|
||||
@ -138,7 +137,7 @@ list_front(const struct list *list_)
|
||||
{
|
||||
struct list *list = CONST_CAST(struct list *, list_);
|
||||
|
||||
assert(!list_is_empty(list));
|
||||
ovs_assert(!list_is_empty(list));
|
||||
return list->next;
|
||||
}
|
||||
|
||||
@ -149,7 +148,7 @@ list_back(const struct list *list_)
|
||||
{
|
||||
struct list *list = CONST_CAST(struct list *, list_);
|
||||
|
||||
assert(!list_is_empty(list));
|
||||
ovs_assert(!list_is_empty(list));
|
||||
return list->prev;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "mac-learning.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -284,7 +283,7 @@ mac_learning_lookup(const struct mac_learning *ml,
|
||||
} else {
|
||||
struct mac_entry *e = mac_entry_lookup(ml, dst, vlan);
|
||||
|
||||
assert(e == NULL || e->tag != 0);
|
||||
ovs_assert(e == NULL || e->tag != 0);
|
||||
if (tag) {
|
||||
/* Tag either the learned port or the lack thereof. */
|
||||
*tag |= e ? e->tag : make_unknown_mac_tag(ml, dst, vlan);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "match.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include "byte-order.h"
|
||||
#include "dynamic-string.h"
|
||||
@ -177,7 +176,7 @@ void
|
||||
match_set_reg_masked(struct match *match, unsigned int reg_idx,
|
||||
uint32_t value, uint32_t mask)
|
||||
{
|
||||
assert(reg_idx < FLOW_N_REGS);
|
||||
ovs_assert(reg_idx < FLOW_N_REGS);
|
||||
flow_wildcards_set_reg_mask(&match->wc, reg_idx, mask);
|
||||
match->flow.regs[reg_idx] = value & mask;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012 Nicira, Inc.
|
||||
* Copyright (c) 2011, 2012, 2013 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -18,7 +18,6 @@
|
||||
|
||||
#include "meta-flow.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <netinet/icmp6.h>
|
||||
@ -543,7 +542,7 @@ const struct mf_field *mf_from_nxm_header__(uint32_t header);
|
||||
const struct mf_field *
|
||||
mf_from_id(enum mf_field_id id)
|
||||
{
|
||||
assert((unsigned int) id < MFF_N_IDS);
|
||||
ovs_assert((unsigned int) id < MFF_N_IDS);
|
||||
return &mf_fields[id];
|
||||
}
|
||||
|
||||
@ -583,7 +582,7 @@ static void
|
||||
nxm_init_add_field(const struct mf_field *mf, uint32_t header)
|
||||
{
|
||||
if (header) {
|
||||
assert(!mf_from_nxm_header__(header));
|
||||
ovs_assert(!mf_from_nxm_header__(header));
|
||||
add_nxm_field(header, mf);
|
||||
if (mf->maskable != MFM_NONE) {
|
||||
add_nxm_field(NXM_MAKE_WILD_HEADER(header), mf);
|
||||
@ -1936,7 +1935,7 @@ mf_from_ethernet_string(const struct mf_field *mf, const char *s,
|
||||
uint8_t mac[ETH_ADDR_LEN],
|
||||
uint8_t mask[ETH_ADDR_LEN])
|
||||
{
|
||||
assert(mf->n_bytes == ETH_ADDR_LEN);
|
||||
ovs_assert(mf->n_bytes == ETH_ADDR_LEN);
|
||||
|
||||
switch (sscanf(s, ETH_ADDR_SCAN_FMT"/"ETH_ADDR_SCAN_FMT,
|
||||
ETH_ADDR_SCAN_ARGS(mac), ETH_ADDR_SCAN_ARGS(mask))){
|
||||
@ -1958,7 +1957,7 @@ mf_from_ipv4_string(const struct mf_field *mf, const char *s,
|
||||
{
|
||||
int prefix;
|
||||
|
||||
assert(mf->n_bytes == sizeof *ip);
|
||||
ovs_assert(mf->n_bytes == sizeof *ip);
|
||||
|
||||
if (sscanf(s, IP_SCAN_FMT"/"IP_SCAN_FMT,
|
||||
IP_SCAN_ARGS(ip), IP_SCAN_ARGS(mask)) == IP_SCAN_COUNT * 2) {
|
||||
@ -1990,7 +1989,7 @@ mf_from_ipv6_string(const struct mf_field *mf, const char *s,
|
||||
const char *name, *netmask;
|
||||
int retval;
|
||||
|
||||
assert(mf->n_bytes == sizeof *value);
|
||||
ovs_assert(mf->n_bytes == sizeof *value);
|
||||
|
||||
name = strtok_r(str, "/", &save_ptr);
|
||||
retval = name ? lookup_ipv6(name, value) : EINVAL;
|
||||
@ -2028,7 +2027,7 @@ mf_from_ofp_port_string(const struct mf_field *mf, const char *s,
|
||||
{
|
||||
uint16_t port;
|
||||
|
||||
assert(mf->n_bytes == sizeof(ovs_be16));
|
||||
ovs_assert(mf->n_bytes == sizeof(ovs_be16));
|
||||
if (*s == '-') {
|
||||
return xasprintf("%s: negative values not supported for %s",
|
||||
s, mf->name);
|
||||
@ -2183,7 +2182,7 @@ mf_parse(const struct mf_field *mf, const char *s,
|
||||
return mf_from_frag_string(s, &value->u8, &mask->u8);
|
||||
|
||||
case MFS_TNL_FLAGS:
|
||||
assert(mf->n_bytes == sizeof(ovs_be16));
|
||||
ovs_assert(mf->n_bytes == sizeof(ovs_be16));
|
||||
return mf_from_tun_flags_string(s, &value->be16, &mask->be16);
|
||||
}
|
||||
NOT_REACHED();
|
||||
@ -2215,7 +2214,7 @@ mf_format_integer_string(const struct mf_field *mf, const uint8_t *valuep,
|
||||
unsigned long long int integer;
|
||||
int i;
|
||||
|
||||
assert(mf->n_bytes <= 8);
|
||||
ovs_assert(mf->n_bytes <= 8);
|
||||
|
||||
integer = 0;
|
||||
for (i = 0; i < mf->n_bytes; i++) {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
@ -50,6 +49,7 @@
|
||||
#include "socket-util.h"
|
||||
#include "shash.h"
|
||||
#include "svec.h"
|
||||
#include "util.h"
|
||||
#include "vlog.h"
|
||||
|
||||
VLOG_DEFINE_THIS_MODULE(netdev_bsd);
|
||||
@ -157,14 +157,15 @@ is_netdev_bsd_class(const struct netdev_class *netdev_class)
|
||||
static struct netdev_bsd *
|
||||
netdev_bsd_cast(const struct netdev *netdev)
|
||||
{
|
||||
assert(is_netdev_bsd_class(netdev_dev_get_class(netdev_get_dev(netdev))));
|
||||
ovs_assert(is_netdev_bsd_class(netdev_dev_get_class(
|
||||
netdev_get_dev(netdev))));
|
||||
return CONTAINER_OF(netdev, struct netdev_bsd, netdev);
|
||||
}
|
||||
|
||||
static struct netdev_dev_bsd *
|
||||
netdev_dev_bsd_cast(const struct netdev_dev *netdev_dev)
|
||||
{
|
||||
assert(is_netdev_bsd_class(netdev_dev_get_class(netdev_dev)));
|
||||
ovs_assert(is_netdev_bsd_class(netdev_dev_get_class(netdev_dev)));
|
||||
return CONTAINER_OF(netdev_dev, struct netdev_dev_bsd, netdev_dev);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ is_dummy_class(const struct netdev_class *class)
|
||||
static struct netdev_dev_dummy *
|
||||
netdev_dev_dummy_cast(const struct netdev_dev *netdev_dev)
|
||||
{
|
||||
assert(is_dummy_class(netdev_dev_get_class(netdev_dev)));
|
||||
ovs_assert(is_dummy_class(netdev_dev_get_class(netdev_dev)));
|
||||
return CONTAINER_OF(netdev_dev, struct netdev_dev_dummy, netdev_dev);
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ static struct netdev_dummy *
|
||||
netdev_dummy_cast(const struct netdev *netdev)
|
||||
{
|
||||
struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
|
||||
assert(is_dummy_class(netdev_dev_get_class(netdev_dev)));
|
||||
ovs_assert(is_dummy_class(netdev_dev_get_class(netdev_dev)));
|
||||
return CONTAINER_OF(netdev, struct netdev_dummy, netdev);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "netdev-linux.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <arpa/inet.h>
|
||||
@ -444,7 +443,7 @@ static struct netdev_dev_linux *
|
||||
netdev_dev_linux_cast(const struct netdev_dev *netdev_dev)
|
||||
{
|
||||
const struct netdev_class *netdev_class = netdev_dev_get_class(netdev_dev);
|
||||
assert(is_netdev_linux_class(netdev_class));
|
||||
ovs_assert(is_netdev_linux_class(netdev_class));
|
||||
|
||||
return CONTAINER_OF(netdev_dev, struct netdev_dev_linux, netdev_dev);
|
||||
}
|
||||
@ -454,7 +453,7 @@ netdev_linux_cast(const struct netdev *netdev)
|
||||
{
|
||||
struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
|
||||
const struct netdev_class *netdev_class = netdev_dev_get_class(netdev_dev);
|
||||
assert(is_netdev_linux_class(netdev_class));
|
||||
ovs_assert(is_netdev_linux_class(netdev_class));
|
||||
|
||||
return CONTAINER_OF(netdev, struct netdev_linux, netdev);
|
||||
}
|
||||
@ -583,7 +582,7 @@ static int
|
||||
cache_notifier_ref(void)
|
||||
{
|
||||
if (!cache_notifier_refcount) {
|
||||
assert(!netdev_linux_cache_notifier);
|
||||
ovs_assert(!netdev_linux_cache_notifier);
|
||||
|
||||
netdev_linux_cache_notifier =
|
||||
rtnetlink_link_notifier_create(netdev_linux_cache_cb, NULL);
|
||||
@ -600,9 +599,9 @@ cache_notifier_ref(void)
|
||||
static void
|
||||
cache_notifier_unref(void)
|
||||
{
|
||||
assert(cache_notifier_refcount > 0);
|
||||
ovs_assert(cache_notifier_refcount > 0);
|
||||
if (!--cache_notifier_refcount) {
|
||||
assert(netdev_linux_cache_notifier);
|
||||
ovs_assert(netdev_linux_cache_notifier);
|
||||
rtnetlink_link_notifier_destroy(netdev_linux_cache_notifier);
|
||||
netdev_linux_cache_notifier = NULL;
|
||||
}
|
||||
@ -1919,11 +1918,11 @@ netdev_linux_set_qos(struct netdev *netdev,
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
assert(netdev_dev->tc == NULL);
|
||||
ovs_assert(netdev_dev->tc == NULL);
|
||||
|
||||
/* Install new qdisc. */
|
||||
error = new_ops->tc_install(netdev, details);
|
||||
assert((error == 0) == (netdev_dev->tc != NULL));
|
||||
ovs_assert((error == 0) == (netdev_dev->tc != NULL));
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -4145,7 +4144,7 @@ tc_query_qdisc(const struct netdev *netdev)
|
||||
|
||||
/* Instantiate it. */
|
||||
load_error = ops->tc_load(CONST_CAST(struct netdev *, netdev), qdisc);
|
||||
assert((load_error == 0) == (netdev_dev->tc != NULL));
|
||||
ovs_assert((load_error == 0) == (netdev_dev->tc != NULL));
|
||||
ofpbuf_delete(qdisc);
|
||||
|
||||
return error ? error : load_error;
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
/* Generic interface to network devices. */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "netdev.h"
|
||||
#include "list.h"
|
||||
#include "shash.h"
|
||||
@ -55,7 +53,7 @@ void netdev_dev_get_devices(const struct netdev_class *,
|
||||
static inline void netdev_dev_assert_class(const struct netdev_dev *netdev_dev,
|
||||
const struct netdev_class *class_)
|
||||
{
|
||||
assert(netdev_dev->netdev_class == class_);
|
||||
ovs_assert(netdev_dev->netdev_class == class_);
|
||||
}
|
||||
|
||||
/* A instance of an open network device.
|
||||
|
@ -91,14 +91,14 @@ is_vport_class(const struct netdev_class *class)
|
||||
static const struct vport_class *
|
||||
vport_class_cast(const struct netdev_class *class)
|
||||
{
|
||||
assert(is_vport_class(class));
|
||||
ovs_assert(is_vport_class(class));
|
||||
return CONTAINER_OF(class, struct vport_class, netdev_class);
|
||||
}
|
||||
|
||||
static struct netdev_dev_vport *
|
||||
netdev_dev_vport_cast(const struct netdev_dev *netdev_dev)
|
||||
{
|
||||
assert(is_vport_class(netdev_dev_get_class(netdev_dev)));
|
||||
ovs_assert(is_vport_class(netdev_dev_get_class(netdev_dev)));
|
||||
return CONTAINER_OF(netdev_dev, struct netdev_dev_vport, netdev_dev);
|
||||
}
|
||||
|
||||
|
13
lib/netdev.c
13
lib/netdev.c
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "netdev.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
@ -228,7 +227,7 @@ netdev_open(const char *name, const char *type, struct netdev **netdevp)
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
assert(netdev_dev->netdev_class == class);
|
||||
ovs_assert(netdev_dev->netdev_class == class);
|
||||
|
||||
}
|
||||
|
||||
@ -309,7 +308,7 @@ netdev_close(struct netdev *netdev)
|
||||
if (netdev) {
|
||||
struct netdev_dev *netdev_dev = netdev_get_dev(netdev);
|
||||
|
||||
assert(netdev_dev->ref_cnt);
|
||||
ovs_assert(netdev_dev->ref_cnt);
|
||||
netdev_dev->ref_cnt--;
|
||||
netdev_uninit(netdev, true);
|
||||
|
||||
@ -404,8 +403,8 @@ netdev_recv(struct netdev *netdev, struct ofpbuf *buffer)
|
||||
int (*recv)(struct netdev *, void *, size_t);
|
||||
int retval;
|
||||
|
||||
assert(buffer->size == 0);
|
||||
assert(ofpbuf_tailroom(buffer) >= ETH_TOTAL_MIN);
|
||||
ovs_assert(buffer->size == 0);
|
||||
ovs_assert(ofpbuf_tailroom(buffer) >= ETH_TOTAL_MIN);
|
||||
|
||||
recv = netdev_get_dev(netdev)->netdev_class->recv;
|
||||
retval = (recv
|
||||
@ -1316,7 +1315,7 @@ void
|
||||
netdev_dev_init(struct netdev_dev *netdev_dev, const char *name,
|
||||
const struct netdev_class *netdev_class)
|
||||
{
|
||||
assert(!shash_find(&netdev_dev_shash, name));
|
||||
ovs_assert(!shash_find(&netdev_dev_shash, name));
|
||||
|
||||
memset(netdev_dev, 0, sizeof *netdev_dev);
|
||||
netdev_dev->netdev_class = netdev_class;
|
||||
@ -1336,7 +1335,7 @@ netdev_dev_uninit(struct netdev_dev *netdev_dev, bool destroy)
|
||||
{
|
||||
char *name = netdev_dev->name;
|
||||
|
||||
assert(!netdev_dev->ref_cnt);
|
||||
ovs_assert(!netdev_dev->ref_cnt);
|
||||
|
||||
shash_delete(&netdev_dev_shash, netdev_dev->node);
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "netlink-notifier.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
@ -87,7 +86,7 @@ void
|
||||
nln_destroy(struct nln *nln)
|
||||
{
|
||||
if (nln) {
|
||||
assert(list_is_empty(&nln->all_notifiers));
|
||||
ovs_assert(list_is_empty(&nln->all_notifiers));
|
||||
nl_sock_destroy(nln->notify_sock);
|
||||
free(nln);
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "netlink-socket.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
@ -242,7 +241,7 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned int multicast_group)
|
||||
int
|
||||
nl_sock_leave_mcgroup(struct nl_sock *sock, unsigned int multicast_group)
|
||||
{
|
||||
assert(!sock->dump);
|
||||
ovs_assert(!sock->dump);
|
||||
if (setsockopt(sock->fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP,
|
||||
&multicast_group, sizeof multicast_group) < 0) {
|
||||
VLOG_WARN("could not leave multicast group %u (%s)",
|
||||
@ -333,7 +332,7 @@ nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, bool wait)
|
||||
struct msghdr msg;
|
||||
ssize_t retval;
|
||||
|
||||
assert(buf->allocated >= sizeof *nlmsghdr);
|
||||
ovs_assert(buf->allocated >= sizeof *nlmsghdr);
|
||||
ofpbuf_clear(buf);
|
||||
|
||||
iov[0].iov_base = buf->base;
|
||||
@ -881,7 +880,7 @@ nl_dump_done(struct nl_dump *dump)
|
||||
while (!dump->status) {
|
||||
struct ofpbuf reply;
|
||||
if (!nl_dump_next(dump, &reply)) {
|
||||
assert(dump->status);
|
||||
ovs_assert(dump->status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1100,7 +1099,7 @@ nl_lookup_genl_family(const char *name, int *number)
|
||||
}
|
||||
ofpbuf_delete(reply);
|
||||
|
||||
assert(*number != 0);
|
||||
ovs_assert(*number != 0);
|
||||
}
|
||||
return *number > 0 ? 0 : -*number;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "netlink.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
@ -113,7 +112,7 @@ nl_msg_put_nlmsghdr(struct ofpbuf *msg,
|
||||
{
|
||||
struct nlmsghdr *nlmsghdr;
|
||||
|
||||
assert(msg->size == 0);
|
||||
ovs_assert(msg->size == 0);
|
||||
|
||||
nl_msg_reserve(msg, NLMSG_HDRLEN + expected_payload);
|
||||
nlmsghdr = nl_msg_put_uninit(msg, NLMSG_HDRLEN);
|
||||
@ -152,7 +151,7 @@ nl_msg_put_genlmsghdr(struct ofpbuf *msg, size_t expected_payload,
|
||||
struct genlmsghdr *genlmsghdr;
|
||||
|
||||
nl_msg_put_nlmsghdr(msg, GENL_HDRLEN + expected_payload, family, flags);
|
||||
assert(msg->size == NLMSG_HDRLEN);
|
||||
ovs_assert(msg->size == NLMSG_HDRLEN);
|
||||
genlmsghdr = nl_msg_put_uninit(msg, GENL_HDRLEN);
|
||||
genlmsghdr->cmd = cmd;
|
||||
genlmsghdr->version = version;
|
||||
@ -214,7 +213,7 @@ nl_msg_put_unspec_uninit(struct ofpbuf *msg, uint16_t type, size_t size)
|
||||
{
|
||||
size_t total_size = NLA_HDRLEN + size;
|
||||
struct nlattr* nla = nl_msg_put_uninit(msg, total_size);
|
||||
assert(NLA_ALIGN(total_size) <= UINT16_MAX);
|
||||
ovs_assert(NLA_ALIGN(total_size) <= UINT16_MAX);
|
||||
nla->nla_len = total_size;
|
||||
nla->nla_type = type;
|
||||
return nla + 1;
|
||||
@ -313,7 +312,7 @@ nl_msg_push_unspec_uninit(struct ofpbuf *msg, uint16_t type, size_t size)
|
||||
{
|
||||
size_t total_size = NLA_HDRLEN + size;
|
||||
struct nlattr* nla = nl_msg_push_uninit(msg, total_size);
|
||||
assert(NLA_ALIGN(total_size) <= UINT16_MAX);
|
||||
ovs_assert(NLA_ALIGN(total_size) <= UINT16_MAX);
|
||||
nla->nla_len = total_size;
|
||||
nla->nla_type = type;
|
||||
return nla + 1;
|
||||
@ -474,7 +473,7 @@ nl_attr_type(const struct nlattr *nla)
|
||||
const void *
|
||||
nl_attr_get(const struct nlattr *nla)
|
||||
{
|
||||
assert(nla->nla_len >= NLA_HDRLEN);
|
||||
ovs_assert(nla->nla_len >= NLA_HDRLEN);
|
||||
return nla + 1;
|
||||
}
|
||||
|
||||
@ -482,7 +481,7 @@ nl_attr_get(const struct nlattr *nla)
|
||||
size_t
|
||||
nl_attr_get_size(const struct nlattr *nla)
|
||||
{
|
||||
assert(nla->nla_len >= NLA_HDRLEN);
|
||||
ovs_assert(nla->nla_len >= NLA_HDRLEN);
|
||||
return nla->nla_len - NLA_HDRLEN;
|
||||
}
|
||||
|
||||
@ -491,7 +490,7 @@ nl_attr_get_size(const struct nlattr *nla)
|
||||
const void *
|
||||
nl_attr_get_unspec(const struct nlattr *nla, size_t size)
|
||||
{
|
||||
assert(nla->nla_len >= NLA_HDRLEN + size);
|
||||
ovs_assert(nla->nla_len >= NLA_HDRLEN + size);
|
||||
return nla + 1;
|
||||
}
|
||||
|
||||
@ -577,8 +576,8 @@ nl_attr_get_be64(const struct nlattr *nla)
|
||||
const char *
|
||||
nl_attr_get_string(const struct nlattr *nla)
|
||||
{
|
||||
assert(nla->nla_len > NLA_HDRLEN);
|
||||
assert(memchr(nl_attr_get(nla), '\0', nla->nla_len - NLA_HDRLEN) != NULL);
|
||||
ovs_assert(nla->nla_len > NLA_HDRLEN);
|
||||
ovs_assert(memchr(nl_attr_get(nla), '\0', nla->nla_len - NLA_HDRLEN));
|
||||
return nl_attr_get(nla);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ nx_pull_raw(const uint8_t *p, unsigned int match_len, bool strict,
|
||||
{
|
||||
uint32_t header;
|
||||
|
||||
assert((cookie != NULL) == (cookie_mask != NULL));
|
||||
ovs_assert((cookie != NULL) == (cookie_mask != NULL));
|
||||
|
||||
match_init_catchall(match);
|
||||
if (cookie) {
|
||||
@ -1053,7 +1053,7 @@ set_field_format(const struct ofpact_reg_load *load, struct ds *s)
|
||||
const struct mf_field *mf = load->dst.field;
|
||||
union mf_value value;
|
||||
|
||||
assert(load->ofpact.compat == OFPUTIL_OFPAT12_SET_FIELD);
|
||||
ovs_assert(load->ofpact.compat == OFPUTIL_OFPAT12_SET_FIELD);
|
||||
ds_put_format(s, "set_field:");
|
||||
memset(&value, 0, sizeof value);
|
||||
bitwise_copy(&load->subvalue, sizeof load->subvalue, 0,
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nx-match.h"
|
||||
#include "ofp-util.h"
|
||||
#include "ofpbuf.h"
|
||||
#include "util.h"
|
||||
#include "vlog.h"
|
||||
|
||||
VLOG_DEFINE_THIS_MODULE(ofp_actions);
|
||||
@ -794,7 +795,7 @@ ofpacts_from_openflow11(const union ofp_action *in, size_t n_in,
|
||||
static inline const struct STRUCT * \
|
||||
instruction_get_##ENUM(const struct ofp11_instruction *inst)\
|
||||
{ \
|
||||
assert(inst->type == htons(ENUM)); \
|
||||
ovs_assert(inst->type == htons(ENUM)); \
|
||||
return (struct STRUCT *)inst; \
|
||||
} \
|
||||
\
|
||||
@ -2131,7 +2132,7 @@ ofpact_init(struct ofpact *ofpact, enum ofpact_type type, size_t len)
|
||||
void
|
||||
ofpact_update_len(struct ofpbuf *ofpacts, struct ofpact *ofpact)
|
||||
{
|
||||
assert(ofpact == ofpacts->l2);
|
||||
ovs_assert(ofpact == ofpacts->l2);
|
||||
ofpact->len = (char *) ofpbuf_tail(ofpacts) - (char *) ofpact;
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,7 @@ void *ofpact_put(struct ofpbuf *, enum ofpact_type, size_t len);
|
||||
static inline struct STRUCT * \
|
||||
ofpact_get_##ENUM(const struct ofpact *ofpact) \
|
||||
{ \
|
||||
assert(ofpact->type == OFPACT_##ENUM); \
|
||||
ovs_assert(ofpact->type == OFPACT_##ENUM); \
|
||||
return (struct STRUCT *) ofpact; \
|
||||
} \
|
||||
\
|
||||
|
@ -110,7 +110,7 @@ ofperr_get_pair__(enum ofperr error, const struct ofperr_domain *domain)
|
||||
{
|
||||
size_t ofs = error - OFPERR_OFS;
|
||||
|
||||
assert(ofperr_is_valid(error));
|
||||
ovs_assert(ofperr_is_valid(error));
|
||||
return &domain->errors[ofs];
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Nicira, Inc.
|
||||
* Copyright (c) 2012, 2013 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "ofp-msgs.h"
|
||||
#include <assert.h>
|
||||
#include "byte-order.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "hash.h"
|
||||
@ -253,7 +252,7 @@ ofphdrs_decode_assert(struct ofphdrs *hdrs,
|
||||
const struct ofp_header *oh, size_t length)
|
||||
{
|
||||
enum ofperr error = ofphdrs_decode(hdrs, oh, length);
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
}
|
||||
|
||||
static bool
|
||||
@ -416,7 +415,7 @@ ofpraw_pull_assert(struct ofpbuf *msg)
|
||||
enum ofpraw raw;
|
||||
|
||||
error = ofpraw_pull(&raw, msg);
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
return raw;
|
||||
}
|
||||
|
||||
@ -525,10 +524,10 @@ ofpraw_alloc_stats_reply(const struct ofp_header *request,
|
||||
|
||||
error = ofpraw_decode_partial(&request_raw, request,
|
||||
ntohs(request->length));
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
|
||||
reply_raw = ofpraw_stats_request_to_reply(request_raw, request->version);
|
||||
assert(reply_raw);
|
||||
ovs_assert(reply_raw);
|
||||
|
||||
return ofpraw_alloc_reply(reply_raw, request, extra_tailroom);
|
||||
}
|
||||
@ -595,10 +594,10 @@ ofpraw_put_stats_reply(const struct ofp_header *request, struct ofpbuf *buf)
|
||||
enum ofpraw raw;
|
||||
|
||||
error = ofpraw_decode_partial(&raw, request, ntohs(request->length));
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
|
||||
raw = ofpraw_stats_request_to_reply(raw, request->version);
|
||||
assert(raw);
|
||||
ovs_assert(raw);
|
||||
|
||||
ofpraw_put__(raw, request->version, request->xid, 0, buf);
|
||||
}
|
||||
@ -626,7 +625,7 @@ ofpraw_put__(enum ofpraw raw, uint8_t version, ovs_be32 xid,
|
||||
if (hdrs->type == OFPT_VENDOR) {
|
||||
struct nicira_header *nh = buf->l2;
|
||||
|
||||
assert(hdrs->vendor == NX_VENDOR_ID);
|
||||
ovs_assert(hdrs->vendor == NX_VENDOR_ID);
|
||||
nh->vendor = htonl(hdrs->vendor);
|
||||
nh->subtype = htonl(hdrs->subtype);
|
||||
} else if (version == OFP10_VERSION
|
||||
@ -701,13 +700,13 @@ ofpraw_stats_request_to_reply(enum ofpraw raw, uint8_t version)
|
||||
hdrs = instance->hdrs;
|
||||
switch ((enum ofp_version)hdrs.version) {
|
||||
case OFP10_VERSION:
|
||||
assert(hdrs.type == OFPT10_STATS_REQUEST);
|
||||
ovs_assert(hdrs.type == OFPT10_STATS_REQUEST);
|
||||
hdrs.type = OFPT10_STATS_REPLY;
|
||||
break;
|
||||
case OFP11_VERSION:
|
||||
case OFP12_VERSION:
|
||||
case OFP13_VERSION:
|
||||
assert(hdrs.type == OFPT11_STATS_REQUEST);
|
||||
ovs_assert(hdrs.type == OFPT11_STATS_REQUEST);
|
||||
hdrs.type = OFPT11_STATS_REPLY;
|
||||
break;
|
||||
default:
|
||||
@ -715,7 +714,7 @@ ofpraw_stats_request_to_reply(enum ofpraw raw, uint8_t version)
|
||||
}
|
||||
|
||||
error = ofpraw_from_ofphdrs(&reply_raw, &hdrs);
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
|
||||
return reply_raw;
|
||||
}
|
||||
@ -866,7 +865,7 @@ ofpmp_postappend(struct list *replies, size_t start_ofs)
|
||||
{
|
||||
struct ofpbuf *msg = ofpbuf_from_list(list_back(replies));
|
||||
|
||||
assert(start_ofs <= UINT16_MAX);
|
||||
ovs_assert(start_ofs <= UINT16_MAX);
|
||||
if (msg->size > UINT16_MAX) {
|
||||
size_t len = msg->size - start_ofs;
|
||||
memcpy(ofpmp_append(replies, len),
|
||||
@ -916,14 +915,14 @@ raw_info_get(enum ofpraw raw)
|
||||
{
|
||||
ofpmsgs_init();
|
||||
|
||||
assert(raw < ARRAY_SIZE(raw_infos));
|
||||
ovs_assert(raw < ARRAY_SIZE(raw_infos));
|
||||
return &raw_infos[raw];
|
||||
}
|
||||
|
||||
static struct raw_instance *
|
||||
raw_instance_get(const struct raw_info *info, uint8_t version)
|
||||
{
|
||||
assert(version >= info->min_version && version <= info->max_version);
|
||||
ovs_assert(version >= info->min_version && version <= info->max_version);
|
||||
return &info->instances[version - info->min_version];
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -807,7 +807,7 @@ ofputil_protocols_to_string(enum ofputil_protocol protocols)
|
||||
{
|
||||
struct ds s;
|
||||
|
||||
assert(!(protocols & ~OFPUTIL_P_ANY));
|
||||
ovs_assert(!(protocols & ~OFPUTIL_P_ANY));
|
||||
if (protocols == 0) {
|
||||
return xstrdup("none");
|
||||
}
|
||||
@ -1367,7 +1367,7 @@ ofputil_encode_set_protocol(enum ofputil_protocol current,
|
||||
return ofputil_make_flow_mod_table_id(want_tid);
|
||||
}
|
||||
|
||||
assert(current == want);
|
||||
ovs_assert(current == want);
|
||||
|
||||
*next = current;
|
||||
return NULL;
|
||||
@ -1381,7 +1381,7 @@ ofputil_encode_nx_set_flow_format(enum nx_flow_format nxff)
|
||||
struct nx_set_flow_format *sff;
|
||||
struct ofpbuf *msg;
|
||||
|
||||
assert(ofputil_nx_flow_format_is_valid(nxff));
|
||||
ovs_assert(ofputil_nx_flow_format_is_valid(nxff));
|
||||
|
||||
msg = ofpraw_alloc(OFPRAW_NXT_SET_FLOW_FORMAT, OFP10_VERSION, 0);
|
||||
sff = ofpbuf_put_zeros(msg, sizeof *sff);
|
||||
@ -3226,7 +3226,7 @@ ofputil_decode_port_status(const struct ofp_header *oh,
|
||||
ps->reason = ops->reason;
|
||||
|
||||
retval = ofputil_pull_phy_port(oh->version, &b, &ps->desc);
|
||||
assert(retval != EOF);
|
||||
ovs_assert(retval != EOF);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "ofpbuf.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "dynamic-string.h"
|
||||
@ -421,7 +420,7 @@ ofpbuf_put_hex(struct ofpbuf *b, const char *s, size_t *n)
|
||||
void
|
||||
ofpbuf_reserve(struct ofpbuf *b, size_t size)
|
||||
{
|
||||
assert(!b->size);
|
||||
ovs_assert(!b->size);
|
||||
ofpbuf_prealloc_tailroom(b, size);
|
||||
b->data = (char*)b->data + size;
|
||||
}
|
||||
@ -473,7 +472,7 @@ ofpbuf_at(const struct ofpbuf *b, size_t offset, size_t size)
|
||||
void *
|
||||
ofpbuf_at_assert(const struct ofpbuf *b, size_t offset, size_t size)
|
||||
{
|
||||
assert(offset + size <= b->size);
|
||||
ovs_assert(offset + size <= b->size);
|
||||
return ((char *) b->data) + offset;
|
||||
}
|
||||
|
||||
@ -506,7 +505,7 @@ void *
|
||||
ofpbuf_pull(struct ofpbuf *b, size_t size)
|
||||
{
|
||||
void *data = b->data;
|
||||
assert(b->size >= size);
|
||||
ovs_assert(b->size >= size);
|
||||
b->data = (char*)b->data + size;
|
||||
b->size -= size;
|
||||
return data;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "ovsdb-data.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
@ -108,7 +107,7 @@ ovsdb_atom_default(enum ovsdb_atomic_type type)
|
||||
inited = true;
|
||||
}
|
||||
|
||||
assert(ovsdb_atomic_type_is_valid(type));
|
||||
ovs_assert(ovsdb_atomic_type_is_valid(type));
|
||||
return &default_atoms[type];
|
||||
}
|
||||
|
||||
@ -290,7 +289,7 @@ static void
|
||||
ovsdb_symbol_referenced(struct ovsdb_symbol *symbol,
|
||||
const struct ovsdb_base_type *base)
|
||||
{
|
||||
assert(base->type == OVSDB_TYPE_UUID);
|
||||
ovs_assert(base->type == OVSDB_TYPE_UUID);
|
||||
|
||||
if (base->u.uuid.refTableName) {
|
||||
switch (base->u.uuid.refType) {
|
||||
@ -879,7 +878,7 @@ ovsdb_datum_default(const struct ovsdb_type *type)
|
||||
int kt = type->key.type;
|
||||
int vt = type->value.type;
|
||||
|
||||
assert(ovsdb_type_is_valid(type));
|
||||
ovs_assert(ovsdb_type_is_valid(type));
|
||||
|
||||
d = &default_data[kt][vt];
|
||||
if (!d->n) {
|
||||
@ -1543,7 +1542,7 @@ ovsdb_datum_from_smap(struct ovsdb_datum *datum, struct smap *smap)
|
||||
&datum->keys[i].string, &datum->values[i].string);
|
||||
i++;
|
||||
}
|
||||
assert(i == datum->n);
|
||||
ovs_assert(i == datum->n);
|
||||
|
||||
smap_destroy(smap);
|
||||
ovsdb_datum_sort_unique(datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
|
||||
@ -1802,7 +1801,7 @@ ovsdb_datum_union(struct ovsdb_datum *a, const struct ovsdb_datum *b,
|
||||
struct ovsdb_error *error;
|
||||
a->n = n;
|
||||
error = ovsdb_datum_sort(a, type->key.type);
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1814,9 +1813,9 @@ ovsdb_datum_subtract(struct ovsdb_datum *a, const struct ovsdb_type *a_type,
|
||||
bool changed = false;
|
||||
size_t i;
|
||||
|
||||
assert(a_type->key.type == b_type->key.type);
|
||||
assert(a_type->value.type == b_type->value.type
|
||||
|| b_type->value.type == OVSDB_TYPE_VOID);
|
||||
ovs_assert(a_type->key.type == b_type->key.type);
|
||||
ovs_assert(a_type->value.type == b_type->value.type
|
||||
|| b_type->value.type == OVSDB_TYPE_VOID);
|
||||
|
||||
/* XXX The big-O of this could easily be improved. */
|
||||
for (i = 0; i < a->n; ) {
|
||||
@ -1863,7 +1862,7 @@ ovsdb_symbol_table_put(struct ovsdb_symbol_table *symtab, const char *name,
|
||||
{
|
||||
struct ovsdb_symbol *symbol;
|
||||
|
||||
assert(!ovsdb_symbol_table_get(symtab, name));
|
||||
ovs_assert(!ovsdb_symbol_table_get(symtab, name));
|
||||
symbol = xmalloc(sizeof *symbol);
|
||||
symbol->uuid = *uuid;
|
||||
symbol->created = created;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "ovsdb-idl.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
@ -216,7 +215,7 @@ ovsdb_idl_destroy(struct ovsdb_idl *idl)
|
||||
if (idl) {
|
||||
size_t i;
|
||||
|
||||
assert(!idl->txn);
|
||||
ovs_assert(!idl->txn);
|
||||
ovsdb_idl_clear(idl);
|
||||
jsonrpc_session_close(idl->session);
|
||||
|
||||
@ -280,7 +279,7 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(!idl->txn);
|
||||
ovs_assert(!idl->txn);
|
||||
jsonrpc_session_run(idl->session);
|
||||
for (i = 0; jsonrpc_session_is_connected(idl->session) && i < 50; i++) {
|
||||
struct jsonrpc_msg *msg;
|
||||
@ -420,7 +419,7 @@ ovsdb_idl_get_mode(struct ovsdb_idl *idl,
|
||||
{
|
||||
size_t i;
|
||||
|
||||
assert(!idl->change_seqno);
|
||||
ovs_assert(!idl->change_seqno);
|
||||
|
||||
for (i = 0; i < idl->class->n_tables; i++) {
|
||||
const struct ovsdb_idl_table *table = &idl->tables[i];
|
||||
@ -836,7 +835,7 @@ ovsdb_idl_row_unparse(struct ovsdb_idl_row *row)
|
||||
static void
|
||||
ovsdb_idl_row_clear_old(struct ovsdb_idl_row *row)
|
||||
{
|
||||
assert(row->old == row->new);
|
||||
ovs_assert(row->old == row->new);
|
||||
if (!ovsdb_idl_row_is_orphan(row)) {
|
||||
const struct ovsdb_idl_table_class *class = row->table->class;
|
||||
size_t i;
|
||||
@ -951,7 +950,7 @@ ovsdb_idl_insert_row(struct ovsdb_idl_row *row, const struct json *row_json)
|
||||
const struct ovsdb_idl_table_class *class = row->table->class;
|
||||
size_t i;
|
||||
|
||||
assert(!row->old && !row->new);
|
||||
ovs_assert(!row->old && !row->new);
|
||||
row->old = row->new = xmalloc(class->n_columns * sizeof *row->old);
|
||||
for (i = 0; i < class->n_columns; i++) {
|
||||
ovsdb_datum_init_default(&row->old[i], &class->columns[i].type);
|
||||
@ -1132,13 +1131,13 @@ ovsdb_idl_read(const struct ovsdb_idl_row *row,
|
||||
const struct ovsdb_idl_table_class *class;
|
||||
size_t column_idx;
|
||||
|
||||
assert(!ovsdb_idl_row_is_synthetic(row));
|
||||
ovs_assert(!ovsdb_idl_row_is_synthetic(row));
|
||||
|
||||
class = row->table->class;
|
||||
column_idx = column - class->columns;
|
||||
|
||||
assert(row->new != NULL);
|
||||
assert(column_idx < class->n_columns);
|
||||
ovs_assert(row->new != NULL);
|
||||
ovs_assert(column_idx < class->n_columns);
|
||||
|
||||
if (row->written && bitmap_is_set(row->written, column_idx)) {
|
||||
return &row->new[column_idx];
|
||||
@ -1162,8 +1161,8 @@ ovsdb_idl_get(const struct ovsdb_idl_row *row,
|
||||
enum ovsdb_atomic_type key_type OVS_UNUSED,
|
||||
enum ovsdb_atomic_type value_type OVS_UNUSED)
|
||||
{
|
||||
assert(column->type.key.type == key_type);
|
||||
assert(column->type.value.type == value_type);
|
||||
ovs_assert(column->type.key.type == key_type);
|
||||
ovs_assert(column->type.value.type == value_type);
|
||||
|
||||
return ovsdb_idl_read(row, column);
|
||||
}
|
||||
@ -1219,7 +1218,7 @@ ovsdb_idl_txn_create(struct ovsdb_idl *idl)
|
||||
{
|
||||
struct ovsdb_idl_txn *txn;
|
||||
|
||||
assert(!idl->txn);
|
||||
ovs_assert(!idl->txn);
|
||||
idl->txn = txn = xmalloc(sizeof *txn);
|
||||
txn->request_id = NULL;
|
||||
txn->idl = idl;
|
||||
@ -1286,9 +1285,9 @@ ovsdb_idl_txn_increment(struct ovsdb_idl_txn *txn,
|
||||
const struct ovsdb_idl_row *row,
|
||||
const struct ovsdb_idl_column *column)
|
||||
{
|
||||
assert(!txn->inc_table);
|
||||
assert(column->type.key.type == OVSDB_TYPE_INTEGER);
|
||||
assert(column->type.value.type == OVSDB_TYPE_VOID);
|
||||
ovs_assert(!txn->inc_table);
|
||||
ovs_assert(column->type.key.type == OVSDB_TYPE_INTEGER);
|
||||
ovs_assert(column->type.value.type == OVSDB_TYPE_VOID);
|
||||
|
||||
txn->inc_table = row->table->class->name;
|
||||
txn->inc_column = column->name;
|
||||
@ -1729,7 +1728,7 @@ ovsdb_idl_txn_commit_block(struct ovsdb_idl_txn *txn)
|
||||
int64_t
|
||||
ovsdb_idl_txn_get_increment_new_value(const struct ovsdb_idl_txn *txn)
|
||||
{
|
||||
assert(txn->status == TXN_SUCCESS);
|
||||
ovs_assert(txn->status == TXN_SUCCESS);
|
||||
return txn->inc_new_value;
|
||||
}
|
||||
|
||||
@ -1792,7 +1791,7 @@ ovsdb_idl_txn_get_insert_uuid(const struct ovsdb_idl_txn *txn,
|
||||
{
|
||||
const struct ovsdb_idl_txn_insert *insert;
|
||||
|
||||
assert(txn->status == TXN_SUCCESS || txn->status == TXN_UNCHANGED);
|
||||
ovs_assert(txn->status == TXN_SUCCESS || txn->status == TXN_UNCHANGED);
|
||||
HMAP_FOR_EACH_IN_BUCKET (insert, hmap_node,
|
||||
uuid_hash(uuid), &txn->inserted_rows) {
|
||||
if (uuid_equals(uuid, &insert->dummy)) {
|
||||
@ -1846,10 +1845,10 @@ ovsdb_idl_txn_write(const struct ovsdb_idl_row *row_,
|
||||
column_idx = column - class->columns;
|
||||
write_only = row->table->modes[column_idx] == OVSDB_IDL_MONITOR;
|
||||
|
||||
assert(row->new != NULL);
|
||||
assert(column_idx < class->n_columns);
|
||||
assert(row->old == NULL ||
|
||||
row->table->modes[column_idx] & OVSDB_IDL_MONITOR);
|
||||
ovs_assert(row->new != NULL);
|
||||
ovs_assert(column_idx < class->n_columns);
|
||||
ovs_assert(row->old == NULL ||
|
||||
row->table->modes[column_idx] & OVSDB_IDL_MONITOR);
|
||||
|
||||
if (row->table->idl->verify_write_only && !write_only) {
|
||||
VLOG_ERR("Bug: Attempt to write to a read/write column (%s:%s) when"
|
||||
@ -1938,9 +1937,9 @@ ovsdb_idl_txn_verify(const struct ovsdb_idl_row *row_,
|
||||
class = row->table->class;
|
||||
column_idx = column - class->columns;
|
||||
|
||||
assert(row->new != NULL);
|
||||
assert(row->old == NULL ||
|
||||
row->table->modes[column_idx] & OVSDB_IDL_MONITOR);
|
||||
ovs_assert(row->new != NULL);
|
||||
ovs_assert(row->old == NULL ||
|
||||
row->table->modes[column_idx] & OVSDB_IDL_MONITOR);
|
||||
if (!row->old
|
||||
|| (row->written && bitmap_is_set(row->written, column_idx))) {
|
||||
return;
|
||||
@ -1972,11 +1971,11 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_)
|
||||
return;
|
||||
}
|
||||
|
||||
assert(row->new != NULL);
|
||||
ovs_assert(row->new != NULL);
|
||||
if (!row->old) {
|
||||
ovsdb_idl_row_unparse(row);
|
||||
ovsdb_idl_row_clear_new(row);
|
||||
assert(!row->prereqs);
|
||||
ovs_assert(!row->prereqs);
|
||||
hmap_remove(&row->table->rows, &row->hmap_node);
|
||||
hmap_remove(&row->table->idl->txn->txn_rows, &row->txn_node);
|
||||
free(row);
|
||||
@ -2010,7 +2009,7 @@ ovsdb_idl_txn_insert(struct ovsdb_idl_txn *txn,
|
||||
struct ovsdb_idl_row *row = ovsdb_idl_row_create__(class);
|
||||
|
||||
if (uuid) {
|
||||
assert(!ovsdb_idl_txn_get_row(txn, uuid));
|
||||
ovs_assert(!ovsdb_idl_txn_get_row(txn, uuid));
|
||||
row->uuid = *uuid;
|
||||
} else {
|
||||
uuid_generate(&row->uuid);
|
||||
@ -2244,7 +2243,7 @@ struct ovsdb_idl_txn *
|
||||
ovsdb_idl_txn_get(const struct ovsdb_idl_row *row)
|
||||
{
|
||||
struct ovsdb_idl_txn *txn = row->table->idl->txn;
|
||||
assert(txn != NULL);
|
||||
ovs_assert(txn != NULL);
|
||||
return txn;
|
||||
}
|
||||
|
||||
@ -2264,8 +2263,8 @@ ovsdb_idl_txn_get_idl (struct ovsdb_idl_txn *txn)
|
||||
void
|
||||
ovsdb_idl_set_lock(struct ovsdb_idl *idl, const char *lock_name)
|
||||
{
|
||||
assert(!idl->txn);
|
||||
assert(hmap_is_empty(&idl->outstanding_txns));
|
||||
ovs_assert(!idl->txn);
|
||||
ovs_assert(hmap_is_empty(&idl->outstanding_txns));
|
||||
|
||||
if (idl->lock_name && (!lock_name || strcmp(lock_name, idl->lock_name))) {
|
||||
/* Release previous lock. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 Nicira, Inc.
|
||||
* Copyright (c) 2009, 2010, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "pcap.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
@ -50,7 +49,7 @@ pcap_open(const char *file_name, const char *mode)
|
||||
{
|
||||
FILE *file;
|
||||
|
||||
assert(!strcmp(mode, "rb") || !strcmp(mode, "wb"));
|
||||
ovs_assert(!strcmp(mode, "rb") || !strcmp(mode, "wb"));
|
||||
|
||||
file = fopen(file_name, mode);
|
||||
if (file == NULL) {
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "poll-loop.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <poll.h>
|
||||
@ -289,7 +288,7 @@ static struct poll_waiter *
|
||||
new_waiter(int fd, short int events, const char *where)
|
||||
{
|
||||
struct poll_waiter *waiter = xzalloc(sizeof *waiter);
|
||||
assert(fd >= 0);
|
||||
ovs_assert(fd >= 0);
|
||||
waiter->fd = fd;
|
||||
waiter->events = events;
|
||||
waiter->where = where;
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "process.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
@ -159,7 +158,7 @@ process_register(const char *name, pid_t pid)
|
||||
struct process *p;
|
||||
const char *slash;
|
||||
|
||||
assert(sigchld_is_blocked());
|
||||
ovs_assert(sigchld_is_blocked());
|
||||
|
||||
p = xzalloc(sizeof *p);
|
||||
p->pid = pid;
|
||||
@ -308,7 +307,7 @@ process_exited(struct process *p)
|
||||
int
|
||||
process_status(const struct process *p)
|
||||
{
|
||||
assert(p->exited);
|
||||
ovs_assert(p->exited);
|
||||
return p->status;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "random.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
@ -59,7 +58,7 @@ random_init(void)
|
||||
void
|
||||
random_set_seed(uint32_t seed_)
|
||||
{
|
||||
assert(seed_);
|
||||
ovs_assert(seed_);
|
||||
seed = seed_;
|
||||
}
|
||||
|
||||
|
13
lib/rconn.c
13
lib/rconn.c
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "rconn.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
@ -293,7 +292,7 @@ void
|
||||
rconn_connect_unreliably(struct rconn *rc,
|
||||
struct vconn *vconn, const char *name)
|
||||
{
|
||||
assert(vconn != NULL);
|
||||
ovs_assert(vconn != NULL);
|
||||
rconn_disconnect(rc);
|
||||
rconn_set_target__(rc, vconn_get_name(vconn), name);
|
||||
rc->reliable = false;
|
||||
@ -469,7 +468,7 @@ run_ACTIVE(struct rconn *rc)
|
||||
rc->name, (unsigned int) (time_now() - base));
|
||||
|
||||
version = rconn_get_version(rc);
|
||||
assert(version >= 0 && version <= 0xff);
|
||||
ovs_assert(version >= 0 && version <= 0xff);
|
||||
|
||||
/* Ordering is important here: rconn_send() can transition to BACKOFF,
|
||||
* and we don't want to transition back to IDLE if so, because then we
|
||||
@ -864,7 +863,7 @@ void
|
||||
rconn_packet_counter_destroy(struct rconn_packet_counter *c)
|
||||
{
|
||||
if (c) {
|
||||
assert(c->ref_cnt > 0);
|
||||
ovs_assert(c->ref_cnt > 0);
|
||||
if (!--c->ref_cnt && !c->n_packets) {
|
||||
free(c);
|
||||
}
|
||||
@ -881,13 +880,13 @@ rconn_packet_counter_inc(struct rconn_packet_counter *c, unsigned int n_bytes)
|
||||
void
|
||||
rconn_packet_counter_dec(struct rconn_packet_counter *c, unsigned int n_bytes)
|
||||
{
|
||||
assert(c->n_packets > 0);
|
||||
assert(c->n_bytes >= n_bytes);
|
||||
ovs_assert(c->n_packets > 0);
|
||||
ovs_assert(c->n_bytes >= n_bytes);
|
||||
|
||||
c->n_bytes -= n_bytes;
|
||||
c->n_packets--;
|
||||
if (!c->n_packets) {
|
||||
assert(!c->n_bytes);
|
||||
ovs_assert(!c->n_bytes);
|
||||
if (!c->ref_cnt) {
|
||||
free(c);
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "reconnect.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "poll-loop.h"
|
||||
@ -503,7 +502,7 @@ reconnect_transition__(struct reconnect *fsm, long long int now,
|
||||
static long long int
|
||||
reconnect_deadline__(const struct reconnect *fsm)
|
||||
{
|
||||
assert(fsm->state_entered != LLONG_MIN);
|
||||
ovs_assert(fsm->state_entered != LLONG_MIN);
|
||||
switch (fsm->state) {
|
||||
case S_VOID:
|
||||
case S_LISTENING:
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "route-table.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
@ -161,8 +160,8 @@ void
|
||||
route_table_register(void)
|
||||
{
|
||||
if (!register_count) {
|
||||
assert(!nln);
|
||||
assert(!route_notifier);
|
||||
ovs_assert(!nln);
|
||||
ovs_assert(!route_notifier);
|
||||
|
||||
nln = nln_create(NETLINK_ROUTE, RTNLGRP_IPV4_ROUTE,
|
||||
(nln_parse_func *) route_table_parse, &rtmsg);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "shash.h"
|
||||
#include <assert.h>
|
||||
#include "hash.h"
|
||||
|
||||
static struct shash_node *shash_find__(const struct shash *,
|
||||
@ -145,7 +144,7 @@ void
|
||||
shash_add_assert(struct shash *sh, const char *name, const void *data)
|
||||
{
|
||||
bool added OVS_UNUSED = shash_add_once(sh, name, data);
|
||||
assert(added);
|
||||
ovs_assert(added);
|
||||
}
|
||||
|
||||
/* Searches for 'name' in 'sh'. If it does not already exist, adds it along
|
||||
@ -242,7 +241,7 @@ void *
|
||||
shash_find_and_delete_assert(struct shash *sh, const char *name)
|
||||
{
|
||||
void *data = shash_find_and_delete(sh, name);
|
||||
assert(data != NULL);
|
||||
ovs_assert(data != NULL);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -277,7 +276,7 @@ shash_sort(const struct shash *sh)
|
||||
SHASH_FOR_EACH (node, sh) {
|
||||
nodes[i++] = node;
|
||||
}
|
||||
assert(i == n);
|
||||
ovs_assert(i == n);
|
||||
|
||||
qsort(nodes, n, sizeof *nodes, compare_nodes_by_name);
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "signals.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
@ -82,7 +81,7 @@ signal_register(int signr)
|
||||
s->signr = signr;
|
||||
|
||||
/* Set up signal handler. */
|
||||
assert(signr >= 1 && signr < N_SIGNALS);
|
||||
ovs_assert(signr >= 1 && signr < N_SIGNALS);
|
||||
memset(&sa, 0, sizeof sa);
|
||||
sa.sa_handler = signal_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "simap.h"
|
||||
#include <assert.h>
|
||||
#include "hash.h"
|
||||
|
||||
static size_t hash_name(const char *, size_t length);
|
||||
@ -196,7 +195,7 @@ simap_sort(const struct simap *simap)
|
||||
SIMAP_FOR_EACH (node, simap) {
|
||||
nodes[i++] = node;
|
||||
}
|
||||
assert(i == n);
|
||||
ovs_assert(i == n);
|
||||
|
||||
qsort(nodes, n, sizeof *nodes, compare_nodes_by_name);
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include <config.h>
|
||||
#include "smap.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "hash.h"
|
||||
#include "json.h"
|
||||
|
||||
@ -251,7 +249,7 @@ smap_sort(const struct smap *smap)
|
||||
SMAP_FOR_EACH (node, smap) {
|
||||
nodes[i++] = node;
|
||||
}
|
||||
assert(i == n);
|
||||
ovs_assert(i == n);
|
||||
|
||||
qsort(nodes, n, sizeof *nodes, compare_nodes_by_key);
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "socket-util.h"
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
@ -1101,7 +1100,7 @@ send_iovec_and_fds(int sock,
|
||||
const struct iovec *iovs, size_t n_iovs,
|
||||
const int fds[], size_t n_fds)
|
||||
{
|
||||
assert(sock >= 0);
|
||||
ovs_assert(sock >= 0);
|
||||
if (n_fds > 0) {
|
||||
union {
|
||||
struct cmsghdr cm;
|
||||
@ -1109,8 +1108,8 @@ send_iovec_and_fds(int sock,
|
||||
} cmsg;
|
||||
struct msghdr msg;
|
||||
|
||||
assert(!iovec_is_empty(iovs, n_iovs));
|
||||
assert(n_fds <= SOUTIL_MAX_FDS);
|
||||
ovs_assert(!iovec_is_empty(iovs, n_iovs));
|
||||
ovs_assert(n_fds <= SOUTIL_MAX_FDS);
|
||||
|
||||
memset(&cmsg, 0, sizeof cmsg);
|
||||
cmsg.cm.cmsg_len = CMSG_LEN(n_fds * sizeof *fds);
|
||||
@ -1285,7 +1284,7 @@ recv_data_and_fds(int sock,
|
||||
size_t n_fds = (p->cmsg_len - CMSG_LEN(0)) / sizeof *fds;
|
||||
const int *fds_data = (const int *) CMSG_DATA(p);
|
||||
|
||||
assert(n_fds > 0);
|
||||
ovs_assert(n_fds > 0);
|
||||
if (n_fds > SOUTIL_MAX_FDS) {
|
||||
VLOG_ERR("%zu fds received but only %d supported",
|
||||
n_fds, SOUTIL_MAX_FDS);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Nicira, Inc.
|
||||
* Copyright (c) 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -18,8 +18,6 @@
|
||||
|
||||
#include "sset.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
static uint32_t
|
||||
@ -147,7 +145,7 @@ void
|
||||
sset_add_assert(struct sset *set, const char *name)
|
||||
{
|
||||
bool added OVS_UNUSED = sset_add(set, name);
|
||||
assert(added);
|
||||
ovs_assert(added);
|
||||
}
|
||||
|
||||
/* Adds a copy of each of the 'n' names in 'names' to 'set'. */
|
||||
@ -198,7 +196,7 @@ void
|
||||
sset_find_and_delete_assert(struct sset *set, const char *name)
|
||||
{
|
||||
bool deleted OVS_UNUSED = sset_find_and_delete(set, name);
|
||||
assert(deleted);
|
||||
ovs_assert(deleted);
|
||||
}
|
||||
|
||||
/* Removes a string from 'set' and returns a copy of it. The caller must free
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include "byte-order.h"
|
||||
@ -481,7 +480,7 @@ stp_check_and_reset_fdb_flush(struct stp *stp)
|
||||
struct stp_port *
|
||||
stp_get_port(struct stp *stp, int port_no)
|
||||
{
|
||||
assert(port_no >= 0 && port_no < ARRAY_SIZE(stp->ports));
|
||||
ovs_assert(port_no >= 0 && port_no < ARRAY_SIZE(stp->ports));
|
||||
return &stp->ports[port_no];
|
||||
}
|
||||
|
||||
@ -669,7 +668,7 @@ int
|
||||
stp_port_no(const struct stp_port *p)
|
||||
{
|
||||
struct stp *stp = p->stp;
|
||||
assert(p >= stp->ports && p < &stp->ports[ARRAY_SIZE(stp->ports)]);
|
||||
ovs_assert(p >= stp->ports && p < &stp->ports[ARRAY_SIZE(stp->ports)]);
|
||||
return p - stp->ports;
|
||||
}
|
||||
|
||||
@ -1228,7 +1227,7 @@ stp_hold_timer_expiry(struct stp_port *p)
|
||||
static void
|
||||
stp_initialize_port(struct stp_port *p, enum stp_state state)
|
||||
{
|
||||
assert(state & (STP_DISABLED | STP_BLOCKING));
|
||||
ovs_assert(state & (STP_DISABLED | STP_BLOCKING));
|
||||
stp_become_designated_port(p);
|
||||
stp_set_port_state(p, state);
|
||||
p->topology_change_ack = false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 Nicira, Inc.
|
||||
* Copyright (c) 2009, 2010, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -17,7 +17,6 @@
|
||||
#ifndef STREAM_PROVIDER_H
|
||||
#define STREAM_PROVIDER_H 1
|
||||
|
||||
#include <assert.h>
|
||||
#include <sys/types.h>
|
||||
#include "stream.h"
|
||||
|
||||
@ -46,7 +45,7 @@ void stream_set_local_port(struct stream *, ovs_be16 local_port);
|
||||
static inline void stream_assert_class(const struct stream *stream,
|
||||
const struct stream_class *class)
|
||||
{
|
||||
assert(stream->class == class);
|
||||
ovs_assert(stream->class == class);
|
||||
}
|
||||
|
||||
struct stream_class {
|
||||
@ -146,7 +145,7 @@ void pstream_init(struct pstream *, const struct pstream_class *, const char *na
|
||||
static inline void pstream_assert_class(const struct pstream *pstream,
|
||||
const struct pstream_class *class)
|
||||
{
|
||||
assert(pstream->class == class);
|
||||
ovs_assert(pstream->class == class);
|
||||
}
|
||||
|
||||
struct pstream_class {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <config.h>
|
||||
#include "stream-ssl.h"
|
||||
#include "dhparams.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
@ -599,7 +598,7 @@ ssl_recv(struct stream *stream, void *buffer, size_t n)
|
||||
ssize_t ret;
|
||||
|
||||
/* Behavior of zero-byte SSL_read is poorly defined. */
|
||||
assert(n > 0);
|
||||
ovs_assert(n > 0);
|
||||
|
||||
old_state = SSL_get_state(sslv->ssl);
|
||||
ret = SSL_read(sslv->ssl, buffer, n);
|
||||
@ -897,7 +896,7 @@ ssl_init(void)
|
||||
static int init_status = -1;
|
||||
if (init_status < 0) {
|
||||
init_status = do_ssl_init();
|
||||
assert(init_status >= 0);
|
||||
ovs_assert(init_status >= 0);
|
||||
}
|
||||
return init_status;
|
||||
}
|
||||
|
37
lib/stream.c
37
lib/stream.c
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "stream-provider.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
@ -74,14 +73,14 @@ check_stream_classes(void)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(stream_classes); i++) {
|
||||
const struct stream_class *class = stream_classes[i];
|
||||
assert(class->name != NULL);
|
||||
assert(class->open != NULL);
|
||||
ovs_assert(class->name != NULL);
|
||||
ovs_assert(class->open != NULL);
|
||||
if (class->close || class->recv || class->send || class->run
|
||||
|| class->run_wait || class->wait) {
|
||||
assert(class->close != NULL);
|
||||
assert(class->recv != NULL);
|
||||
assert(class->send != NULL);
|
||||
assert(class->wait != NULL);
|
||||
ovs_assert(class->close != NULL);
|
||||
ovs_assert(class->recv != NULL);
|
||||
ovs_assert(class->send != NULL);
|
||||
ovs_assert(class->wait != NULL);
|
||||
} else {
|
||||
/* This class delegates to another one. */
|
||||
}
|
||||
@ -89,12 +88,12 @@ check_stream_classes(void)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pstream_classes); i++) {
|
||||
const struct pstream_class *class = pstream_classes[i];
|
||||
assert(class->name != NULL);
|
||||
assert(class->listen != NULL);
|
||||
ovs_assert(class->name != NULL);
|
||||
ovs_assert(class->listen != NULL);
|
||||
if (class->close || class->accept || class->wait) {
|
||||
assert(class->close != NULL);
|
||||
assert(class->accept != NULL);
|
||||
assert(class->wait != NULL);
|
||||
ovs_assert(class->close != NULL);
|
||||
ovs_assert(class->accept != NULL);
|
||||
ovs_assert(class->wait != NULL);
|
||||
} else {
|
||||
/* This class delegates to another one. */
|
||||
}
|
||||
@ -250,7 +249,7 @@ stream_open_block(int error, struct stream **streamp)
|
||||
stream_connect_wait(stream);
|
||||
poll_block();
|
||||
}
|
||||
assert(error != EINPROGRESS);
|
||||
ovs_assert(error != EINPROGRESS);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
@ -317,7 +316,7 @@ static void
|
||||
scs_connecting(struct stream *stream)
|
||||
{
|
||||
int retval = (stream->class->connect)(stream);
|
||||
assert(retval != EINPROGRESS);
|
||||
ovs_assert(retval != EINPROGRESS);
|
||||
if (!retval) {
|
||||
stream->state = SCS_CONNECTED;
|
||||
} else if (retval != EAGAIN) {
|
||||
@ -419,8 +418,8 @@ stream_run_wait(struct stream *stream)
|
||||
void
|
||||
stream_wait(struct stream *stream, enum stream_wait_type wait)
|
||||
{
|
||||
assert(wait == STREAM_CONNECT || wait == STREAM_RECV
|
||||
|| wait == STREAM_SEND);
|
||||
ovs_assert(wait == STREAM_CONNECT || wait == STREAM_RECV
|
||||
|| wait == STREAM_SEND);
|
||||
|
||||
switch (stream->state) {
|
||||
case SCS_CONNECTING:
|
||||
@ -580,8 +579,8 @@ pstream_accept(struct pstream *pstream, struct stream **new_stream)
|
||||
if (retval) {
|
||||
*new_stream = NULL;
|
||||
} else {
|
||||
assert((*new_stream)->state != SCS_CONNECTING
|
||||
|| (*new_stream)->class->connect);
|
||||
ovs_assert((*new_stream)->state != SCS_CONNECTING
|
||||
|| (*new_stream)->class->connect);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -651,7 +650,7 @@ stream_init(struct stream *stream, const struct stream_class *class,
|
||||
: SCS_DISCONNECTED);
|
||||
stream->error = connect_status;
|
||||
stream->name = xstrdup(name);
|
||||
assert(stream->state != SCS_CONNECTING || class->connect);
|
||||
ovs_assert(stream->state != SCS_CONNECTING || class->connect);
|
||||
}
|
||||
|
||||
void
|
||||
|
17
lib/svec.c
17
lib/svec.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011 Nicira, Inc.
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "svec.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -141,7 +140,7 @@ svec_sort_unique(struct svec *svec)
|
||||
void
|
||||
svec_unique(struct svec *svec)
|
||||
{
|
||||
assert(svec_is_sorted(svec));
|
||||
ovs_assert(svec_is_sorted(svec));
|
||||
if (svec->n > 1) {
|
||||
/* This algorithm is lazy and sub-optimal, but it's "obviously correct"
|
||||
* and asymptotically optimal . */
|
||||
@ -179,8 +178,8 @@ svec_diff(const struct svec *a, const struct svec *b,
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
assert(svec_is_sorted(a));
|
||||
assert(svec_is_sorted(b));
|
||||
ovs_assert(svec_is_sorted(a));
|
||||
ovs_assert(svec_is_sorted(b));
|
||||
if (a_only) {
|
||||
svec_init(a_only);
|
||||
}
|
||||
@ -233,7 +232,7 @@ svec_find(const struct svec *svec, const char *name)
|
||||
{
|
||||
char **p;
|
||||
|
||||
assert(svec_is_sorted(svec));
|
||||
ovs_assert(svec_is_sorted(svec));
|
||||
p = bsearch(&name, svec->names, svec->n, sizeof *svec->names,
|
||||
compare_strings);
|
||||
return p ? p - svec->names : SIZE_MAX;
|
||||
@ -261,7 +260,7 @@ svec_is_unique(const struct svec *svec)
|
||||
const char *
|
||||
svec_get_duplicate(const struct svec *svec)
|
||||
{
|
||||
assert(svec_is_sorted(svec));
|
||||
ovs_assert(svec_is_sorted(svec));
|
||||
if (svec->n > 1) {
|
||||
size_t i;
|
||||
for (i = 1; i < svec->n; i++) {
|
||||
@ -375,13 +374,13 @@ svec_join(const struct svec *svec,
|
||||
const char *
|
||||
svec_back(const struct svec *svec)
|
||||
{
|
||||
assert(svec->n);
|
||||
ovs_assert(svec->n);
|
||||
return svec->names[svec->n - 1];
|
||||
}
|
||||
|
||||
void
|
||||
svec_pop_back(struct svec *svec)
|
||||
{
|
||||
assert(svec->n);
|
||||
ovs_assert(svec->n);
|
||||
free(svec->names[--svec->n]);
|
||||
}
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "table.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "dynamic-string.h"
|
||||
#include "json.h"
|
||||
#include "ovsdb-data.h"
|
||||
@ -143,7 +141,7 @@ table_add_column(struct table *table, const char *heading, ...)
|
||||
struct column *column;
|
||||
va_list args;
|
||||
|
||||
assert(!table->n_rows);
|
||||
ovs_assert(!table->n_rows);
|
||||
if (table->n_columns >= table->allocated_columns) {
|
||||
table->columns = x2nrealloc(table->columns, &table->allocated_columns,
|
||||
sizeof *table->columns);
|
||||
@ -204,8 +202,8 @@ table_add_cell(struct table *table)
|
||||
{
|
||||
size_t x, y;
|
||||
|
||||
assert(table->n_rows > 0);
|
||||
assert(table->current_column < table->n_columns);
|
||||
ovs_assert(table->n_rows > 0);
|
||||
ovs_assert(table->current_column < table->n_columns);
|
||||
|
||||
x = table->current_column++;
|
||||
y = table->n_rows - 1;
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "timeval.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#if HAVE_EXECINFO_H
|
||||
#include <execinfo.h>
|
||||
@ -731,7 +730,7 @@ backtrace_cb(struct unixctl_conn *conn,
|
||||
{
|
||||
struct ds ds = DS_EMPTY_INITIALIZER;
|
||||
|
||||
assert(HAVE_EXECINFO_H && CACHE_TIME);
|
||||
ovs_assert(HAVE_EXECINFO_H && CACHE_TIME);
|
||||
format_backtraces(&ds, 0);
|
||||
unixctl_command_reply(conn, ds_cstr(&ds));
|
||||
ds_destroy(&ds);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "unixctl.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "coverage.h"
|
||||
@ -110,7 +109,7 @@ unixctl_command_register(const char *name, const char *usage,
|
||||
struct unixctl_command *command;
|
||||
struct unixctl_command *lookup = shash_find_data(&commands, name);
|
||||
|
||||
assert(!lookup || lookup->cb == cb);
|
||||
ovs_assert(!lookup || lookup->cb == cb);
|
||||
|
||||
if (lookup) {
|
||||
return;
|
||||
@ -133,7 +132,7 @@ unixctl_command_reply__(struct unixctl_conn *conn,
|
||||
struct jsonrpc_msg *reply;
|
||||
|
||||
COVERAGE_INC(unixctl_replied);
|
||||
assert(conn->request_id);
|
||||
ovs_assert(conn->request_id);
|
||||
|
||||
if (!body) {
|
||||
body = "";
|
||||
|
@ -20,8 +20,8 @@
|
||||
/* Provider interface to vconns, which provide a virtual connection to an
|
||||
* OpenFlow device. */
|
||||
|
||||
#include <assert.h>
|
||||
#include "vconn.h"
|
||||
#include "util.h"
|
||||
#include "openflow/openflow-common.h"
|
||||
|
||||
/* Active virtual connection to an OpenFlow device. */
|
||||
@ -53,7 +53,7 @@ void vconn_set_local_port(struct vconn *, ovs_be16 local_port);
|
||||
static inline void vconn_assert_class(const struct vconn *vconn,
|
||||
const struct vconn_class *class)
|
||||
{
|
||||
assert(vconn->class == class);
|
||||
ovs_assert(vconn->class == class);
|
||||
}
|
||||
|
||||
struct vconn_class {
|
||||
@ -148,7 +148,7 @@ void pvconn_init(struct pvconn *pvconn, struct pvconn_class *class,
|
||||
static inline void pvconn_assert_class(const struct pvconn *pvconn,
|
||||
const struct pvconn_class *class)
|
||||
{
|
||||
assert(pvconn->class == class);
|
||||
ovs_assert(pvconn->class == class);
|
||||
}
|
||||
|
||||
struct pvconn_class {
|
||||
|
39
lib/vconn.c
39
lib/vconn.c
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "vconn-provider.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <netinet/in.h>
|
||||
@ -97,14 +96,14 @@ check_vconn_classes(void)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(vconn_classes); i++) {
|
||||
struct vconn_class *class = vconn_classes[i];
|
||||
assert(class->name != NULL);
|
||||
assert(class->open != NULL);
|
||||
ovs_assert(class->name != NULL);
|
||||
ovs_assert(class->open != NULL);
|
||||
if (class->close || class->recv || class->send
|
||||
|| class->run || class->run_wait || class->wait) {
|
||||
assert(class->close != NULL);
|
||||
assert(class->recv != NULL);
|
||||
assert(class->send != NULL);
|
||||
assert(class->wait != NULL);
|
||||
ovs_assert(class->close != NULL);
|
||||
ovs_assert(class->recv != NULL);
|
||||
ovs_assert(class->send != NULL);
|
||||
ovs_assert(class->wait != NULL);
|
||||
} else {
|
||||
/* This class delegates to another one. */
|
||||
}
|
||||
@ -112,12 +111,12 @@ check_vconn_classes(void)
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pvconn_classes); i++) {
|
||||
struct pvconn_class *class = pvconn_classes[i];
|
||||
assert(class->name != NULL);
|
||||
assert(class->listen != NULL);
|
||||
ovs_assert(class->name != NULL);
|
||||
ovs_assert(class->listen != NULL);
|
||||
if (class->close || class->accept || class->wait) {
|
||||
assert(class->close != NULL);
|
||||
assert(class->accept != NULL);
|
||||
assert(class->wait != NULL);
|
||||
ovs_assert(class->close != NULL);
|
||||
ovs_assert(class->accept != NULL);
|
||||
ovs_assert(class->wait != NULL);
|
||||
} else {
|
||||
/* This class delegates to another one. */
|
||||
}
|
||||
@ -253,7 +252,7 @@ vconn_open(const char *name, uint32_t allowed_versions, uint8_t dscp,
|
||||
}
|
||||
|
||||
/* Success. */
|
||||
assert(vconn->state != VCS_CONNECTING || vconn->class->connect);
|
||||
ovs_assert(vconn->state != VCS_CONNECTING || vconn->class->connect);
|
||||
*vconnp = vconn;
|
||||
return 0;
|
||||
|
||||
@ -399,7 +398,7 @@ static void
|
||||
vcs_connecting(struct vconn *vconn)
|
||||
{
|
||||
int retval = (vconn->class->connect)(vconn);
|
||||
assert(retval != EINPROGRESS);
|
||||
ovs_assert(retval != EINPROGRESS);
|
||||
if (!retval) {
|
||||
vconn->state = VCS_SEND_HELLO;
|
||||
} else if (retval != EAGAIN) {
|
||||
@ -664,7 +663,7 @@ do_send(struct vconn *vconn, struct ofpbuf *msg)
|
||||
{
|
||||
int retval;
|
||||
|
||||
assert(msg->size >= sizeof(struct ofp_header));
|
||||
ovs_assert(msg->size >= sizeof(struct ofp_header));
|
||||
|
||||
ofpmsg_update_length(msg);
|
||||
if (!VLOG_IS_DBG_ENABLED()) {
|
||||
@ -695,7 +694,7 @@ vconn_connect_block(struct vconn *vconn)
|
||||
vconn_connect_wait(vconn);
|
||||
poll_block();
|
||||
}
|
||||
assert(error != EINPROGRESS);
|
||||
ovs_assert(error != EINPROGRESS);
|
||||
|
||||
return error;
|
||||
}
|
||||
@ -892,7 +891,7 @@ vconn_transact_multiple_noreply(struct vconn *vconn, struct list *requests,
|
||||
void
|
||||
vconn_wait(struct vconn *vconn, enum vconn_wait_type wait)
|
||||
{
|
||||
assert(wait == WAIT_CONNECT || wait == WAIT_RECV || wait == WAIT_SEND);
|
||||
ovs_assert(wait == WAIT_CONNECT || wait == WAIT_RECV || wait == WAIT_SEND);
|
||||
|
||||
switch (vconn->state) {
|
||||
case VCS_CONNECTING:
|
||||
@ -1059,8 +1058,8 @@ pvconn_accept(struct pvconn *pvconn, struct vconn **new_vconn)
|
||||
if (retval) {
|
||||
*new_vconn = NULL;
|
||||
} else {
|
||||
assert((*new_vconn)->state != VCS_CONNECTING
|
||||
|| (*new_vconn)->class->connect);
|
||||
ovs_assert((*new_vconn)->state != VCS_CONNECTING
|
||||
|| (*new_vconn)->class->connect);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@ -1104,7 +1103,7 @@ vconn_init(struct vconn *vconn, struct vconn_class *class, int connect_status,
|
||||
vconn->local_ip = 0;
|
||||
vconn->local_port = 0;
|
||||
vconn->name = xstrdup(name);
|
||||
assert(vconn->state != VCS_CONNECTING || class->connect);
|
||||
ovs_assert(vconn->state != VCS_CONNECTING || class->connect);
|
||||
}
|
||||
|
||||
void
|
||||
|
107
lib/vlog.c
107
lib/vlog.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -28,7 +28,6 @@
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include "coverage.h"
|
||||
#include "dirs.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "ofpbuf.h"
|
||||
@ -41,8 +40,6 @@
|
||||
|
||||
VLOG_DEFINE_THIS_MODULE(vlog);
|
||||
|
||||
COVERAGE_DEFINE(vlog_recursive);
|
||||
|
||||
/* Name for each logging level. */
|
||||
static const char *level_names[VLL_N_LEVELS] = {
|
||||
#define VLOG_LEVEL(NAME, SYSLOG_LEVEL) #NAME,
|
||||
@ -483,55 +480,6 @@ vlog_unixctl_reopen(struct unixctl_conn *conn, int argc OVS_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_all_rate_limits(bool enable)
|
||||
{
|
||||
struct vlog_module **mp;
|
||||
|
||||
for (mp = vlog_modules; mp < &vlog_modules[n_vlog_modules]; mp++) {
|
||||
(*mp)->honor_rate_limits = enable;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_rate_limits(struct unixctl_conn *conn, int argc,
|
||||
const char *argv[], bool enable)
|
||||
{
|
||||
if (argc > 1) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcasecmp(argv[i], "ANY")) {
|
||||
set_all_rate_limits(enable);
|
||||
} else {
|
||||
struct vlog_module *module = vlog_module_from_name(argv[i]);
|
||||
if (!module) {
|
||||
unixctl_command_reply_error(conn, "unknown module");
|
||||
return;
|
||||
}
|
||||
module->honor_rate_limits = enable;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set_all_rate_limits(enable);
|
||||
}
|
||||
unixctl_command_reply(conn, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
vlog_enable_rate_limit(struct unixctl_conn *conn, int argc,
|
||||
const char *argv[], void *aux OVS_UNUSED)
|
||||
{
|
||||
set_rate_limits(conn, argc, argv, true);
|
||||
}
|
||||
|
||||
static void
|
||||
vlog_disable_rate_limit(struct unixctl_conn *conn, int argc,
|
||||
const char *argv[], void *aux OVS_UNUSED)
|
||||
{
|
||||
set_rate_limits(conn, argc, argv, false);
|
||||
}
|
||||
|
||||
/* Initializes the logging subsystem and registers its unixctl server
|
||||
* commands. */
|
||||
void
|
||||
@ -567,10 +515,6 @@ vlog_init(void)
|
||||
"vlog/set", "{spec | PATTERN:facility:pattern}",
|
||||
1, INT_MAX, vlog_unixctl_set, NULL);
|
||||
unixctl_command_register("vlog/list", "", 0, 0, vlog_unixctl_list, NULL);
|
||||
unixctl_command_register("vlog/enable-rate-limit", "[module]...",
|
||||
0, INT_MAX, vlog_enable_rate_limit, NULL);
|
||||
unixctl_command_register("vlog/disable-rate-limit", "[module]...",
|
||||
0, INT_MAX, vlog_disable_rate_limit, NULL);
|
||||
unixctl_command_register("vlog/reopen", "", 0, 0,
|
||||
vlog_unixctl_reopen, NULL);
|
||||
}
|
||||
@ -599,20 +543,12 @@ vlog_get_levels(void)
|
||||
ds_put_format(&s, " ------- ------ ------\n");
|
||||
|
||||
for (mp = vlog_modules; mp < &vlog_modules[n_vlog_modules]; mp++) {
|
||||
struct ds line;
|
||||
|
||||
ds_init(&line);
|
||||
ds_put_format(&line, "%-16s %4s %4s %4s",
|
||||
vlog_get_module_name(*mp),
|
||||
vlog_get_level_name(vlog_get_level(*mp, VLF_CONSOLE)),
|
||||
vlog_get_level_name(vlog_get_level(*mp, VLF_SYSLOG)),
|
||||
vlog_get_level_name(vlog_get_level(*mp, VLF_FILE)));
|
||||
if (!(*mp)->honor_rate_limits) {
|
||||
ds_put_cstr(&line, " (rate limiting disabled)");
|
||||
}
|
||||
ds_put_char(&line, '\n');
|
||||
|
||||
svec_add_nocopy(&lines, ds_steal_cstr(&line));
|
||||
line = xasprintf("%-16s %4s %4s %4s\n",
|
||||
vlog_get_module_name(*mp),
|
||||
vlog_get_level_name(vlog_get_level(*mp, VLF_CONSOLE)),
|
||||
vlog_get_level_name(vlog_get_level(*mp, VLF_SYSLOG)),
|
||||
vlog_get_level_name(vlog_get_level(*mp, VLF_FILE)));
|
||||
svec_add_nocopy(&lines, line);
|
||||
}
|
||||
|
||||
svec_sort(&lines);
|
||||
@ -890,10 +826,6 @@ bool
|
||||
vlog_should_drop(const struct vlog_module *module, enum vlog_level level,
|
||||
struct vlog_rate_limit *rl)
|
||||
{
|
||||
if (!module->honor_rate_limits) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vlog_is_enabled(module, level)) {
|
||||
return true;
|
||||
}
|
||||
@ -955,26 +887,13 @@ static void
|
||||
vlog_write_file(struct ds *s)
|
||||
{
|
||||
if (worker_is_running()) {
|
||||
static bool in_worker_request = false;
|
||||
if (!in_worker_request) {
|
||||
in_worker_request = true;
|
||||
|
||||
worker_request(s->string, s->length,
|
||||
&log_fd, vlog_async_inited ? 0 : 1,
|
||||
vlog_async_write_request_cb, NULL, NULL);
|
||||
vlog_async_inited = true;
|
||||
|
||||
in_worker_request = false;
|
||||
return;
|
||||
} else {
|
||||
/* We've been entered recursively. This can happen if
|
||||
* worker_request(), or a function that it calls, tries to log
|
||||
* something. We can't call worker_request() recursively, so fall
|
||||
* back to writing the log file directly. */
|
||||
COVERAGE_INC(vlog_recursive);
|
||||
}
|
||||
worker_request(s->string, s->length,
|
||||
&log_fd, vlog_async_inited ? 0 : 1,
|
||||
vlog_async_write_request_cb, NULL, NULL);
|
||||
vlog_async_inited = true;
|
||||
} else {
|
||||
ignore(write(log_fd, s->string, s->length));
|
||||
}
|
||||
ignore(write(log_fd, s->string, s->length));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1290,8 +1290,8 @@ ofconn_receives_async_msg(const struct ofconn *ofconn,
|
||||
{
|
||||
const uint32_t *async_config;
|
||||
|
||||
assert(reason < 32);
|
||||
assert((unsigned int) type < OAM_N_TYPES);
|
||||
ovs_assert(reason < 32);
|
||||
ovs_assert((unsigned int) type < OAM_N_TYPES);
|
||||
|
||||
if (ofconn_get_protocol(ofconn) == OFPUTIL_P_NONE
|
||||
|| !rconn_is_connected(ofconn->rconn)) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "ofproto-dpif-governor.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "coverage.h"
|
||||
@ -121,7 +120,7 @@ governor_should_install_flow(struct governor *g, uint32_t hash, int n)
|
||||
bool install_flow;
|
||||
uint8_t *e;
|
||||
|
||||
assert(n > 0);
|
||||
ovs_assert(n > 0);
|
||||
|
||||
/* Count these packets and begin a new generation if necessary. */
|
||||
g->n_packets += n;
|
||||
@ -177,8 +176,8 @@ governor_should_install_flow(struct governor *g, uint32_t hash, int n)
|
||||
static void
|
||||
governor_new_generation(struct governor *g, unsigned int size)
|
||||
{
|
||||
assert(size >= MIN_SIZE && size <= MAX_SIZE);
|
||||
assert(is_pow2(size));
|
||||
ovs_assert(size >= MIN_SIZE && size <= MAX_SIZE);
|
||||
ovs_assert(is_pow2(size));
|
||||
|
||||
/* Allocate new table, if necessary. */
|
||||
if (g->size != size) {
|
||||
|
@ -565,7 +565,7 @@ static uint16_t odp_port_to_ofp_port(const struct ofproto_dpif *,
|
||||
static struct ofport_dpif *
|
||||
ofport_dpif_cast(const struct ofport *ofport)
|
||||
{
|
||||
assert(ofport->ofproto->ofproto_class == &ofproto_dpif_class);
|
||||
ovs_assert(ofport->ofproto->ofproto_class == &ofproto_dpif_class);
|
||||
return ofport ? CONTAINER_OF(ofport, struct ofport_dpif, up) : NULL;
|
||||
}
|
||||
|
||||
@ -691,7 +691,7 @@ static void ofproto_dpif_unixctl_init(void);
|
||||
static struct ofproto_dpif *
|
||||
ofproto_dpif_cast(const struct ofproto *ofproto)
|
||||
{
|
||||
assert(ofproto->ofproto_class == &ofproto_dpif_class);
|
||||
ovs_assert(ofproto->ofproto_class == &ofproto_dpif_class);
|
||||
return CONTAINER_OF(ofproto, struct ofproto_dpif, up);
|
||||
}
|
||||
|
||||
@ -950,7 +950,7 @@ close_dpif_backer(struct dpif_backer *backer)
|
||||
{
|
||||
struct shash_node *node;
|
||||
|
||||
assert(backer->refcount > 0);
|
||||
ovs_assert(backer->refcount > 0);
|
||||
|
||||
if (--backer->refcount) {
|
||||
return;
|
||||
@ -1181,7 +1181,7 @@ add_internal_flow(struct ofproto_dpif *ofproto, int id,
|
||||
}
|
||||
|
||||
*rulep = rule_dpif_lookup__(ofproto, &fm.match.flow, TBL_INTERNAL);
|
||||
assert(*rulep != NULL);
|
||||
ovs_assert(*rulep != NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2227,8 +2227,8 @@ bundle_set(struct ofproto *ofproto_, void *aux,
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(s->n_slaves == 1 || s->bond != NULL);
|
||||
assert((s->lacp != NULL) == (s->lacp_slaves != NULL));
|
||||
ovs_assert(s->n_slaves == 1 || s->bond != NULL);
|
||||
ovs_assert((s->lacp != NULL) == (s->lacp_slaves != NULL));
|
||||
|
||||
bundle = bundle_lookup(ofproto, aux);
|
||||
if (!bundle) {
|
||||
@ -2295,7 +2295,7 @@ bundle_set(struct ofproto *ofproto_, void *aux,
|
||||
found: ;
|
||||
}
|
||||
}
|
||||
assert(list_size(&bundle->ports) <= s->n_slaves);
|
||||
ovs_assert(list_size(&bundle->ports) <= s->n_slaves);
|
||||
|
||||
if (list_is_empty(&bundle->ports)) {
|
||||
bundle_destroy(bundle);
|
||||
@ -3564,7 +3564,7 @@ handle_miss_upcalls(struct dpif_backer *backer, struct dpif_upcall *upcalls,
|
||||
HMAP_FOR_EACH (miss, hmap_node, &todo) {
|
||||
handle_flow_miss(miss, flow_miss_ops, &n_ops);
|
||||
}
|
||||
assert(n_ops <= ARRAY_SIZE(flow_miss_ops));
|
||||
ovs_assert(n_ops <= ARRAY_SIZE(flow_miss_ops));
|
||||
|
||||
/* Execute batch. */
|
||||
for (i = 0; i < n_ops; i++) {
|
||||
@ -3660,7 +3660,7 @@ handle_upcalls(struct dpif_backer *backer, unsigned int max_batch)
|
||||
int n_misses;
|
||||
int i;
|
||||
|
||||
assert(max_batch <= FLOW_MISS_MAX_BATCH);
|
||||
ovs_assert(max_batch <= FLOW_MISS_MAX_BATCH);
|
||||
|
||||
n_misses = 0;
|
||||
for (n_processed = 0; n_processed < max_batch; n_processed++) {
|
||||
@ -4125,7 +4125,7 @@ facet_remove(struct facet *facet)
|
||||
struct ofproto_dpif *ofproto = ofproto_dpif_cast(facet->rule->up.ofproto);
|
||||
struct subfacet *subfacet, *next_subfacet;
|
||||
|
||||
assert(!list_is_empty(&facet->subfacets));
|
||||
ovs_assert(!list_is_empty(&facet->subfacets));
|
||||
|
||||
/* First uninstall all of the subfacets to get final statistics. */
|
||||
LIST_FOR_EACH (subfacet, list_node, &facet->subfacets) {
|
||||
@ -4255,8 +4255,8 @@ facet_flush_stats(struct facet *facet)
|
||||
struct subfacet *subfacet;
|
||||
|
||||
LIST_FOR_EACH (subfacet, list_node, &facet->subfacets) {
|
||||
assert(!subfacet->dp_byte_count);
|
||||
assert(!subfacet->dp_packet_count);
|
||||
ovs_assert(!subfacet->dp_byte_count);
|
||||
ovs_assert(!subfacet->dp_packet_count);
|
||||
}
|
||||
|
||||
facet_push_stats(facet);
|
||||
@ -4613,9 +4613,9 @@ facet_push_stats(struct facet *facet)
|
||||
{
|
||||
struct dpif_flow_stats stats;
|
||||
|
||||
assert(facet->packet_count >= facet->prev_packet_count);
|
||||
assert(facet->byte_count >= facet->prev_byte_count);
|
||||
assert(facet->used >= facet->prev_used);
|
||||
ovs_assert(facet->packet_count >= facet->prev_packet_count);
|
||||
ovs_assert(facet->byte_count >= facet->prev_byte_count);
|
||||
ovs_assert(facet->used >= facet->prev_used);
|
||||
|
||||
stats.n_packets = facet->packet_count - facet->prev_packet_count;
|
||||
stats.n_bytes = facet->byte_count - facet->prev_byte_count;
|
||||
@ -4932,8 +4932,8 @@ subfacet_uninstall(struct subfacet *subfacet)
|
||||
}
|
||||
subfacet->path = SF_NOT_INSTALLED;
|
||||
} else {
|
||||
assert(subfacet->dp_packet_count == 0);
|
||||
assert(subfacet->dp_byte_count == 0);
|
||||
ovs_assert(subfacet->dp_packet_count == 0);
|
||||
ovs_assert(subfacet->dp_byte_count == 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5386,7 +5386,7 @@ fix_sflow_action(struct action_xlate_ctx *ctx)
|
||||
|
||||
cookie = ofpbuf_at(ctx->odp_actions, ctx->user_cookie_offset,
|
||||
sizeof(*cookie));
|
||||
assert(cookie->type == USER_ACTION_COOKIE_SFLOW);
|
||||
ovs_assert(cookie->type == USER_ACTION_COOKIE_SFLOW);
|
||||
|
||||
compose_sflow_cookie(ctx->ofproto, base->vlan_tci,
|
||||
ctx->sflow_odp_port, ctx->sflow_n_outputs, cookie);
|
||||
@ -5580,8 +5580,8 @@ execute_controller_action(struct action_xlate_ctx *ctx, int len,
|
||||
/* If the Ethernet type is less than ETH_TYPE_MIN, it's likely an 802.2
|
||||
* LLC frame. Calculating the Ethernet type of these frames is more
|
||||
* trouble than seems appropriate for a simple assertion. */
|
||||
assert(ntohs(eh->eth_type) < ETH_TYPE_MIN
|
||||
|| eh->eth_type == ctx->flow.dl_type);
|
||||
ovs_assert(ntohs(eh->eth_type) < ETH_TYPE_MIN
|
||||
|| eh->eth_type == ctx->flow.dl_type);
|
||||
|
||||
memcpy(eh->eth_src, ctx->flow.dl_src, sizeof eh->eth_src);
|
||||
memcpy(eh->eth_dst, ctx->flow.dl_dst, sizeof eh->eth_dst);
|
||||
@ -6069,7 +6069,7 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
|
||||
/* XXX remove recursion */
|
||||
/* It is assumed that goto-table is last action */
|
||||
struct ofpact_goto_table *ogt = ofpact_get_GOTO_TABLE(a);
|
||||
assert(ctx->table_id < ogt->table_id);
|
||||
ovs_assert(ctx->table_id < ogt->table_id);
|
||||
xlate_table_action(ctx, ctx->flow.in_port, ogt->table_id, true);
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
* Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
|
||||
* Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -446,12 +446,12 @@ ofproto_create(const char *datapath_name, const char *datapath_type,
|
||||
bitmap_set1(ofproto->ofp_port_ids, 0);
|
||||
|
||||
/* Check that hidden tables, if any, are at the end. */
|
||||
assert(ofproto->n_tables);
|
||||
ovs_assert(ofproto->n_tables);
|
||||
for (i = 0; i + 1 < ofproto->n_tables; i++) {
|
||||
enum oftable_flags flags = ofproto->tables[i].flags;
|
||||
enum oftable_flags next_flags = ofproto->tables[i + 1].flags;
|
||||
|
||||
assert(!(flags & OFTABLE_HIDDEN) || next_flags & OFTABLE_HIDDEN);
|
||||
ovs_assert(!(flags & OFTABLE_HIDDEN) || next_flags & OFTABLE_HIDDEN);
|
||||
}
|
||||
|
||||
ofproto->datapath_id = pick_datapath_id(ofproto);
|
||||
@ -469,8 +469,8 @@ ofproto_init_tables(struct ofproto *ofproto, int n_tables)
|
||||
{
|
||||
struct oftable *table;
|
||||
|
||||
assert(!ofproto->n_tables);
|
||||
assert(n_tables >= 1 && n_tables <= 255);
|
||||
ovs_assert(!ofproto->n_tables);
|
||||
ovs_assert(n_tables >= 1 && n_tables <= 255);
|
||||
|
||||
ofproto->n_tables = n_tables;
|
||||
ofproto->tables = xmalloc(n_tables * sizeof *ofproto->tables);
|
||||
@ -493,7 +493,7 @@ ofproto_init_tables(struct ofproto *ofproto, int n_tables)
|
||||
void
|
||||
ofproto_init_max_ports(struct ofproto *ofproto, uint16_t max_ports)
|
||||
{
|
||||
assert(max_ports <= OFPP_MAX);
|
||||
ovs_assert(max_ports <= OFPP_MAX);
|
||||
ofproto->max_ports = max_ports;
|
||||
}
|
||||
|
||||
@ -910,7 +910,7 @@ ofproto_configure_table(struct ofproto *ofproto, int table_id,
|
||||
{
|
||||
struct oftable *table;
|
||||
|
||||
assert(table_id >= 0 && table_id < ofproto->n_tables);
|
||||
ovs_assert(table_id >= 0 && table_id < ofproto->n_tables);
|
||||
table = &ofproto->tables[table_id];
|
||||
|
||||
oftable_set_name(table, s->name);
|
||||
@ -992,8 +992,8 @@ ofproto_destroy__(struct ofproto *ofproto)
|
||||
{
|
||||
struct oftable *table;
|
||||
|
||||
assert(list_is_empty(&ofproto->pending));
|
||||
assert(!ofproto->n_pending);
|
||||
ovs_assert(list_is_empty(&ofproto->pending));
|
||||
ovs_assert(!ofproto->n_pending);
|
||||
|
||||
connmgr_destroy(ofproto->connmgr);
|
||||
|
||||
@ -2072,7 +2072,7 @@ ofproto_rule_destroy__(struct rule *rule)
|
||||
void
|
||||
ofproto_rule_destroy(struct rule *rule)
|
||||
{
|
||||
assert(!rule->pending);
|
||||
ovs_assert(!rule->pending);
|
||||
oftable_remove_rule(rule);
|
||||
ofproto_rule_destroy__(rule);
|
||||
}
|
||||
@ -2122,7 +2122,7 @@ rule_execute(struct rule *rule, uint16_t in_port, struct ofpbuf *packet)
|
||||
{
|
||||
struct flow flow;
|
||||
|
||||
assert(ofpbuf_headroom(packet) >= sizeof(struct ofp10_packet_in));
|
||||
ovs_assert(ofpbuf_headroom(packet) >= sizeof(struct ofp10_packet_in));
|
||||
|
||||
flow_extract(packet, 0, 0, NULL, in_port, &flow);
|
||||
return rule->ofproto->ofproto_class->rule_execute(rule, &flow, packet);
|
||||
@ -2171,7 +2171,7 @@ handle_features_request(struct ofconn *ofconn, const struct ofp_header *oh)
|
||||
|
||||
ofproto->ofproto_class->get_features(ofproto, &arp_match_ip,
|
||||
&features.actions);
|
||||
assert(features.actions & OFPUTIL_A_OUTPUT); /* sanity check */
|
||||
ovs_assert(features.actions & OFPUTIL_A_OUTPUT); /* sanity check */
|
||||
|
||||
/* Count only non-hidden tables in the number of tables. (Hidden tables,
|
||||
* if present, are always at the end.) */
|
||||
@ -2239,7 +2239,7 @@ handle_set_config(struct ofconn *ofconn, const struct ofp_header *oh)
|
||||
enum ofp_config_flags cur = ofproto->frag_handling;
|
||||
enum ofp_config_flags next = flags & OFPC_FRAG_MASK;
|
||||
|
||||
assert((cur & OFPC_FRAG_MASK) == cur);
|
||||
ovs_assert((cur & OFPC_FRAG_MASK) == cur);
|
||||
if (cur != next) {
|
||||
if (ofproto->ofproto_class->set_frag_handling(ofproto, next)) {
|
||||
ofproto->frag_handling = next;
|
||||
@ -3111,7 +3111,7 @@ add_flow(struct ofproto *ofproto, struct ofconn *ofconn,
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
assert(table_id < ofproto->n_tables);
|
||||
ovs_assert(table_id < ofproto->n_tables);
|
||||
table = &ofproto->tables[table_id];
|
||||
} else {
|
||||
table = &ofproto->tables[0];
|
||||
@ -3469,7 +3469,7 @@ ofproto_rule_expire(struct rule *rule, uint8_t reason)
|
||||
struct ofproto *ofproto = rule->ofproto;
|
||||
struct ofopgroup *group;
|
||||
|
||||
assert(reason == OFPRR_HARD_TIMEOUT || reason == OFPRR_IDLE_TIMEOUT);
|
||||
ovs_assert(reason == OFPRR_HARD_TIMEOUT || reason == OFPRR_IDLE_TIMEOUT);
|
||||
|
||||
ofproto_rule_send_removed(rule, reason);
|
||||
|
||||
@ -3547,7 +3547,7 @@ handle_flow_mod__(struct ofproto *ofproto, struct ofconn *ofconn,
|
||||
const struct ofp_header *oh)
|
||||
{
|
||||
if (ofproto->n_pending >= 50) {
|
||||
assert(!list_is_empty(&ofproto->pending));
|
||||
ovs_assert(!list_is_empty(&ofproto->pending));
|
||||
return OFPROTO_POSTPONE;
|
||||
}
|
||||
|
||||
@ -3866,7 +3866,7 @@ ofproto_collect_ofmonitor_refresh_rules(const struct ofmonitor *m,
|
||||
|
||||
cls_cursor_init(&cursor, &table->cls, &target);
|
||||
CLS_CURSOR_FOR_EACH (rule, cr, &cursor) {
|
||||
assert(!rule->pending); /* XXX */
|
||||
ovs_assert(!rule->pending); /* XXX */
|
||||
ofproto_collect_ofmonitor_refresh_rule(m, rule, seqno, rules);
|
||||
}
|
||||
}
|
||||
@ -4172,7 +4172,7 @@ ofopgroup_create(struct ofproto *ofproto, struct ofconn *ofconn,
|
||||
if (ofconn) {
|
||||
size_t request_len = ntohs(request->length);
|
||||
|
||||
assert(ofconn_get_ofproto(ofconn) == ofproto);
|
||||
ovs_assert(ofconn_get_ofproto(ofconn) == ofproto);
|
||||
|
||||
ofconn_add_opgroup(ofconn, &group->ofconn_node);
|
||||
group->ofconn = ofconn;
|
||||
@ -4210,7 +4210,7 @@ ofopgroup_complete(struct ofopgroup *group)
|
||||
struct ofoperation *op, *next_op;
|
||||
int error;
|
||||
|
||||
assert(!group->n_running);
|
||||
ovs_assert(!group->n_running);
|
||||
|
||||
error = 0;
|
||||
LIST_FOR_EACH (op, group_node, &group->ops) {
|
||||
@ -4229,7 +4229,7 @@ ofopgroup_complete(struct ofopgroup *group)
|
||||
error = ofconn_pktbuf_retrieve(group->ofconn, group->buffer_id,
|
||||
&packet, &in_port);
|
||||
if (packet) {
|
||||
assert(!error);
|
||||
ovs_assert(!error);
|
||||
error = rule_execute(op->rule, in_port, packet);
|
||||
}
|
||||
break;
|
||||
@ -4289,7 +4289,7 @@ ofopgroup_complete(struct ofopgroup *group)
|
||||
break;
|
||||
|
||||
case OFOPERATION_DELETE:
|
||||
assert(!op->error);
|
||||
ovs_assert(!op->error);
|
||||
ofproto_rule_destroy__(rule);
|
||||
op->rule = NULL;
|
||||
break;
|
||||
@ -4319,7 +4319,7 @@ ofopgroup_complete(struct ofopgroup *group)
|
||||
ofmonitor_flush(ofproto->connmgr);
|
||||
|
||||
if (!list_is_empty(&group->ofproto_node)) {
|
||||
assert(ofproto->n_pending > 0);
|
||||
ovs_assert(ofproto->n_pending > 0);
|
||||
ofproto->n_pending--;
|
||||
list_remove(&group->ofproto_node);
|
||||
}
|
||||
@ -4350,7 +4350,7 @@ ofoperation_create(struct ofopgroup *group, struct rule *rule,
|
||||
struct ofproto *ofproto = group->ofproto;
|
||||
struct ofoperation *op;
|
||||
|
||||
assert(!rule->pending);
|
||||
ovs_assert(!rule->pending);
|
||||
|
||||
op = rule->pending = xzalloc(sizeof *op);
|
||||
op->group = group;
|
||||
@ -4420,9 +4420,9 @@ ofoperation_complete(struct ofoperation *op, enum ofperr error)
|
||||
{
|
||||
struct ofopgroup *group = op->group;
|
||||
|
||||
assert(op->rule->pending == op);
|
||||
assert(group->n_running > 0);
|
||||
assert(!error || op->type != OFOPERATION_DELETE);
|
||||
ovs_assert(op->rule->pending == op);
|
||||
ovs_assert(group->n_running > 0);
|
||||
ovs_assert(!error || op->type != OFOPERATION_DELETE);
|
||||
|
||||
op->error = error;
|
||||
if (!--group->n_running && !list_is_empty(&group->ofproto_node)) {
|
||||
@ -4433,7 +4433,7 @@ ofoperation_complete(struct ofoperation *op, enum ofperr error)
|
||||
struct rule *
|
||||
ofoperation_get_victim(struct ofoperation *op)
|
||||
{
|
||||
assert(op->type == OFOPERATION_ADD);
|
||||
ovs_assert(op->type == OFOPERATION_ADD);
|
||||
return op->victim;
|
||||
}
|
||||
|
||||
@ -4733,7 +4733,7 @@ oftable_init(struct oftable *table)
|
||||
static void
|
||||
oftable_destroy(struct oftable *table)
|
||||
{
|
||||
assert(classifier_is_empty(&table->cls));
|
||||
ovs_assert(classifier_is_empty(&table->cls));
|
||||
oftable_disable_eviction(table);
|
||||
classifier_destroy(&table->cls);
|
||||
free(table->name);
|
||||
@ -4960,7 +4960,7 @@ ofproto_port_set_realdev(struct ofproto *ofproto, uint16_t vlandev_ofp_port,
|
||||
struct ofport *ofport;
|
||||
int error;
|
||||
|
||||
assert(vlandev_ofp_port != realdev_ofp_port);
|
||||
ovs_assert(vlandev_ofp_port != realdev_ofp_port);
|
||||
|
||||
ofport = ofproto_get_port(ofproto, vlandev_ofp_port);
|
||||
if (!ofport) {
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "column.h"
|
||||
@ -154,7 +153,7 @@ ovsdb_execute(struct ovsdb *db, const struct ovsdb_session *session,
|
||||
op_name);
|
||||
}
|
||||
} else {
|
||||
assert(ovsdb_parser_has_error(&parser));
|
||||
ovs_assert(ovsdb_parser_has_error(&parser));
|
||||
}
|
||||
|
||||
/* A parse error overrides any other error.
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "file.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@ -129,7 +128,7 @@ ovsdb_file_open_log(const char *file_name, enum ovsdb_log_open_mode open_mode,
|
||||
struct ovsdb_error *error;
|
||||
struct json *json = NULL;
|
||||
|
||||
assert(logp || schemap);
|
||||
ovs_assert(logp || schemap);
|
||||
|
||||
error = ovsdb_log_open(file_name, open_mode, -1, &log);
|
||||
if (error) {
|
||||
@ -194,7 +193,7 @@ ovsdb_file_open__(const char *file_name,
|
||||
struct ovsdb *db = NULL;
|
||||
|
||||
/* In read-only mode there is no ovsdb_file so 'filep' must be null. */
|
||||
assert(!(read_only && filep));
|
||||
ovs_assert(!(read_only && filep));
|
||||
|
||||
open_mode = read_only ? OVSDB_LOG_READ_ONLY : OVSDB_LOG_READ_WRITE;
|
||||
error = ovsdb_file_open_log(file_name, open_mode, &log,
|
||||
@ -504,7 +503,7 @@ ovsdb_file_save_copy(const char *file_name, int locking,
|
||||
struct ovsdb_error *
|
||||
ovsdb_file_read_schema(const char *file_name, struct ovsdb_schema **schemap)
|
||||
{
|
||||
assert(schemap != NULL);
|
||||
ovs_assert(schemap != NULL);
|
||||
return ovsdb_file_open_log(file_name, OVSDB_LOG_READ_ONLY, NULL, schemap);
|
||||
}
|
||||
|
||||
@ -562,7 +561,7 @@ ovsdb_file_create(struct ovsdb *db, struct ovsdb_log *log,
|
||||
static struct ovsdb_file *
|
||||
ovsdb_file_cast(struct ovsdb_replica *replica)
|
||||
{
|
||||
assert(replica->class == &ovsdb_file_class);
|
||||
ovs_assert(replica->class == &ovsdb_file_class);
|
||||
return CONTAINER_OF(replica, struct ovsdb_file, replica);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "jsonrpc-server.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "bitmap.h"
|
||||
@ -1292,7 +1291,7 @@ ovsdb_jsonrpc_monitor_remove_all(struct ovsdb_jsonrpc_session *s)
|
||||
static struct ovsdb_jsonrpc_monitor *
|
||||
ovsdb_jsonrpc_monitor_cast(struct ovsdb_replica *replica)
|
||||
{
|
||||
assert(replica->class == &ovsdb_jsonrpc_replica_class);
|
||||
ovs_assert(replica->class == &ovsdb_jsonrpc_replica_class);
|
||||
return CONTAINER_OF(replica, struct ovsdb_jsonrpc_monitor, replica);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
@ -75,7 +74,7 @@ ovsdb_log_open(const char *name, enum ovsdb_log_open_mode open_mode,
|
||||
|
||||
*filep = NULL;
|
||||
|
||||
assert(locking == -1 || locking == false || locking == true);
|
||||
ovs_assert(locking == -1 || locking == false || locking == true);
|
||||
if (locking < 0) {
|
||||
locking = open_mode != OVSDB_LOG_READ_ONLY;
|
||||
}
|
||||
@ -318,7 +317,7 @@ error:
|
||||
void
|
||||
ovsdb_log_unread(struct ovsdb_log *file)
|
||||
{
|
||||
assert(file->mode == OVSDB_LOG_READ);
|
||||
ovs_assert(file->mode == OVSDB_LOG_READ);
|
||||
file->offset = file->prev_offset;
|
||||
}
|
||||
|
||||
|
@ -185,10 +185,10 @@ def printCIDLSource(schemaFile):
|
||||
|
||||
#include <config.h>
|
||||
#include %s
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include "ovsdb-data.h"
|
||||
#include "ovsdb-error.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef __CHECKER__
|
||||
/* Sparse dislikes sizeof(bool) ("warning: expression using sizeof bool"). */
|
||||
@ -236,7 +236,7 @@ static void
|
||||
if type.is_smap():
|
||||
print " size_t i;"
|
||||
print
|
||||
print " assert(inited);"
|
||||
print " ovs_assert(inited);"
|
||||
print " smap_init(&row->%s);" % columnName
|
||||
print " for (i = 0; i < datum->n; i++) {"
|
||||
print " smap_add(&row->%s," % columnName
|
||||
@ -245,7 +245,7 @@ static void
|
||||
print " }"
|
||||
elif (type.n_min == 1 and type.n_max == 1) or type.is_optional_pointer():
|
||||
print
|
||||
print " assert(inited);"
|
||||
print " ovs_assert(inited);"
|
||||
print " if (datum->n >= 1) {"
|
||||
if not type.key.ref_table:
|
||||
print " %s = datum->keys[0].%s;" % (keyVar, type.key.type.to_string())
|
||||
@ -270,7 +270,7 @@ static void
|
||||
nMax = "datum->n"
|
||||
print " size_t i;"
|
||||
print
|
||||
print " assert(inited);"
|
||||
print " ovs_assert(inited);"
|
||||
print " %s = NULL;" % keyVar
|
||||
if valueVar:
|
||||
print " %s = NULL;" % valueVar
|
||||
@ -333,7 +333,7 @@ static void
|
||||
{
|
||||
struct %(s)s *row = %(s)s_cast(row_);
|
||||
|
||||
assert(inited);''' % {'s': structName, 'c': columnName}
|
||||
ovs_assert(inited);''' % {'s': structName, 'c': columnName}
|
||||
|
||||
if type.is_smap():
|
||||
print " smap_destroy(&row->%s);" % columnName
|
||||
@ -415,7 +415,7 @@ struct %(s)s *
|
||||
void
|
||||
%(s)s_verify_%(c)s(const struct %(s)s *row)
|
||||
{
|
||||
assert(inited);
|
||||
ovs_assert(inited);
|
||||
ovsdb_idl_txn_verify(&row->header_, &%(s)s_columns[%(S)s_COL_%(C)s]);
|
||||
}''' % {'s': structName,
|
||||
'S': structName.upper(),
|
||||
@ -426,7 +426,7 @@ void
|
||||
for columnName, column in sorted(table.columns.iteritems()):
|
||||
if column.type.value:
|
||||
valueParam = ',\n\tenum ovsdb_atomic_type value_type OVS_UNUSED'
|
||||
valueType = '\n assert(value_type == %s);' % column.type.value.toAtomicType()
|
||||
valueType = '\n ovs_assert(value_type == %s);' % column.type.value.toAtomicType()
|
||||
valueComment = "\n * 'value_type' must be %s." % column.type.value.toAtomicType()
|
||||
else:
|
||||
valueParam = ''
|
||||
@ -452,7 +452,7 @@ const struct ovsdb_datum *
|
||||
%(s)s_get_%(c)s(const struct %(s)s *row,
|
||||
\tenum ovsdb_atomic_type key_type OVS_UNUSED%(v)s)
|
||||
{
|
||||
assert(key_type == %(kt)s);%(vt)s
|
||||
ovs_assert(key_type == %(kt)s);%(vt)s
|
||||
return ovsdb_idl_read(&row->header_, &%(s)s_col_%(c)s);
|
||||
}""" % {'s': structName, 'c': columnName,
|
||||
'kt': column.type.key.toAtomicType(),
|
||||
@ -469,7 +469,7 @@ void
|
||||
{
|
||||
struct ovsdb_datum datum;
|
||||
|
||||
assert(inited);
|
||||
ovs_assert(inited);
|
||||
if (smap) {
|
||||
struct smap_node *node;
|
||||
size_t i;
|
||||
@ -518,7 +518,7 @@ void
|
||||
print " struct ovsdb_datum datum;"
|
||||
if type.n_min == 1 and type.n_max == 1:
|
||||
print
|
||||
print " assert(inited);"
|
||||
print " ovs_assert(inited);"
|
||||
print " datum.n = 1;"
|
||||
print " datum.keys = xmalloc(sizeof *datum.keys);"
|
||||
print " " + type.key.copyCValue("datum.keys[0].%s" % type.key.type.to_string(), keyVar)
|
||||
@ -529,7 +529,7 @@ void
|
||||
print " datum.values = NULL;"
|
||||
elif type.is_optional_pointer():
|
||||
print
|
||||
print " assert(inited);"
|
||||
print " ovs_assert(inited);"
|
||||
print " if (%s) {" % keyVar
|
||||
print " datum.n = 1;"
|
||||
print " datum.keys = xmalloc(sizeof *datum.keys);"
|
||||
@ -542,7 +542,7 @@ void
|
||||
else:
|
||||
print " size_t i;"
|
||||
print
|
||||
print " assert(inited);"
|
||||
print " ovs_assert(inited);"
|
||||
print " datum.n = %s;" % nVar
|
||||
print " datum.keys = xmalloc(%s * sizeof *datum.keys);" % nVar
|
||||
if type.value:
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "row.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "dynamic-string.h"
|
||||
@ -376,7 +375,7 @@ ovsdb_row_hash_contains_all(const struct ovsdb_row_hash *a,
|
||||
{
|
||||
struct ovsdb_row_hash_node *node;
|
||||
|
||||
assert(ovsdb_column_set_equals(&a->columns, &b->columns));
|
||||
ovs_assert(ovsdb_column_set_equals(&a->columns, &b->columns));
|
||||
HMAP_FOR_EACH (node, hmap_node, &b->rows) {
|
||||
if (!ovsdb_row_hash_contains__(a, node->row, node->hmap_node.hash)) {
|
||||
return false;
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#include "server.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "hash.h"
|
||||
#include "ovsdb.h"
|
||||
|
||||
@ -35,7 +33,7 @@ ovsdb_session_init(struct ovsdb_session *session, struct ovsdb_server *server)
|
||||
void
|
||||
ovsdb_session_destroy(struct ovsdb_session *session)
|
||||
{
|
||||
assert(hmap_is_empty(&session->waiters));
|
||||
ovs_assert(hmap_is_empty(&session->waiters));
|
||||
hmap_destroy(&session->waiters);
|
||||
}
|
||||
|
||||
@ -101,7 +99,7 @@ ovsdb_lock_waiter_remove(struct ovsdb_lock_waiter *waiter)
|
||||
void
|
||||
ovsdb_lock_waiter_destroy(struct ovsdb_lock_waiter *waiter)
|
||||
{
|
||||
assert(!waiter->lock);
|
||||
ovs_assert(!waiter->lock);
|
||||
hmap_remove(&waiter->session->waiters, &waiter->session_node);
|
||||
free(waiter->lock_name);
|
||||
free(waiter);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2009, 2010, 2011 Nicira, Inc.
|
||||
/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
#include "table.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "json.h"
|
||||
@ -30,7 +29,7 @@
|
||||
static void
|
||||
add_column(struct ovsdb_table_schema *ts, struct ovsdb_column *column)
|
||||
{
|
||||
assert(!shash_find(&ts->columns, column->name));
|
||||
ovs_assert(!shash_find(&ts->columns, column->name));
|
||||
column->index = shash_count(&ts->columns);
|
||||
shash_add(&ts->columns, column->name, column);
|
||||
}
|
||||
@ -51,11 +50,11 @@ ovsdb_table_schema_create(const char *name, bool mutable,
|
||||
|
||||
uuid = ovsdb_column_create("_uuid", false, true, &ovsdb_type_uuid);
|
||||
add_column(ts, uuid);
|
||||
assert(uuid->index == OVSDB_COL_UUID);
|
||||
ovs_assert(uuid->index == OVSDB_COL_UUID);
|
||||
|
||||
version = ovsdb_column_create("_version", false, false, &ovsdb_type_uuid);
|
||||
add_column(ts, version);
|
||||
assert(version->index == OVSDB_COL_VERSION);
|
||||
ovs_assert(version->index == OVSDB_COL_VERSION);
|
||||
|
||||
ts->n_indexes = 0;
|
||||
ts->indexes = NULL;
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#include "transaction.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "dynamic-string.h"
|
||||
#include "hash.h"
|
||||
@ -111,7 +109,7 @@ ovsdb_txn_create(struct ovsdb *db)
|
||||
static void
|
||||
ovsdb_txn_free(struct ovsdb_txn *txn)
|
||||
{
|
||||
assert(list_is_empty(&txn->txn_tables));
|
||||
ovs_assert(list_is_empty(&txn->txn_tables));
|
||||
ds_destroy(&txn->comment);
|
||||
free(txn);
|
||||
}
|
||||
@ -807,7 +805,7 @@ ovsdb_txn_commit(struct ovsdb_txn *txn, bool durable)
|
||||
if (error) {
|
||||
/* We don't support two-phase commit so only the first replica is
|
||||
* allowed to report an error. */
|
||||
assert(&replica->node == txn->db->replicas.next);
|
||||
ovs_assert(&replica->node == txn->db->replicas.next);
|
||||
|
||||
ovsdb_txn_abort(txn);
|
||||
return error;
|
||||
@ -898,7 +896,7 @@ ovsdb_txn_row_modify(struct ovsdb_txn *txn, const struct ovsdb_row *ro_row_)
|
||||
struct ovsdb_row *ro_row = CONST_CAST(struct ovsdb_row *, ro_row_);
|
||||
|
||||
if (ro_row->txn_row) {
|
||||
assert(ro_row == ro_row->txn_row->new);
|
||||
ovs_assert(ro_row == ro_row->txn_row->new);
|
||||
return ro_row;
|
||||
} else {
|
||||
struct ovsdb_table *table = ro_row->table;
|
||||
@ -940,7 +938,7 @@ ovsdb_txn_row_delete(struct ovsdb_txn *txn, const struct ovsdb_row *row_)
|
||||
if (!txn_row) {
|
||||
ovsdb_txn_row_create(txn, table, row, NULL);
|
||||
} else {
|
||||
assert(txn_row->new == row);
|
||||
ovs_assert(txn_row->new == row);
|
||||
if (txn_row->old) {
|
||||
txn_row->new = NULL;
|
||||
} else {
|
||||
@ -987,7 +985,7 @@ ovsdb_txn_table_destroy(struct ovsdb_txn_table *txn_table)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
assert(hmap_is_empty(&txn_table->txn_rows));
|
||||
ovs_assert(hmap_is_empty(&txn_table->txn_rows));
|
||||
|
||||
for (i = 0; i < txn_table->table->schema->n_indexes; i++) {
|
||||
hmap_destroy(&txn_table->txn_indexes[i]);
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "trigger.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "json.h"
|
||||
@ -124,7 +123,7 @@ ovsdb_trigger_try(struct ovsdb_trigger *t, long long int now)
|
||||
static void
|
||||
ovsdb_trigger_complete(struct ovsdb_trigger *t)
|
||||
{
|
||||
assert(t->result != NULL);
|
||||
ovs_assert(t->result != NULL);
|
||||
list_remove(&t->node);
|
||||
list_push_back(&t->session->completions, &t->node);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ tests_test_jsonrpc_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
|
||||
|
||||
noinst_PROGRAMS += tests/test-list
|
||||
tests_test_list_SOURCES = tests/test-list.c
|
||||
tests_test_list_LDADD = lib/libopenvswitch.a
|
||||
tests_test_list_LDADD = lib/libopenvswitch.a $(SSL_LIBS)
|
||||
|
||||
noinst_PROGRAMS += tests/test-lockfile
|
||||
tests_test_lockfile_SOURCES = tests/test-lockfile.c
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
@ -843,7 +842,7 @@ sort_output_actions__(struct nlattr *first, struct nlattr *end)
|
||||
size_t bytes = (uint8_t *) end - (uint8_t *) first;
|
||||
size_t n = bytes / NL_A_U32_SIZE;
|
||||
|
||||
assert(bytes % NL_A_U32_SIZE == 0);
|
||||
ovs_assert(bytes % NL_A_U32_SIZE == 0);
|
||||
qsort(first, n, NL_A_U32_SIZE, compare_output_actions);
|
||||
}
|
||||
|
||||
@ -964,7 +963,7 @@ dpctl_normalize_actions(int argc, char *argv[])
|
||||
HMAP_FOR_EACH (af, hmap_node, &actions_per_flow) {
|
||||
afs[i++] = af;
|
||||
}
|
||||
assert(i == n_afs);
|
||||
ovs_assert(i == n_afs);
|
||||
|
||||
qsort(afs, n_afs, sizeof *afs, compare_actions_for_flow);
|
||||
|
||||
|
@ -2177,7 +2177,7 @@ ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms)
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(IS_POW2(protocol));
|
||||
ovs_assert(IS_POW2(protocol));
|
||||
|
||||
printf("chosen protocol: %s\n", ofputil_protocol_to_string(protocol));
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <float.h>
|
||||
@ -298,7 +297,7 @@ parse_options(int argc, char *argv[], struct shash *local_options)
|
||||
char *equals;
|
||||
int has_arg;
|
||||
|
||||
assert(name[0] == '-' && name[1] == '-' && name[2]);
|
||||
ovs_assert(name[0] == '-' && name[1] == '-' && name[2]);
|
||||
name += 2;
|
||||
|
||||
equals = strchr(name, '=');
|
||||
@ -311,8 +310,8 @@ parse_options(int argc, char *argv[], struct shash *local_options)
|
||||
|
||||
o = find_option(name, options, n_options);
|
||||
if (o) {
|
||||
assert(o - options >= n_global_long_options);
|
||||
assert(o->has_arg == has_arg);
|
||||
ovs_assert(o - options >= n_global_long_options);
|
||||
ovs_assert(o->has_arg == has_arg);
|
||||
} else {
|
||||
o = add_option(&options, &n_options, &allocated_options);
|
||||
o->name = xstrdup(name);
|
||||
@ -845,8 +844,8 @@ ovs_delete_bridge(const struct ovsrec_open_vswitch *ovs,
|
||||
static void
|
||||
del_cached_bridge(struct vsctl_context *ctx, struct vsctl_bridge *br)
|
||||
{
|
||||
assert(list_is_empty(&br->ports));
|
||||
assert(hmap_is_empty(&br->children));
|
||||
ovs_assert(list_is_empty(&br->ports));
|
||||
ovs_assert(hmap_is_empty(&br->children));
|
||||
if (br->parent) {
|
||||
hmap_remove(&br->parent->children, &br->children_node);
|
||||
}
|
||||
@ -912,7 +911,7 @@ add_port_to_cache(struct vsctl_context *ctx, struct vsctl_bridge *parent,
|
||||
static void
|
||||
del_cached_port(struct vsctl_context *ctx, struct vsctl_port *port)
|
||||
{
|
||||
assert(list_is_empty(&port->ifaces));
|
||||
ovs_assert(list_is_empty(&port->ifaces));
|
||||
list_remove(&port->ports_node);
|
||||
shash_find_and_delete(&ctx->ports, port->port_cfg->name);
|
||||
ovsrec_port_delete(port->port_cfg);
|
||||
@ -1133,7 +1132,7 @@ find_bridge(struct vsctl_context *ctx, const char *name, bool must_exist)
|
||||
{
|
||||
struct vsctl_bridge *br;
|
||||
|
||||
assert(ctx->cache_valid);
|
||||
ovs_assert(ctx->cache_valid);
|
||||
|
||||
br = shash_find_data(&ctx->bridges, name);
|
||||
if (must_exist && !br) {
|
||||
@ -1158,7 +1157,7 @@ find_port(struct vsctl_context *ctx, const char *name, bool must_exist)
|
||||
{
|
||||
struct vsctl_port *port;
|
||||
|
||||
assert(ctx->cache_valid);
|
||||
ovs_assert(ctx->cache_valid);
|
||||
|
||||
port = shash_find_data(&ctx->ports, name);
|
||||
if (port && !strcmp(name, port->bridge->name)) {
|
||||
@ -1176,7 +1175,7 @@ find_iface(struct vsctl_context *ctx, const char *name, bool must_exist)
|
||||
{
|
||||
struct vsctl_iface *iface;
|
||||
|
||||
assert(ctx->cache_valid);
|
||||
ovs_assert(ctx->cache_valid);
|
||||
|
||||
iface = shash_find_data(&ctx->ifaces, name);
|
||||
if (iface && !strcmp(name, iface->port->bridge->name)) {
|
||||
@ -2787,7 +2786,7 @@ parse_column_key_value(const char *arg,
|
||||
char *column_name;
|
||||
char *error;
|
||||
|
||||
assert(!(operatorp && !valuep));
|
||||
ovs_assert(!(operatorp && !valuep));
|
||||
*keyp = NULL;
|
||||
if (valuep) {
|
||||
*valuep = NULL;
|
||||
@ -3898,8 +3897,8 @@ run_prerequisites(struct vsctl_command *commands, size_t n_commands,
|
||||
(c->syntax->prerequisites)(&ctx);
|
||||
vsctl_context_done(&ctx, c);
|
||||
|
||||
assert(!c->output.string);
|
||||
assert(!c->table);
|
||||
ovs_assert(!c->output.string);
|
||||
ovs_assert(!c->table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "bridge.h"
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
@ -471,7 +470,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
|
||||
|
||||
COVERAGE_INC(bridge_reconfigure);
|
||||
|
||||
assert(!reconfiguring);
|
||||
ovs_assert(!reconfiguring);
|
||||
reconfiguring = true;
|
||||
|
||||
/* Destroy "struct bridge"s, "struct port"s, and "struct iface"s according
|
||||
@ -565,7 +564,7 @@ bridge_reconfigure_continue(const struct ovsrec_open_vswitch *ovs_cfg)
|
||||
struct bridge *br;
|
||||
bool done;
|
||||
|
||||
assert(reconfiguring);
|
||||
ovs_assert(reconfiguring);
|
||||
done = bridge_reconfigure_ofp();
|
||||
|
||||
/* Complete the configuration. */
|
||||
@ -1188,7 +1187,7 @@ iface_set_ofp_port(struct iface *iface, int ofp_port)
|
||||
{
|
||||
struct bridge *br = iface->port->bridge;
|
||||
|
||||
assert(iface->ofp_port < 0 && ofp_port >= 0);
|
||||
ovs_assert(iface->ofp_port < 0 && ofp_port >= 0);
|
||||
iface->ofp_port = ofp_port;
|
||||
hmap_insert(&br->ifaces, &iface->ofp_port_node, hash_int(ofp_port, 0));
|
||||
iface_set_ofport(iface->cfg, ofp_port);
|
||||
@ -1402,7 +1401,7 @@ iface_create(struct bridge *br, struct if_cfg *if_cfg, int ofp_port)
|
||||
* internal datastructures may not be consistent. Eventually, when port
|
||||
* additions and deletions are cheaper, these calls should be removed. */
|
||||
bridge_run_fast();
|
||||
assert(!iface_lookup(br, iface_cfg->name));
|
||||
ovs_assert(!iface_lookup(br, iface_cfg->name));
|
||||
error = iface_do_create(br, if_cfg, &ofp_port, &netdev);
|
||||
bridge_run_fast();
|
||||
if (error) {
|
||||
@ -1841,7 +1840,7 @@ iface_refresh_stats(struct iface *iface)
|
||||
#define IFACE_STAT(MEMBER, NAME) values[i++] = stats.MEMBER;
|
||||
IFACE_STATS;
|
||||
#undef IFACE_STAT
|
||||
assert(i == ARRAY_SIZE(keys));
|
||||
ovs_assert(i == ARRAY_SIZE(keys));
|
||||
|
||||
ovsrec_interface_set_statistics(iface->cfg, keys, values,
|
||||
ARRAY_SIZE(keys));
|
||||
@ -2403,7 +2402,7 @@ bridge_create(const struct ovsrec_bridge *br_cfg)
|
||||
{
|
||||
struct bridge *br;
|
||||
|
||||
assert(!bridge_lookup(br_cfg->name));
|
||||
ovs_assert(!bridge_lookup(br_cfg->name));
|
||||
br = xzalloc(sizeof *br);
|
||||
|
||||
br->name = xstrdup(br_cfg->name);
|
||||
@ -2569,7 +2568,7 @@ bridge_add_del_ports(struct bridge *br,
|
||||
struct shash new_ports;
|
||||
size_t i;
|
||||
|
||||
assert(hmap_is_empty(&br->if_cfg_todo));
|
||||
ovs_assert(hmap_is_empty(&br->if_cfg_todo));
|
||||
|
||||
/* Collect new ports. */
|
||||
shash_init(&new_ports);
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "system-stats.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
@ -169,7 +168,7 @@ get_boot_time(void)
|
||||
static long long int cache_expiration = LLONG_MIN;
|
||||
static long long int boot_time;
|
||||
|
||||
assert(LINUX_DATAPATH);
|
||||
ovs_assert(LINUX_DATAPATH);
|
||||
|
||||
if (time_msec() >= cache_expiration) {
|
||||
static const char stat_file[] = "/proc/stat";
|
||||
@ -201,7 +200,7 @@ get_boot_time(void)
|
||||
static unsigned long long int
|
||||
ticks_to_ms(unsigned long long int ticks)
|
||||
{
|
||||
assert(LINUX_DATAPATH);
|
||||
ovs_assert(LINUX_DATAPATH);
|
||||
|
||||
#ifndef USER_HZ
|
||||
#define USER_HZ 100
|
||||
@ -234,7 +233,7 @@ get_raw_process_info(pid_t pid, struct raw_process_info *raw)
|
||||
FILE *stream;
|
||||
int n;
|
||||
|
||||
assert(LINUX_DATAPATH);
|
||||
ovs_assert(LINUX_DATAPATH);
|
||||
|
||||
sprintf(file_name, "/proc/%lu/stat", (unsigned long int) pid);
|
||||
stream = fopen(file_name, "r");
|
||||
@ -319,7 +318,7 @@ count_crashes(pid_t pid)
|
||||
int crashes = 0;
|
||||
FILE *stream;
|
||||
|
||||
assert(LINUX_DATAPATH);
|
||||
ovs_assert(LINUX_DATAPATH);
|
||||
|
||||
sprintf(file_name, "/proc/%lu/cmdline", (unsigned long int) pid);
|
||||
stream = fopen(file_name, "r");
|
||||
@ -362,7 +361,7 @@ get_process_info(pid_t pid, struct process_info *pinfo)
|
||||
{
|
||||
struct raw_process_info child;
|
||||
|
||||
assert(LINUX_DATAPATH);
|
||||
ovs_assert(LINUX_DATAPATH);
|
||||
if (!get_raw_process_info(pid, &child)) {
|
||||
return false;
|
||||
}
|
||||
@ -640,7 +639,7 @@ system_stats_reply_cb(struct ofpbuf *reply,
|
||||
smap_init(received_stats);
|
||||
smap_from_json(received_stats, json);
|
||||
|
||||
assert(state == S_REQUEST_SENT);
|
||||
ovs_assert(state == S_REQUEST_SENT);
|
||||
state = S_REPLY_RECEIVED;
|
||||
|
||||
json_destroy(json);
|
||||
|
Loading…
x
Reference in New Issue
Block a user