diff options
author | Andy Zhou <azhou@nicira.com> | 2015-06-10 13:19:43 -0700 |
---|---|---|
committer | Andy Zhou <azhou@nicira.com> | 2015-06-23 17:05:20 -0700 |
commit | 23cbedb70b5507291b65dd10cdd0af5451d8e9b6 (patch) | |
tree | 99244c0c64681ff31060e2771d18fa31d05bfea9 /ovsdb | |
parent | 1c218735054d30d636215f0a6cd899a156592070 (diff) | |
download | openvswitch-23cbedb70b5507291b65dd10cdd0af5451d8e9b6.tar.gz |
ovsdb: add ovsdb_monitor_row_update_type()
The logic of determining row update type will be useful in the following
patch. Make it into a function.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ovsdb')
-rw-r--r-- | ovsdb/monitor.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c index 257959c50..ddfb6f1d9 100644 --- a/ovsdb/monitor.c +++ b/ovsdb/monitor.c @@ -458,6 +458,15 @@ ovsdb_monitor_changes_destroy(struct ovsdb_monitor_changes *changes) free(changes); } +static enum ovsdb_monitor_selection +ovsdb_monitor_row_update_type(bool initial, const bool old, const bool new) +{ + return initial ? OJMS_INITIAL + : !old ? OJMS_INSERT + : !new ? OJMS_DELETE + : OJMS_MODIFY; +} + /* Returns JSON for a <row-update> (as described in RFC 7047) for 'row' within * 'mt', or NULL if no row update should be sent. * @@ -478,10 +487,7 @@ ovsdb_monitor_compose_row_update( struct json *row_json; size_t i; - type = (initial ? OJMS_INITIAL - : !row->old ? OJMS_INSERT - : !row->new ? OJMS_DELETE - : OJMS_MODIFY); + type = ovsdb_monitor_row_update_type(initial, row->old, row->new); if (!(mt->select & type)) { return NULL; } |