X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fovsdb-idl.c;h=cc9deac91e56baf82b83115933369b15efe4c374;hb=f2ba3c0a425ba0745cd2640d38dc7e816333d1c6;hp=4826d62ed489c2cb89417366abd911c1bfb7843a;hpb=79554078d08b849059389f007a00c85b471d9e3d;p=openvswitch diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 4826d62e..cc9deac9 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -545,6 +545,26 @@ static bool ovsdb_idl_row_is_orphan(const struct ovsdb_idl_row *row) { return !row->old; +/* Returns true if 'row' is conceptually part of the database as modified by + * the current transaction (if any), false otherwise. + * + * This function will return true if 'row' is not an orphan (see the comment on + * ovsdb_idl_row_is_orphan()) and: + * + * - 'row' exists in the database and has not been deleted within the + * current transaction (if any). + * + * - 'row' was inserted within the current transaction and has not been + * deleted. (In the latter case you should not have passed 'row' in at + * all, because ovsdb_idl_txn_delete() freed it.) + * + * This function will return false if 'row' is an orphan or if 'row' was + * deleted within the current transaction. + */ +static bool +ovsdb_idl_row_exists(const struct ovsdb_idl_row *row) +{ + return row->new != NULL; } static void @@ -810,7 +830,7 @@ next_real_row(struct ovsdb_idl_table *table, struct hmap_node *node) struct ovsdb_idl_row *row; row = CONTAINER_OF(node, struct ovsdb_idl_row, hmap_node); - if (row->new || !ovsdb_idl_row_is_orphan(row)) { + if (ovsdb_idl_row_exists(row)) { return row; } }