X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Frow.h;h=6c249a18400413913d9a85797278e4e786abf4f1;hb=1f0af7586e9ffbdbafe00344aca56cd2663b1f62;hp=d468194a4fd9b23f08fdbaff0ff206d936ace1dc;hpb=0d0f05b909b6428d44eb147bd4edd73782d2a137;p=openvswitch diff --git a/ovsdb/row.h b/ovsdb/row.h index d468194a..6c249a18 100644 --- a/ovsdb/row.h +++ b/ovsdb/row.h @@ -20,20 +20,42 @@ #include #include "column.h" #include "hmap.h" +#include "list.h" #include "ovsdb-data.h" struct ovsdb_column_set; +/* A weak reference. + * + * When a column in row A contains a weak reference to UUID of a row B this + * constitutes a weak reference from A (the source) to B (the destination). + * + * Rows A and B may be in the same table or different tables. + * + * Weak references from a row to itself are allowed, but no "struct + * ovsdb_weak_ref" structures are created for them. + */ +struct ovsdb_weak_ref { + struct list src_node; /* In src->src_refs list. */ + struct list dst_node; /* In destination row's dst_refs list. */ + struct ovsdb_row *src; /* Source row. */ +}; + /* A row in a database table. */ struct ovsdb_row { - struct ovsdb_table *table; /* Table to which this belongs. */ - struct hmap_node hmap_node; /* Element in ovsdb_table's 'rows' hmap. */ + struct ovsdb_table *table; /* Table to which this belongs. */ + struct hmap_node hmap_node; /* Element in ovsdb_table's 'rows' hmap. */ struct ovsdb_txn_row *txn_row; /* Transaction that row is in, if any. */ - /* Number of refs to this row from other rows, in this table or other - * tables, through 'uuid' columns that have a 'refTable' constraint - * pointing to this table. A row with nonzero 'n_refs' cannot be deleted. - * Updated and checked only at transaction commit. */ + /* Weak references. */ + struct list src_refs; /* Weak references from this row. */ + struct list dst_refs; /* Weak references to this row. */ + + /* Number of strong refs to this row from other rows, in this table or + * other tables, through 'uuid' columns that have a 'refTable' constraint + * pointing to this table and a 'refType' of "strong". A row with nonzero + * 'n_refs' cannot be deleted. Updated and checked only at transaction + * commit. */ size_t n_refs; struct ovsdb_datum fields[]; @@ -57,7 +79,7 @@ void ovsdb_row_update_columns(struct ovsdb_row *, const struct ovsdb_row *, struct ovsdb_error *ovsdb_row_from_json(struct ovsdb_row *, const struct json *, - const struct ovsdb_symbol_table *, + struct ovsdb_symbol_table *, struct ovsdb_column_set *included) WARN_UNUSED_RESULT; struct json *ovsdb_row_to_json(const struct ovsdb_row *,