Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1c6ee84c
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看板
提交
1c6ee84c
编写于
3月 06, 2014
作者:
C
Chunyan Liu
提交者:
Daniel P. Berrange
3月 12, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve parameter name to let it more meaningful
上级
1fabf06c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
27 deletion
+29
-27
src/util/virhostdev.c
src/util/virhostdev.c
+23
-21
src/util/virhostdev.h
src/util/virhostdev.h
+6
-6
未找到文件。
src/util/virhostdev.c
浏览文件 @
1c6ee84c
...
@@ -454,7 +454,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
...
@@ -454,7 +454,7 @@ virHostdevNetConfigRestore(virDomainHostdevDefPtr hostdev,
int
int
virHostdevPreparePCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevPreparePCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
const
unsigned
char
*
uuid
,
const
unsigned
char
*
uuid
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
int
nhostdevs
,
...
@@ -575,7 +575,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
...
@@ -575,7 +575,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
activeDev
=
virPCIDeviceListFind
(
hostdev_mgr
->
activePciHostdevs
,
dev
);
activeDev
=
virPCIDeviceListFind
(
hostdev_mgr
->
activePciHostdevs
,
dev
);
if
(
activeDev
)
if
(
activeDev
)
virPCIDeviceSetUsedBy
(
activeDev
,
drv_name
,
name
);
virPCIDeviceSetUsedBy
(
activeDev
,
drv_name
,
dom_
name
);
}
}
/* Loop 8: Now set the original states for hostdev def */
/* Loop 8: Now set the original states for hostdev def */
...
@@ -691,7 +691,7 @@ virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
...
@@ -691,7 +691,7 @@ virHostdevReattachPciDevice(virPCIDevicePtr dev, virHostdevManagerPtr mgr)
void
void
virHostdevReAttachPCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevReAttachPCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
int
nhostdevs
,
char
*
oldStateDir
)
char
*
oldStateDir
)
...
@@ -730,7 +730,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
...
@@ -730,7 +730,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr,
const
char
*
usedby_domname
;
const
char
*
usedby_domname
;
virPCIDeviceGetUsedBy
(
activeDev
,
&
usedby_drvname
,
&
usedby_domname
);
virPCIDeviceGetUsedBy
(
activeDev
,
&
usedby_drvname
,
&
usedby_domname
);
if
(
STRNEQ_NULLABLE
(
drv_name
,
usedby_drvname
)
||
if
(
STRNEQ_NULLABLE
(
drv_name
,
usedby_drvname
)
||
STRNEQ_NULLABLE
(
name
,
usedby_domname
))
{
STRNEQ_NULLABLE
(
dom_
name
,
usedby_domname
))
{
virPCIDeviceListDel
(
pcidevs
,
dev
);
virPCIDeviceListDel
(
pcidevs
,
dev
);
continue
;
continue
;
}
}
...
@@ -928,7 +928,7 @@ cleanup:
...
@@ -928,7 +928,7 @@ cleanup:
static
int
static
int
virHostdevMarkUsbHostdevs
(
virHostdevManagerPtr
mgr
,
virHostdevMarkUsbHostdevs
(
virHostdevManagerPtr
mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virUSBDeviceListPtr
list
)
virUSBDeviceListPtr
list
)
{
{
size_t
i
,
j
;
size_t
i
,
j
;
...
@@ -958,9 +958,10 @@ virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
...
@@ -958,9 +958,10 @@ virHostdevMarkUsbHostdevs(virHostdevManagerPtr mgr,
goto
error
;
goto
error
;
}
}
virUSBDeviceSetUsedBy
(
usb
,
drv_name
,
name
);
virUSBDeviceSetUsedBy
(
usb
,
drv_name
,
dom_
name
);
VIR_DEBUG
(
"Adding %03d.%03d dom=%s to activeUsbHostdevs"
,
VIR_DEBUG
(
"Adding %03d.%03d dom=%s to activeUsbHostdevs"
,
virUSBDeviceGetBus
(
usb
),
virUSBDeviceGetDevno
(
usb
),
name
);
virUSBDeviceGetBus
(
usb
),
virUSBDeviceGetDevno
(
usb
),
dom_name
);
/*
/*
* The caller is responsible to steal these usb devices
* The caller is responsible to steal these usb devices
* from the virUSBDeviceList that passed in on success,
* from the virUSBDeviceList that passed in on success,
...
@@ -1073,7 +1074,7 @@ out:
...
@@ -1073,7 +1074,7 @@ out:
int
int
virHostdevPrepareUSBDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevPrepareUSBDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
int
nhostdevs
,
unsigned
int
flags
)
unsigned
int
flags
)
...
@@ -1118,11 +1119,11 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
...
@@ -1118,11 +1119,11 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr,
}
}
}
}
/* Mark devices in temporary list as used by @name
/* Mark devices in temporary list as used by @
dom_
name
* and add them do driver list. However, if something goes
* and add them do driver list. However, if something goes
* wrong, perform rollback.
* wrong, perform rollback.
*/
*/
if
(
virHostdevMarkUsbHostdevs
(
hostdev_mgr
,
drv_name
,
name
,
list
)
<
0
)
if
(
virHostdevMarkUsbHostdevs
(
hostdev_mgr
,
drv_name
,
dom_
name
,
list
)
<
0
)
goto
cleanup
;
goto
cleanup
;
/* Loop 2: Temporary list was successfully merged with
/* Loop 2: Temporary list was successfully merged with
...
@@ -1144,7 +1145,7 @@ cleanup:
...
@@ -1144,7 +1145,7 @@ cleanup:
int
int
virHostdevPrepareSCSIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevPrepareSCSIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
)
int
nhostdevs
)
{
{
...
@@ -1214,10 +1215,10 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
...
@@ -1214,10 +1215,10 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
goto
error
;
goto
error
;
}
}
if
(
virSCSIDeviceSetUsedBy
(
tmp
,
drv_name
,
name
)
<
0
)
if
(
virSCSIDeviceSetUsedBy
(
tmp
,
drv_name
,
dom_
name
)
<
0
)
goto
error
;
goto
error
;
}
else
{
}
else
{
if
(
virSCSIDeviceSetUsedBy
(
scsi
,
drv_name
,
name
)
<
0
)
if
(
virSCSIDeviceSetUsedBy
(
scsi
,
drv_name
,
dom_
name
)
<
0
)
goto
error
;
goto
error
;
VIR_DEBUG
(
"Adding %s to activeScsiHostdevs"
,
virSCSIDeviceGetName
(
scsi
));
VIR_DEBUG
(
"Adding %s to activeScsiHostdevs"
,
virSCSIDeviceGetName
(
scsi
));
...
@@ -1255,7 +1256,7 @@ cleanup:
...
@@ -1255,7 +1256,7 @@ cleanup:
void
void
virHostdevReAttachUsbHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevReAttachUsbHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
)
int
nhostdevs
)
{
{
...
@@ -1283,7 +1284,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
...
@@ -1283,7 +1284,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
VIR_WARN
(
"Unable to reattach USB device %03d.%03d on domain %s"
,
VIR_WARN
(
"Unable to reattach USB device %03d.%03d on domain %s"
,
hostdev
->
source
.
subsys
.
u
.
usb
.
bus
,
hostdev
->
source
.
subsys
.
u
.
usb
.
bus
,
hostdev
->
source
.
subsys
.
u
.
usb
.
device
,
hostdev
->
source
.
subsys
.
u
.
usb
.
device
,
name
);
dom_
name
);
continue
;
continue
;
}
}
...
@@ -1306,11 +1307,11 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
...
@@ -1306,11 +1307,11 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
virUSBDeviceGetUsedBy
(
tmp
,
&
usedby_drvname
,
&
usedby_domname
);
virUSBDeviceGetUsedBy
(
tmp
,
&
usedby_drvname
,
&
usedby_domname
);
if
(
STREQ_NULLABLE
(
drv_name
,
usedby_drvname
)
&&
if
(
STREQ_NULLABLE
(
drv_name
,
usedby_drvname
)
&&
STREQ_NULLABLE
(
name
,
usedby_domname
))
{
STREQ_NULLABLE
(
dom_
name
,
usedby_domname
))
{
VIR_DEBUG
(
"Removing %03d.%03d dom=%s from activeUsbHostdevs"
,
VIR_DEBUG
(
"Removing %03d.%03d dom=%s from activeUsbHostdevs"
,
hostdev
->
source
.
subsys
.
u
.
usb
.
bus
,
hostdev
->
source
.
subsys
.
u
.
usb
.
bus
,
hostdev
->
source
.
subsys
.
u
.
usb
.
device
,
hostdev
->
source
.
subsys
.
u
.
usb
.
device
,
name
);
dom_
name
);
virUSBDeviceListDel
(
hostdev_mgr
->
activeUsbHostdevs
,
tmp
);
virUSBDeviceListDel
(
hostdev_mgr
->
activeUsbHostdevs
,
tmp
);
}
}
...
@@ -1321,7 +1322,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
...
@@ -1321,7 +1322,7 @@ virHostdevReAttachUsbHostdevs(virHostdevManagerPtr hostdev_mgr,
void
void
virHostdevReAttachScsiHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevReAttachScsiHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
)
int
nhostdevs
)
{
{
...
@@ -1349,7 +1350,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
...
@@ -1349,7 +1350,7 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
hostdev
->
source
.
subsys
.
u
.
scsi
.
bus
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
bus
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
target
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
target
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
unit
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
unit
,
name
);
dom_
name
);
continue
;
continue
;
}
}
...
@@ -1372,9 +1373,10 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
...
@@ -1372,9 +1373,10 @@ virHostdevReAttachScsiHostdevs(virHostdevManagerPtr hostdev_mgr,
hostdev
->
source
.
subsys
.
u
.
scsi
.
bus
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
bus
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
target
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
target
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
unit
,
hostdev
->
source
.
subsys
.
u
.
scsi
.
unit
,
name
);
dom_
name
);
virSCSIDeviceListDel
(
hostdev_mgr
->
activeScsiHostdevs
,
tmp
,
drv_name
,
name
);
virSCSIDeviceListDel
(
hostdev_mgr
->
activeScsiHostdevs
,
tmp
,
drv_name
,
dom_name
);
virSCSIDeviceFree
(
scsi
);
virSCSIDeviceFree
(
scsi
);
}
}
virObjectUnlock
(
hostdev_mgr
->
activeScsiHostdevs
);
virObjectUnlock
(
hostdev_mgr
->
activeScsiHostdevs
);
...
...
src/util/virhostdev.h
浏览文件 @
1c6ee84c
...
@@ -53,7 +53,7 @@ virHostdevManagerPtr virHostdevManagerGetDefault(void);
...
@@ -53,7 +53,7 @@ virHostdevManagerPtr virHostdevManagerGetDefault(void);
int
int
virHostdevPreparePCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevPreparePCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
const
unsigned
char
*
uuid
,
const
unsigned
char
*
uuid
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
int
nhostdevs
,
...
@@ -61,33 +61,33 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
...
@@ -61,33 +61,33 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr,
int
int
virHostdevPrepareUSBDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevPrepareUSBDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
int
nhostdevs
,
unsigned
int
flags
);
unsigned
int
flags
);
int
int
virHostdevPrepareSCSIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevPrepareSCSIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
);
int
nhostdevs
);
void
void
virHostdevReAttachPCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevReAttachPCIDevices
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
,
int
nhostdevs
,
char
*
oldStateDir
);
char
*
oldStateDir
);
void
void
virHostdevReAttachUsbHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevReAttachUsbHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
);
int
nhostdevs
);
void
void
virHostdevReAttachScsiHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
virHostdevReAttachScsiHostdevs
(
virHostdevManagerPtr
hostdev_mgr
,
const
char
*
drv_name
,
const
char
*
drv_name
,
const
char
*
name
,
const
char
*
dom_
name
,
virDomainHostdevDefPtr
*
hostdevs
,
virDomainHostdevDefPtr
*
hostdevs
,
int
nhostdevs
);
int
nhostdevs
);
int
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录