
On 2013年01月04日 22:30, Eric Blake wrote:
On 01/03/2013 08:35 PM, Osier Yang wrote:
...when you could just use a single int value comprising the combination of major and minor as the hash key, if only you had used
Sounds good, how about something like "805516", where "8" is major, and "16" is the minor? It should be small enough to be not overflowing.
In fact, we already know of a single integer value large enough to contain both major and minor at the same time: the original st_rdev (of type dev_t) from stat(). We could simply add 'verify(sizeof(dev_t)<= sizeof(void*))', then reconstruct the st_rdev value by undoing the decomposition done by the major() and minor() macros. Or, you could even tweak patch 1/6 to return st_rdev as a single value instead of major/minor as two separate values.
Good, I will create a follow up patch, but later than pushing this set. Thanks, Osier