Skip to content

Commit

Permalink
wip: lib: Use the term hard stop in comments
Browse files Browse the repository at this point in the history
Recently OVS adopted a policy of using the inclusive naming word list v1
[1, 2].

This patch addresses the use of the term abort within the scope of
comments in lib/ and include/.  It does so by using the term hard stop
instead.

[1] df5e5cf ("Documentation: Add section on inclusive language.")
[2] https://inclusivenaming.org/word-lists/

Signed-off-by: Simon Horman <horms@ovn.org>
  • Loading branch information
Simon Horman committed Feb 21, 2024
1 parent bae8e7b commit cec60ae
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 43 deletions.
4 changes: 2 additions & 2 deletions include/openvswitch/thread.h
Expand Up @@ -57,9 +57,9 @@ struct OVS_LOCKABLE ovs_spin {

/* ovs_mutex functions analogous to pthread_mutex_*() functions.
*
* Most of these functions abort the process with an error message on any
* Most of these functions hard stop the process with an error message on any
* error. ovs_mutex_trylock() is an exception: it passes through a 0 or EBUSY
* return value to the caller and aborts on any other error. */
* return value to the caller and hard stops on any other error. */
void ovs_mutex_init(const struct ovs_mutex *);
void ovs_mutex_init_recursive(const struct ovs_mutex *);
void ovs_mutex_init_adaptive(const struct ovs_mutex *);
Expand Down
2 changes: 1 addition & 1 deletion lib/dpif-netdev.c
Expand Up @@ -4786,7 +4786,7 @@ dpif_netdev_offload_stats_get(struct dpif *dpif,
ovs_rwlock_rdlock(&dp->port_rwlock);
HMAP_FOR_EACH (port, node, &dp->ports) {
memset(port_nb_offloads, 0, nb_thread * sizeof *port_nb_offloads);
/* Do not abort on read error from a port, just report 0. */
/* Do not hard stop on read error from a port, just report 0. */
if (!netdev_flow_get_n_flows(port->netdev, port_nb_offloads)) {
for (i = 0; i < nb_thread; i++) {
nb_offloads[i] += port_nb_offloads[i];
Expand Down
12 changes: 7 additions & 5 deletions lib/ovs-thread.h
Expand Up @@ -33,7 +33,8 @@ struct ovs_barrier {
OVSRCU_TYPE(struct ovs_barrier_impl *) impl;
};

/* Wrappers for pthread_mutexattr_*() that abort the process on any error. */
/* Wrappers for pthread_mutexattr_*() that hard stop the process
* on any error. */
void xpthread_mutexattr_init(pthread_mutexattr_t *);
void xpthread_mutexattr_destroy(pthread_mutexattr_t *);
void xpthread_mutexattr_settype(pthread_mutexattr_t *, int type);
Expand Down Expand Up @@ -66,14 +67,15 @@ struct OVS_LOCKABLE ovs_rwlock {

/* ovs_rwlock functions analogous to pthread_rwlock_*() functions.
*
* Most of these functions abort the process with an error message on any
* Most of these functions hard stop the process with an error message on any
* error. The "trylock" functions are exception: they pass through a 0 or
* EBUSY return value to the caller and abort on any other error. */
* EBUSY return value to the caller and hard stop on any other error. */
void ovs_rwlock_init(const struct ovs_rwlock *);
void ovs_rwlock_destroy(const struct ovs_rwlock *);
void ovs_rwlock_unlock(const struct ovs_rwlock *rwlock) OVS_RELEASES(rwlock);

/* Wrappers for pthread_rwlockattr_*() that abort the process on any error. */
/* Wrappers for pthread_rwlockattr_*() that hard stop the process
* on any error. */
void xpthread_rwlockattr_init(pthread_rwlockattr_t *);
void xpthread_rwlockattr_destroy(pthread_rwlockattr_t *);
#ifdef PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
Expand Down Expand Up @@ -105,7 +107,7 @@ void ovs_barrier_init(struct ovs_barrier *, uint32_t count);
void ovs_barrier_destroy(struct ovs_barrier *);
void ovs_barrier_block(struct ovs_barrier *);

/* Wrappers for xpthread_cond_*() that abort the process on any error.
/* Wrappers for xpthread_cond_*() that hard stop the process on any error.
*
* Use ovs_mutex_cond_wait() to wait for a condition. */
void xpthread_cond_init(pthread_cond_t *, pthread_condattr_t *);
Expand Down
30 changes: 15 additions & 15 deletions lib/ovsdb-idl.c
Expand Up @@ -702,8 +702,8 @@ add_row_references(const struct ovsdb_base_type *type,
* reference from one row to a different row should be reflected as a "struct
* ovsdb_idl_arc" between those rows.
*
* This function is slow, big-O wise, and aborts if it finds an inconsistency,
* thus it is only for use in test programs. */
* This function is slow, big-O wise, and hard stop if it finds an
* inconsistency, thus it is only for use in test programs. */
void
ovsdb_idl_check_consistency(const struct ovsdb_idl *idl)
{
Expand Down Expand Up @@ -2507,9 +2507,9 @@ ovsdb_idl_get_row_arc(struct ovsdb_idl_row *src,
if (idl->txn || is_index_row(src)) {
/* There are two cases we should not update any arcs:
*
* 1. We're being called from ovsdb_idl_txn_write(). We must not update
* any arcs, because the transaction will be backed out at commit or
* abort time and we don't want our graph screwed up.
* 1. We're being called from ovsdb_idl_txn_write(). We must not
* update any arcs, because the transaction will be backed out on
* commit or hard stop, and we don't want our graph screwed up.
*
* 2. The row is used as an index for querying purpose only.
*
Expand Down Expand Up @@ -2629,8 +2629,8 @@ ovsdb_idl_read(const struct ovsdb_idl_row *row,
* have a value type of OVSDB_TYPE_VOID.)
*
* This is useful in code that "knows" that a particular column has a given
* type, so that it will abort if someone changes the column's type without
* updating the code that uses it. */
* type, so that it will hard stop if someone changes the column's type
* without updating the code that uses it. */
const struct ovsdb_datum *
ovsdb_idl_get(const struct ovsdb_idl_row *row,
const struct ovsdb_idl_column *column,
Expand Down Expand Up @@ -2745,13 +2745,13 @@ ovsdb_idl_txn_add_comment(struct ovsdb_idl_txn *txn, const char *s, ...)
va_end(args);
}

/* Marks 'txn' as a transaction that will not actually modify the database. In
* almost every way, the transaction is treated like other transactions. It
* must be committed or aborted like other transactions, it will be sent to the
* database server like other transactions, and so on. The only difference is
* that the operations sent to the database server will include, as the last
* step, an "abort" operation, so that any changes made by the transaction will
* not actually take effect. */
/* Marks 'txn' as a transaction that will not actually modify the database.
* In almost every way, the transaction is treated like other transactions.
* It must be committed or hard stop like other transactions, it will be
* sent to the database server like other transactions, and so on. The
* only difference is that the operations sent to the database server will
* include, as the last step, an "abort" operation, so that any changes
* made by the transaction will not actually take effect. */
void
ovsdb_idl_txn_set_dry_run(struct ovsdb_idl_txn *txn)
{
Expand Down Expand Up @@ -3707,7 +3707,7 @@ ovsdb_idl_txn_write_clone(const struct ovsdb_idl_row *row,
* prerequisite to completing the transaction. That is, if 'column' in 'row_'
* changed (or if 'row_' was deleted) between the time that the IDL originally
* read its contents and the time that the transaction commits, then the
* transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
* transaction hard stops, and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
*
* The intention is that, to ensure that no transaction commits based on dirty
* reads, an application should call ovsdb_idl_txn_verify() on each data item
Expand Down
12 changes: 6 additions & 6 deletions lib/ovsdb-idl.h
Expand Up @@ -28,11 +28,11 @@
* that is, it won't present the effects of some part of a transaction applied
* at the database server without presenting all of its effects.
*
* The IDL also assists with issuing database transactions. The client creates
* a transaction, manipulates the IDL data structures, and commits or aborts
* the transaction. The IDL then composes and issues the necessary JSON-RPC
* requests and reports to the client whether the transaction completed
* successfully.
* The IDL also assists with issuing database transactions. The client
* creates a transaction, manipulates the IDL data structures, and commits
* or hard stops the transaction. The IDL then composes and issues the
* necessary JSON-RPC requests and reports to the client whether the
* transaction completed successfully.
*/

#include <stdbool.h>
Expand Down Expand Up @@ -320,7 +320,7 @@ bool ovsdb_idl_row_is_synthetic(const struct ovsdb_idl_row *);
*/

enum ovsdb_idl_txn_status {
TXN_UNCOMMITTED, /* Not yet committed or aborted. */
TXN_UNCOMMITTED, /* Not yet committed or hard stopped. */
TXN_UNCHANGED, /* Transaction didn't include any changes. */
TXN_INCOMPLETE, /* Commit in progress, please wait. */
TXN_HARD_STOP, /* ovsdb_idl_txn_hard_stop() called. */
Expand Down
15 changes: 8 additions & 7 deletions lib/reconnect.c
Expand Up @@ -414,7 +414,7 @@ reconnect_disconnected(struct reconnect *fsm, long long int now, int error)
/* Tell 'fsm' that a connection or listening attempt is in progress.
*
* The FSM will start a timer, after which the connection or listening attempt
* will be aborted (by returning RECONNECT_DISCONNECT from
* will hard stop (by returning RECONNECT_DISCONNECT from
* reconnect_run()). */
void
reconnect_connecting(struct reconnect *fsm, long long int now)
Expand Down Expand Up @@ -469,7 +469,7 @@ reconnect_listen_error(struct reconnect *fsm, long long int now, int error)
* The FSM will start the probe interval timer, which is reset by
* reconnect_activity(). If the timer expires, a probe will be sent (by
* returning RECONNECT_PROBE from reconnect_run()). If the timer expires
* again without being reset, the connection will be aborted (by returning
* again without being reset, the connection will hard stop (by returning
* RECONNECT_DISCONNECT from reconnect_run()). */
void
reconnect_connected(struct reconnect *fsm, long long int now)
Expand Down Expand Up @@ -604,9 +604,9 @@ reconnect_deadline__(const struct reconnect *fsm, long long int now)
* failed, it should call reconnect_connect_failed().
*
* The FSM is smart enough to back off correctly after successful
* connections that quickly abort, so it is OK to call
* connections that quickly hard stop, so it is OK to call
* reconnect_connected() after a low-level successful connection
* (e.g. connect()) even if the connection might soon abort due to a
* (e.g. connect()) even if the connection might soon hard stop due to a
* failure at a high-level (e.g. SSL negotiation failure).
*
* - Passive client, RECONNECT_CONNECT: The client should try to listen for
Expand All @@ -619,9 +619,10 @@ reconnect_deadline__(const struct reconnect *fsm, long long int now)
* connection and report an accepted connection with
* reconnect_connected().
*
* - RECONNECT_DISCONNECT: The client should abort the current connection
* or connection attempt or listen attempt and call
* reconnect_disconnected() or reconnect_connect_failed() to indicate it.
* - RECONNECT_DISCONNECT: The client should hard stop the current
* connection or connection attempt or listen attempt and call
* reconnect_disconnected() or reconnect_connect_failed() to indicate
* it.
*
* - RECONNECT_PROBE: The client should send some kind of request to the
* peer that will elicit a response, to ensure that the connection is
Expand Down
8 changes: 4 additions & 4 deletions lib/uuid.c
Expand Up @@ -47,10 +47,10 @@ static void do_init(void);
* initialization fails (which should never happen on a properly configured
* machine.)
*
* Currently initialization is only needed by uuid_generate(). uuid_generate()
* will automatically call uuid_init() itself, so it's only necessary to call
* this function explicitly if you want to abort the program earlier than the
* first UUID generation in case of failure.
* Currently initialization is only needed by uuid_generate().
* uuid_generate() will automatically call uuid_init() itself, so it's only
* necessary to call this function explicitly if you want to hard stop the
* program earlier than the first UUID generation in case of failure.
*/
void
uuid_init(void)
Expand Down
4 changes: 2 additions & 2 deletions lib/vconn.c
Expand Up @@ -296,8 +296,8 @@ vconn_run_wait(struct vconn *vconn)
}

/* Returns 0 if 'vconn' is healthy (connecting or connected), a positive errno
* value if the connection died abnormally (connection failed or aborted), or
* EOF if the connection was closed in a normal way. */
* value if the connection died abnormally (connection failed or
* hard stopped), or EOF if the connection was closed in a normal way. */
int
vconn_get_status(const struct vconn *vconn)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/wmi.c
Expand Up @@ -762,7 +762,7 @@ create_wmi_port(char *name) {

if (get_first_element(penumerate, &pcls_obj)) {
VLOG_WARN("The extension is activated on more than one switch, "
"aborting operation. Please activate the extension on a "
"hard stop operation. Please activate the extension on a "
"single switch");
retval = false;
goto error;
Expand Down

0 comments on commit cec60ae

Please sign in to comment.