+/* Returns a read-only datum of the given 'type' that has the default value for
+ * 'type'. The caller must not modify or free the returned datum.
+ *
+ * See ovsdb_datum_init_default() for an explanation of the default value of a
+ * datum. */
+const struct ovsdb_datum *
+ovsdb_datum_default(const struct ovsdb_type *type)
+{
+ if (type->n_min == 0) {
+ static const struct ovsdb_datum empty;
+ return ∅
+ } else if (type->n_min == 1) {
+ static struct ovsdb_datum default_data[OVSDB_N_TYPES][OVSDB_N_TYPES];
+ struct ovsdb_datum *d;
+ int kt = type->key.type;
+ int vt = type->value.type;
+
+ assert(ovsdb_type_is_valid(type));
+
+ d = &default_data[kt][vt];
+ if (!d->n) {
+ d->n = 1;
+ d->keys = (union ovsdb_atom *) ovsdb_atom_default(kt);
+ if (vt != OVSDB_TYPE_VOID) {
+ d->values = (union ovsdb_atom *) ovsdb_atom_default(vt);
+ }
+ }
+ return d;
+ } else {
+ NOT_REACHED();
+ }
+}
+
+/* Returns true if 'datum', which must have the given 'type', has the default
+ * value for that type.
+ *
+ * See ovsdb_datum_init_default() for an explanation of the default value of a
+ * datum. */