mirror of https://gitee.com/openkylin/libvirt.git
fix index creation for disks
* src/domain_conf.c src/util.c: fix index creation for disks > {sd,hd,xvd,vd}z (Sanjay Rao and Chris Wright) Daniel
This commit is contained in:
parent
02fc93d624
commit
3d038d101f
1
AUTHORS
1
AUTHORS
|
@ -51,6 +51,7 @@ Patches have also been contributed by:
|
|||
Charles Duffy <Charles_Duffy@messageone.com>
|
||||
Nguyen Anh Quynh <aquynh@gmail.com>
|
||||
James Morris <jmorris@namei.org>
|
||||
Chris Wrigh <chrisw@redhat.com>
|
||||
|
||||
|
||||
[....send patches to get your name here....]
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 10 10:33:29 CEST 2008 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/domain_conf.c src/util.c: fix index creation for disks >
|
||||
{sd,hd,xvd,vd}z (Sanjay Rao and Chris Wright)
|
||||
|
||||
Thu Oct 9 11:30:00 EST Cole Robinson <crobinso@redhat.com>
|
||||
|
||||
* src/domain_conf.c src/hash.c src/internal.h src/lxc_conf.c
|
||||
|
|
|
@ -3374,7 +3374,7 @@ char *virDomainConfigFile(virConnectPtr conn,
|
|||
|
||||
/* Translates a device name of the form (regex) "[fhv]d[a-z]+" into
|
||||
* the corresponding bus,index combination (e.g. sda => (0,0), sdi (1,1),
|
||||
* hdd => (1,1), vdaa => (0,27))
|
||||
* hdd => (1,1), vdaa => (0,26))
|
||||
* @param disk The disk device
|
||||
* @param busIdx parsed bus number
|
||||
* @param devIdx parsed device number
|
||||
|
|
|
@ -1036,7 +1036,7 @@ const char *virEnumToString(const char *const*types,
|
|||
}
|
||||
|
||||
/* Translates a device name of the form (regex) "[fhv]d[a-z]+" into
|
||||
* the corresponding index (e.g. sda => 1, hdz => 26, vdaa => 27)
|
||||
* the corresponding index (e.g. sda => 0, hdz => 25, vdaa => 26)
|
||||
* @param name The name of the device
|
||||
* @return name's index, or -1 on failure
|
||||
*/
|
||||
|
@ -1056,8 +1056,8 @@ int virDiskNameToIndex(const char *name) {
|
|||
if (!ptr)
|
||||
return -1;
|
||||
|
||||
while (*ptr) {
|
||||
idx = idx * 26;
|
||||
for (i = 0; *ptr; i++) {
|
||||
idx = (idx + i) * 26;
|
||||
|
||||
if (!c_islower(*ptr))
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue