-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sys: add uuid module for central ID/addr generation #6314
Conversation
255 ID's ought to be enough for everybody! Seriously, would it be hard to use a larger type for last_used, and XOR all of it's bits? |
would be slightly more overhead in two dimensions:
|
/** | ||
* @defgroup sys_uuid | ||
* @ingroup sys | ||
* @brief Generate system wide unique IDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that name it maybe woth pointing out, that these "U"UIDs are not compatible to RFC 4122.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, other ideas how we could name the module so there is no confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not applicable due to the more generalized nature of your API, but what about devid
(or dev_id
, so nobody will call it like some Germans call Davids ;-))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I think a more general name would be the better fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but now that I thought about it, let's do it like that: I add that comment you requested and if we find a better name, we can refactor then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
*/ | ||
|
||
/** | ||
* @defgroup sys_uuid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ups
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some documentation remarks
/** | ||
* @brief Get a unique ID | ||
* | ||
* The resulting ID is build from the base ID XORed with an 8-bit incrementing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/build from/built from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/base ID/base ID generated with uuid_base() which is/
* The resulting ID is build from the base ID XORed with an 8-bit incrementing | ||
* counter value into the most significant byte. | ||
* | ||
* @note The resulting UUID will repeat after 256 calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 for the base uuid?
* | ||
* @param[out] buf memory location to copy the UUID into. MUST be able to | ||
* hold at least @p len byte | ||
* @param[in] len targeted length of the UUID in byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/targeted//
s/byte/bytes/
* @note The resulting UUID will repeat after 256 calls. | ||
* | ||
* @param[out] buf memory location to copy the UUID into. MUST be able to | ||
* hold at least @p len byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/byte/bytes/
* | ||
* @param[out] buf memory location to copy the UUID into. MUST be able to | ||
* hold at least @p len byte | ||
* @param[in] len targeted length of the UUID in byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/targeted//
s/byte/bytes/
* not. | ||
* | ||
* @param[out] buf memory location to copy the UUID into. MUST be able to | ||
* hold at least @p len byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/byte/bytes/
/** | ||
* @brief Get a custom unique ID based on a user given generator value | ||
* | ||
* The resulting ID is build from the base ID XORed with @p gen in the base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/build/built/
* | ||
* @param[out] buf memory location to copy the UUID into. MUST be able to | ||
* hold at least @p len byte | ||
* @param[in] len targeted length of the UUID in byte |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compare other comments
* @brief Get a custom unique ID based on a user given generator value | ||
* | ||
* The resulting ID is build from the base ID XORed with @p gen in the base | ||
* ID's most significant bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really true? It's late and the code is somewhat hard to read ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
a97245c
to
ef07ddd
Compare
rebased and (hopefully) fixed doc issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my comments have been addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine
ef07ddd
to
863a872
Compare
squashed and rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACKACKACKACKACKACKACKACKACK
863a872
to
88636b6
Compare
rebased. Somehow Murdock failed, but can't really tell what the problem was.. |
And go |
Wanted to do this for a long time: this PR centralizes the generation of unique IDs/addresses. Now all network drivers use the same code to generate their hardware addresses.
Addresses #5055 (though not all problems are solved?!):
uuid_custom()
), but I did not yet think of a good value to use as custom generator param for this function...@PeterKietzmann: feel free to postpone the milestone to 2017.04...