summaryrefslogtreecommitdiff
path: root/lib/uuid.c
Commit message (Collapse)AuthorAgeFilesLines
* uuid: New function uuid_random().Ben Pfaff2017-10-241-0/+8
| | | | | Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* uuid: New function uuid_is_partial_match().Ben Pfaff2017-05-031-0/+11
| | | | | | | | This will have another caller in an upcoming commit. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* uuid: Change semantics of uuid_is_partial_string().Ben Pfaff2017-05-031-9/+21
| | | | | | | | | | | | | | | | | | | | Until now, uuid_is_partial_string() returned the number of characters at the beginning of a string that were the beginning of a valid UUID. This is useful, but all of the callers actually wanted to get a value of 0 if the string contained a character that was invalid for a UUID. This makes that change. Examples: "123" previously yielded 3 and still does. "xyzzy" previously yielded 0 and still does. "123xyzzy" previously yielded 3, now yields 0. "e66250bb-9531-491b-b9c3-5385cabb0080" previously yielded 36, still does. "e66250bb-9531-491b-b9c3-5385cabb0080xyzzy" previously yielded 36, now 0. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org> Acked-by: Russell Bryant <russell@ovn.org>
* uuid: New macro UUID_ZERO for an all-zero expression or initializer.Ben Pfaff2017-02-081-1/+1
| | | | | | | This is convenient in expressions, e.g. "uuid = x ? *x : UUID_ZERO;". Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
* ovn-controller: Tie OpenFlow and logical flows using OpenFlow cookie.Ben Pfaff2016-12-281-1/+21
| | | | | | | | | | | This makes it easy to find the logical flow that generated a particular OpenFlow flow, by running "ovn-sbctl dump-flows <cookie>". Later, this can be refined (and automated for "ofproto/trace"), but this is still a significant advance. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* dpif: Always generate RFC4122 UUIDs for UFID.Joe Stringer2015-06-091-0/+6
| | | | | | | | | | | This patch sacrifices a few bits of hash quality from the 128-bit unique flow identifiers to make the UFIDs RFC4122-conformant as per the version 4 (random) UUID spec. Given that the 128-bit space is already quite large, this should not affect the spread of UFIDs in any meaningful way for hashing. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* uuid: Use current time to compute sha.Gurucharan Shetty2014-03-121-11/+13
| | | | | | | | | Windows does not have the getppid(), getuid(), getgid() functions. We do get a random seed from CryptGenRandom(). That seed along with process id and current time hopefully is good enough. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Use "error-checking" mutexes in place of other kinds wherever possible.Ben Pfaff2013-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | We've seen a number of deadlocks in the tree since thread safety was introduced. So far, all of these are self-deadlocks, that is, a single thread acquiring a lock and then attempting to re-acquire the same lock recursively. When this has happened, the process simply hung, and it was somewhat difficult to find the cause. POSIX "error-checking" mutexes check for this specific problem (and others). This commit switches from other types of mutexes to error-checking mutexes everywhere that we can, that is, everywhere that we're not using recursive mutexes. This ought to help find problems more quickly in the future. There might be performance advantages to other kinds of mutexes in some cases. However, the existing mutex type choices were just guesses, so I'd rather go for easy detection of errors until we know that other mutex types actually perform better in specific cases. Also, I did a quick microbenchmark of glibc mutex types on my host and found that the error checking mutexes weren't any slower than the other types, at least when the mutex is uncontended. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* clang: Add annotations for thread safety check.Ethan Jackson2013-07-301-3/+3
| | | | | | | | | | This commit adds annotations for thread safety check. And the check can be conducted by using -Wthread-safety flag in clang. Co-authored-by: Alex Wang <alexw@nicira.com> Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* uuid: Make uuid_generate() thread-safe.Ben Pfaff2013-07-231-8/+13
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Andy Zhou <azhou@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Log anything that could prevent a daemon from starting.Ben Pfaff2011-04-041-4/+3
| | | | | If a daemon doesn't start, we need to know why. Being able to consistently consult the log to find out is helpful.
* util: Add function hexits_value() for parsing multiple hex digits.Ben Pfaff2010-11-151-15/+35
| | | | Suggested-by: Justin Pettit <jpettit@nicira.com>
* uuid: Fix warnings carelessly introduced a few commits ago.Ben Pfaff2010-08-131-1/+1
| | | | | Commit e251c8 "uuid: Break code to read /dev/urandom into a new module" carelessly introduced a few warnings, which this commit fixes up.
* uuid: Break code to read /dev/urandom into a new module.Ben Pfaff2010-08-121-25/+3
| | | | | This code is useful for seeding other random number generators, so we might as well make it a separate source file.
* uuid: New function uuid_from_string_prefix().Ben Pfaff2010-02-151-2/+18
| | | | For use in an upcoming commit.
* ovsdb: Save some space in the log for newly inserted records.Ben Pfaff2010-01-111-1/+9
| | | | | | | | | | | | 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.)
* Implement RFC 4122-compliant UUIDs.Ben Pfaff2009-11-041-0/+216
This UUID library will be used by the upcoming configuration database.