summaryrefslogtreecommitdiff
path: root/lib/uuid.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-01-11 13:14:54 -0800
committerBen Pfaff <blp@nicira.com>2010-01-11 13:14:54 -0800
commitc532bf9dd4e684bc583debc9618e3210334f8081 (patch)
treebbd64fe072c4b1458ee6e69c61607b45f7bac381 /lib/uuid.c
parent80d326ad2a08995300aa02aaae2087fcd96694f4 (diff)
downloadopenvswitch-c532bf9dd4e684bc583debc9618e3210334f8081.tar.gz
ovsdb: Save some space in the log for newly inserted records.
When a new record is inserted into a database, ovsdb logs the values of all of the fields in the record. However, often new records have many columns that contain default values. There is no need to log those values, so this commit causes them to be omitted. As a side effect, this also makes "ovsdb-tool show-log --more --more" output easier to read, because record insertions print less noise. (Adding --more --more to this command makes it print changes to database records. The --more option will be introduced in an upcoming commit.)
Diffstat (limited to 'lib/uuid.c')
-rw-r--r--lib/uuid.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/uuid.c b/lib/uuid.c
index 264d9bf5a..620c039cb 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2009 Nicira Networks
+/* Copyright (c) 2008, 2009, 2010 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,6 +107,14 @@ uuid_zero(struct uuid *uuid)
uuid->parts[0] = uuid->parts[1] = uuid->parts[2] = uuid->parts[3] = 0;
}
+/* Returns true if 'uuid' is all zero, otherwise false. */
+bool
+uuid_is_zero(const struct uuid *uuid)
+{
+ return (!uuid->parts[0] && !uuid->parts[1]
+ && !uuid->parts[2] && !uuid->parts[3]);
+}
+
/* Compares 'a' and 'b'. Returns a negative value if 'a < b', zero if 'a ==
* b', or positive if 'a > b'. The ordering is lexicographical order of the
* conventional way of writing out UUIDs as strings. */