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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org