Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
10427db7
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
10427db7
编写于
6月 03, 2016
作者:
J
Ján Tomko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Only return two values in udevGetUintProperty
We only care about the failure, not a missing property.
上级
71402ef6
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
18 addition
and
42 deletion
+18
-42
src/node_device/node_device_udev.c
src/node_device/node_device_udev.c
+18
-42
未找到文件。
src/node_device/node_device_udev.c
浏览文件 @
10427db7
...
...
@@ -106,9 +106,9 @@ static int udevGetIntProperty(struct udev_device *udev_device,
if
(
str
&&
virStrToLong_i
(
str
,
NULL
,
base
,
value
)
<
0
)
{
VIR_ERROR
(
_
(
"Failed to convert '%s' to int"
),
str
);
return
PROPERTY_ERROR
;
return
-
1
;
}
return
str
==
NULL
?
PROPERTY_MISSING
:
PROPERTY_FOUND
;
return
0
;
}
...
...
@@ -123,9 +123,9 @@ static int udevGetUintProperty(struct udev_device *udev_device,
if
(
str
&&
virStrToLong_ui
(
str
,
NULL
,
base
,
value
)
<
0
)
{
VIR_ERROR
(
_
(
"Failed to convert '%s' to int"
),
str
);
return
PROPERTY_ERROR
;
return
-
1
;
}
return
str
==
NULL
?
PROPERTY_MISSING
:
PROPERTY_FOUND
;
return
0
;
}
...
...
@@ -366,12 +366,8 @@ static int udevProcessPCI(struct udev_device *device,
syspath
=
udev_device_get_syspath
(
device
);
if
(
udevGetUintProperty
(
device
,
"PCI_CLASS"
,
&
data
->
pci_dev
.
class
,
16
)
==
PROPERTY_ERROR
)
{
if
(
udevGetUintProperty
(
device
,
"PCI_CLASS"
,
&
data
->
pci_dev
.
class
,
16
)
<
0
)
goto
out
;
}
if
((
p
=
strrchr
(
syspath
,
'/'
))
==
NULL
||
virStrToLong_ui
(
p
+
1
,
&
p
,
16
,
&
data
->
pci_dev
.
domain
)
<
0
||
p
==
NULL
||
...
...
@@ -474,26 +470,12 @@ static int udevProcessUSBDevice(struct udev_device *device,
virNodeDevCapDataPtr
data
=
&
def
->
caps
->
data
;
int
ret
=
-
1
;
if
(
udevGetUintProperty
(
device
,
"BUSNUM"
,
&
data
->
usb_dev
.
bus
,
10
)
==
PROPERTY_ERROR
)
{
if
(
udevGetUintProperty
(
device
,
"BUSNUM"
,
&
data
->
usb_dev
.
bus
,
10
)
<
0
)
goto
out
;
}
if
(
udevGetUintProperty
(
device
,
"DEVNUM"
,
&
data
->
usb_dev
.
device
,
10
)
==
PROPERTY_ERROR
)
{
if
(
udevGetUintProperty
(
device
,
"DEVNUM"
,
&
data
->
usb_dev
.
device
,
10
)
<
0
)
goto
out
;
}
if
(
udevGetUintProperty
(
device
,
"ID_VENDOR_ID"
,
&
data
->
usb_dev
.
vendor
,
16
)
==
PROPERTY_ERROR
)
{
if
(
udevGetUintProperty
(
device
,
"ID_VENDOR_ID"
,
&
data
->
usb_dev
.
vendor
,
16
)
<
0
)
goto
out
;
}
if
(
udevGetStringProperty
(
device
,
"ID_VENDOR_FROM_DATABASE"
,
...
...
@@ -506,12 +488,8 @@ static int udevProcessUSBDevice(struct udev_device *device,
&
data
->
usb_dev
.
vendor_name
)
==
PROPERTY_ERROR
)
goto
out
;
if
(
udevGetUintProperty
(
device
,
"ID_MODEL_ID"
,
&
data
->
usb_dev
.
product
,
16
)
==
PROPERTY_ERROR
)
{
if
(
udevGetUintProperty
(
device
,
"ID_MODEL_ID"
,
&
data
->
usb_dev
.
product
,
16
)
<
0
)
goto
out
;
}
if
(
udevGetStringProperty
(
device
,
"ID_MODEL_FROM_DATABASE"
,
...
...
@@ -859,7 +837,6 @@ static int udevProcessCDROM(struct udev_device *device,
virNodeDeviceDefPtr
def
)
{
int
ret
=
-
1
;
int
tmp_int
=
0
;
int
has_media
=
0
;
/* NB: the drive_type string provided by udev is different from
...
...
@@ -870,9 +847,9 @@ static int udevProcessCDROM(struct udev_device *device,
if
(
VIR_STRDUP
(
def
->
caps
->
data
.
storage
.
drive_type
,
"cdrom"
)
<
0
)
goto
out
;
if
(
(
udevGetIntProperty
(
device
,
"ID_CDROM_MEDIA"
,
&
tmp_int
,
0
)
==
PROPERTY_FOUND
)
)
has_media
=
tmp_in
t
;
if
(
udevHasDeviceProperty
(
device
,
"ID_CDROM_MEDIA"
)
&&
udevGetIntProperty
(
device
,
"ID_CDROM_MEDIA"
,
&
has_media
,
0
)
<
0
)
goto
ou
t
;
ret
=
udevProcessRemoveableMedia
(
device
,
def
,
has_media
);
out:
...
...
@@ -882,13 +859,12 @@ static int udevProcessCDROM(struct udev_device *device,
static
int
udevProcessFloppy
(
struct
udev_device
*
device
,
virNodeDeviceDefPtr
def
)
{
int
tmp_int
=
0
;
int
has_media
=
0
;
if
((
udevGetIntProperty
(
device
,
"DKD_MEDIA_AVAILABLE"
,
&
tmp_int
,
0
)
==
PROPERTY_FOUND
))
{
if
(
udevHasDeviceProperty
(
device
,
"ID_CDROM_MEDIA"
))
{
/* USB floppy */
has_media
=
tmp_int
;
if
(
udevGetIntProperty
(
device
,
"DKD_MEDIA_AVAILABLE"
,
&
has_media
,
0
)
<
0
)
return
-
1
;
}
else
if
(
udevHasDeviceProperty
(
device
,
"ID_FS_LABEL"
))
{
/* Legacy floppy */
has_media
=
1
;
...
...
@@ -1013,20 +989,20 @@ static int udevProcessStorage(struct udev_device *device,
/* All floppy drives have the ID_DRIVE_FLOPPY prop. This is
* needed since legacy floppies don't have a drive_type */
if
(
udevGetIntProperty
(
device
,
"ID_DRIVE_FLOPPY"
,
&
val
,
0
)
==
PROPERTY_ERROR
)
if
(
udevGetIntProperty
(
device
,
"ID_DRIVE_FLOPPY"
,
&
val
,
0
)
<
0
)
goto
out
;
else
if
(
val
==
1
)
str
=
"floppy"
;
if
(
!
str
)
{
if
(
udevGetIntProperty
(
device
,
"ID_CDROM"
,
&
val
,
0
)
==
PROPERTY_ERROR
)
if
(
udevGetIntProperty
(
device
,
"ID_CDROM"
,
&
val
,
0
)
<
0
)
goto
out
;
else
if
(
val
==
1
)
str
=
"cd"
;
}
if
(
!
str
)
{
if
(
udevGetIntProperty
(
device
,
"ID_DRIVE_FLASH_SD"
,
&
val
,
0
)
==
PROPERTY_ERROR
)
if
(
udevGetIntProperty
(
device
,
"ID_DRIVE_FLASH_SD"
,
&
val
,
0
)
<
0
)
goto
out
;
if
(
val
==
1
)
str
=
"sd"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录