Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
03fa4688
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
03fa4688
编写于
12月 04, 2009
作者:
M
Matthias Bolte
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vbox: Use virIndexToDiskName() in vboxGenerateMediumName()
上级
81ea6e4d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
45 deletion
+9
-45
src/vbox/vbox_tmpl.c
src/vbox/vbox_tmpl.c
+9
-45
未找到文件。
src/vbox/vbox_tmpl.c
浏览文件 @
03fa4688
...
...
@@ -412,9 +412,6 @@ static void vboxUtf8toIID(virConnectPtr conn, char *uuidstr, vboxIID **iid) {
* function to generate the name for medium,
* for e.g: hda, sda, etc
*
* Limitation: 1) max (26+(26*26)+(26*26*26)) i.e
* 18,278 names for now
*
* @returns null terminated string with device name or NULL
* for failures
* @param conn Input Connection Pointer
...
...
@@ -426,15 +423,14 @@ static void vboxUtf8toIID(virConnectPtr conn, char *uuidstr, vboxIID **iid) {
* @param aMaxSlotPerPort Input array of max slot per device port
*
*/
static
char
*
vboxGenerateMediumName
(
virConnectPtr
conn
,
PRUint32
storageBus
,
static
char
*
vboxGenerateMediumName
(
PRUint32
storageBus
,
PRInt32
deviceInst
,
PRInt32
devicePort
,
PRInt32
deviceSlot
,
PRUint32
*
aMaxPortPerInst
,
PRUint32
*
aMaxSlotPerPort
)
{
const
char
*
prefix
=
NULL
;
char
*
name
=
NULL
;
int
len
=
0
;
int
total
=
0
;
PRUint32
maxPortPerInst
=
0
;
PRUint32
maxSlotPerPort
=
0
;
...
...
@@ -453,48 +449,20 @@ static char *vboxGenerateMediumName(virConnectPtr conn,
+
(
devicePort
*
maxSlotPerPort
)
+
deviceSlot
;
if
((
total
>=
0
)
&&
(
total
<
26
))
len
=
4
;
else
if
((
total
>=
26
)
&&
(
total
<
26
*
26
+
26
))
len
=
5
;
else
if
((
total
>=
26
*
26
+
26
)
&&
(
total
<
26
*
26
*
26
+
26
*
26
+
26
))
len
=
6
;
else
return
NULL
;
if
(
VIR_ALLOC_N
(
name
,
len
)
<
0
)
{
virReportOOMError
(
conn
);
return
NULL
;
}
/* TODO: use virIndexToDiskName() here when available */
if
(
storageBus
==
StorageBus_IDE
)
{
name
[
0
]
=
'h'
;
name
[
1
]
=
'd'
;
prefix
=
"hd"
;
}
else
if
(
(
storageBus
==
StorageBus_SATA
)
||
(
storageBus
==
StorageBus_SCSI
))
{
name
[
0
]
=
's'
;
name
[
1
]
=
'd'
;
prefix
=
"sd"
;
}
else
if
(
storageBus
==
StorageBus_Floppy
)
{
name
[
0
]
=
'f'
;
name
[
1
]
=
'd'
;
prefix
=
"fd"
;
}
if
(
len
==
4
)
{
name
[
2
]
=
(
char
)(
97
+
total
);
}
else
if
(
len
==
5
)
{
name
[
2
]
=
(
char
)(
96
+
(
total
/
26
));
name
[
3
]
=
(
char
)(
97
+
(
total
%
26
));
}
else
if
(
len
==
6
)
{
name
[
2
]
=
(
char
)(
96
+
(
total
/
26
*
26
));
name
[
3
]
=
(
char
)(
96
+
((
total
%
(
26
*
26
))
/
26
));
name
[
4
]
=
(
char
)(
97
+
((
total
%
(
26
*
26
))
%
26
));
}
name
=
virIndexToDiskName
(
total
,
prefix
);
name
[
len
-
1
]
=
'\0'
;
DEBUG
(
"name=%s, len=%d, total=%d, storageBus=%u, deviceInst=%d, "
DEBUG
(
"name=%s, total=%d, storageBus=%u, deviceInst=%d, "
"devicePort=%d deviceSlot=%d, maxPortPerInst=%u maxSlotPerPort=%u"
,
name
,
len
,
total
,
storageBus
,
deviceInst
,
devicePort
,
NULLSTR
(
name
)
,
total
,
storageBus
,
deviceInst
,
devicePort
,
deviceSlot
,
maxPortPerInst
,
maxSlotPerPort
);
return
name
;
}
...
...
@@ -505,9 +473,6 @@ static char *vboxGenerateMediumName(virConnectPtr conn,
* e.g: hda has StorageBus = IDE, port = 0,
* device = 0
*
* Limitation: only name till 4 chars supported
* i.e from hda till hdzz
*
* @returns true on Success, false on failure.
* @param deviceName Input device name
* @param aMaxPortPerInst Input array of max port per device instance
...
...
@@ -2496,8 +2461,7 @@ static char *vboxDomainDumpXML(virDomainPtr dom, int flags) {
imediumattach
->
vtbl
->
GetPort
(
imediumattach
,
&
devicePort
);
imediumattach
->
vtbl
->
GetDevice
(
imediumattach
,
&
deviceSlot
);
def
->
disks
[
diskCount
]
->
dst
=
vboxGenerateMediumName
(
dom
->
conn
,
storageBus
,
def
->
disks
[
diskCount
]
->
dst
=
vboxGenerateMediumName
(
storageBus
,
deviceInst
,
devicePort
,
deviceSlot
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录