-/* Copyright (c) 2013 Nicira, Inc.
+/* Copyright (c) 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ovs_mutex_lock(&mutex);
hmap_remove(all_bfds, &bfd->node);
netdev_close(bfd->netdev);
- ovs_refcount_destroy(&bfd->ref_cnt);
free(bfd->name);
free(bfd);
ovs_mutex_unlock(&mutex);
/*
- * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
netdev_close(cfm->netdev);
free(cfm->rmps_array);
- atomic_destroy(&cfm->extended);
- atomic_destroy(&cfm->check_tnl_key);
- ovs_refcount_destroy(&cfm->ref_cnt);
-
free(cfm);
}
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
unsigned int nl_status = nl_dump_done(&iter->dump);
atomic_read(&iter->status, &dump_status);
- atomic_destroy(&iter->status);
free(iter);
return dump_status ? dump_status : nl_status;
}
*CONST_CAST(const struct dpif_class **, &dp->class) = class;
*CONST_CAST(const char **, &dp->name) = xstrdup(name);
ovs_refcount_init(&dp->ref_cnt);
- atomic_flag_init(&dp->destroyed);
ovs_mutex_init(&dp->flow_mutex);
classifier_init(&dp->cls, NULL);
ovs_mutex_destroy(&dp->flow_mutex);
seq_destroy(dp->port_seq);
hmap_destroy(&dp->ports);
- atomic_flag_destroy(&dp->destroyed);
- ovs_refcount_destroy(&dp->ref_cnt);
latch_destroy(&dp->exit_latch);
free(CONST_CAST(char *, dp->name));
free(dp);
cls_rule_destroy(CONST_CAST(struct cls_rule *, &flow->cr));
ovs_mutex_lock(&flow->mutex);
dp_netdev_actions_unref(flow->actions);
- ovs_refcount_destroy(&flow->ref_cnt);
ovs_mutex_unlock(&flow->mutex);
ovs_mutex_destroy(&flow->mutex);
free(flow);
dp_netdev_actions_unref(struct dp_netdev_actions *actions)
{
if (actions && ovs_refcount_unref(&actions->ref_cnt) == 1) {
- ovs_refcount_destroy(&actions->ref_cnt);
free(actions->actions);
free(actions);
}
-/* Copyright (c) 2011, 2012, 2013 Nicira, Inc.
+/* Copyright (c) 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
hmap_destroy(&lacp->slaves);
list_remove(&lacp->node);
free(lacp->name);
- ovs_refcount_destroy(&lacp->ref_cnt);
free(lacp);
ovs_mutex_unlock(&mutex);
}
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bitmap_free(ml->flood_vlans);
ovs_rwlock_destroy(&ml->rwlock);
- ovs_refcount_destroy(&ml->ref_cnt);
free(ml);
}
}
atomic_read(&rc->ref_cnt, &ref_cnt);
if (!ref_cnt) {
hmap_remove(&netdev_classes, &rc->hmap_node);
- atomic_destroy(&rc->ref_cnt);
free(rc);
error = 0;
} else {
ovs_assert(status);
ofpbuf_uninit(&buf);
}
- atomic_destroy(&dump->status);
nl_pool_release(dump->sock);
seq_destroy(dump->status_seq);
return status >> 1;
(*(ORIG) = atomic_fetch_xor_explicit(RMW, ARG, ORDER), (void) 0)
#define atomic_and_explicit(RMW, ARG, ORIG, ORDER) \
(*(ORIG) = atomic_fetch_and_explicit(RMW, ARG, ORDER), (void) 0)
-
-static inline void
-atomic_flag_init(volatile atomic_flag *object OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
-static inline void
-atomic_flag_destroy(volatile atomic_flag *object OVS_UNUSED)
-{
- /* Nothing to do. */
-}
#define ATOMIC_VAR_INIT(VALUE) (VALUE)
#define atomic_init(OBJECT, VALUE) __c11_atomic_init(OBJECT, VALUE)
-#define atomic_destroy(OBJECT) ((void) (OBJECT))
/* Clang hard-codes these exact values internally but does not appear to
* export any names for them. */
/*
- * Copyright (c) 2013 Nicira, Inc.
+ * Copyright (c) 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
} atomic_flag;
#define ATOMIC_FLAG_INIT { .b = false }
-static inline void
-atomic_flag_init(volatile atomic_flag *object OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
-static inline void
-atomic_flag_destroy(volatile atomic_flag *object OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
static inline bool
atomic_flag_test_and_set_explicit(volatile atomic_flag *object,
memory_order order)
\f
#define ATOMIC_VAR_INIT(VALUE) VALUE
#define atomic_init(OBJECT, VALUE) (*(OBJECT) = (VALUE), (void) 0)
-#define atomic_destroy(OBJECT) ((void) (OBJECT))
static inline void
atomic_thread_fence(memory_order order)
} atomic_flag;
#define ATOMIC_FLAG_INIT { false }
-static inline void
-atomic_flag_init(volatile atomic_flag *object OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
-static inline void
-atomic_flag_destroy(volatile atomic_flag *object OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
static inline bool
atomic_flag_test_and_set(volatile atomic_flag *object)
{
#define ATOMIC_VAR_INIT(VALUE) (VALUE)
#define atomic_init(OBJECT, VALUE) (*(OBJECT) = (VALUE), (void) 0)
-#define atomic_destroy(OBJECT) ((void) (OBJECT))
#define atomic_thread_fence __atomic_thread_fence
#define atomic_signal_fence __atomic_signal_fence
#define ATOMIC_VAR_INIT(VALUE) (VALUE)
#define atomic_init(OBJECT, VALUE) (*(OBJECT) = (VALUE), (void) 0)
-#define atomic_destroy(OBJECT) ((void) (OBJECT))
static inline void
atomic_thread_fence(memory_order order OVS_UNUSED)
} atomic_flag;
#define ATOMIC_FLAG_INIT { false }
-static inline void
-atomic_flag_init(volatile atomic_flag *flag OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
-static inline void
-atomic_flag_destroy(volatile atomic_flag *flag OVS_UNUSED)
-{
- /* Nothing to do. */
-}
-
static inline bool
atomic_flag_test_and_set(volatile atomic_flag *flag_)
{
* ...
* atomic_init(&ai, 123);
*
- * C11 does not hav an destruction function for atomic types, but some
- * implementations of the OVS atomics do need them. Thus, the following
- * function is provided for destroying non-static atomic objects (A is any
- * atomic type):
- *
- * void atomic_destroy(A *object);
- *
- * Destroys 'object'.
- *
*
* Barriers
* ========
* ATOMIC_FLAG_INIT is an initializer for atomic_flag. The initial state is
* "clear".
*
- * C11 does not have an initialization or destruction function for atomic_flag,
- * because implementations should not need one (one may simply
- * atomic_flag_clear() an uninitialized atomic_flag), but some implementations
- * of the OVS atomics do need them. Thus, the following two functions are
- * provided for initializing and destroying non-static atomic_flags:
- *
- * void atomic_flag_init(volatile atomic_flag *object);
- *
- * Initializes 'object'. The initial state is "clear".
- *
- * void atomic_flag_destroy(volatile atomic_flag *object);
- *
- * Destroys 'object'.
+ * An atomic_flag may also be initialized at runtime with atomic_flag_clear().
*
*
* Operations
atomic_init(&refcount->count, 1);
}
-/* Destroys 'refcount'. */
-static inline void
-ovs_refcount_destroy(struct ovs_refcount *refcount)
-{
- atomic_destroy(&refcount->count);
-}
-
/* Increments 'refcount'. */
static inline void
ovs_refcount_ref(struct ovs_refcount *refcount)
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
list_remove(&stp->node);
ovs_mutex_unlock(&mutex);
free(stp->name);
- ovs_refcount_destroy(&stp->ref_cnt);
free(stp);
}
}
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ovs_mutex_destroy(&bond->mutex);
free(bond->hash);
free(bond->name);
- ovs_refcount_destroy(&bond->ref_cnt);
free(bond);
}
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
atomic_sub(&netflow_count, 1, &orig);
collectors_destroy(nf->collectors);
ofpbuf_uninit(&nf->packet);
- ovs_refcount_destroy(&nf->ref_cnt);
free(nf);
}
}
/*
- * Copyright (c) 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2012, 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
dpif_ipfix_clear(di);
dpif_ipfix_bridge_exporter_destroy(&di->bridge_exporter);
hmap_destroy(&di->flow_exporter_map);
- ovs_refcount_destroy(&di->ref_cnt);
free(di);
ovs_mutex_unlock(&mutex);
}
dpif_sflow_del_port__(ds, dsp);
}
hmap_destroy(&ds->ports);
- ovs_refcount_destroy(&ds->ref_cnt);
free(ds);
}
}
latch_destroy(&udpif->exit_latch);
seq_destroy(udpif->reval_seq);
seq_destroy(udpif->dump_seq);
- atomic_destroy(&udpif->flow_limit);
- atomic_destroy(&udpif->n_flows);
- atomic_destroy(&udpif->n_flows_timestamp);
ovs_mutex_destroy(&udpif->n_flows_mutex);
free(udpif);
}
cls_rule_destroy(CONST_CAST(struct cls_rule *, &rule->cr));
rule_actions_unref(rule->actions);
ovs_mutex_destroy(&rule->mutex);
- ovs_refcount_destroy(&rule->ref_count);
rule->ofproto->ofproto_class->rule_dealloc(rule);
}
rule_actions_unref(struct rule_actions *actions)
{
if (actions && ovs_refcount_unref(&actions->ref_count) == 1) {
- ovs_refcount_destroy(&actions->ref_count);
free(actions->ofpacts);
free(actions);
}
oftable_disable_eviction(table);
classifier_destroy(&table->cls);
free(table->name);
- atomic_destroy(&table->config);
}
/* Changes the name of 'table' to 'name'. If 'name' is NULL or the empty
/*
- * Copyright (c) 2013 Nicira, Inc.
+ * Copyright (c) 2013, 2014 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ovs_assert(orig == 2); \
atomic_read(&x, &value); \
ovs_assert(value == 8); \
- \
- atomic_destroy(&x); \
}
static void