[libvirt] [PATCH 2/6] qemu: Add a hash table for the shared disks

Eric Blake eblake at redhat.com
Fri Jan 4 14:30:12 UTC 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130104/a2ceb889/attachment-0001.sig>


More information about the libvir-list mailing list