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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]