Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
e545806d
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看板
提交
e545806d
编写于
6月 03, 2016
作者:
J
Ján Tomko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Only return two values in udevGetStringSysfsAttr
The callers only care for an error, and a missing attribute is simply NULL.
上级
470498de
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
54 deletion
+24
-54
src/node_device/node_device_udev.c
src/node_device/node_device_udev.c
+24
-54
未找到文件。
src/node_device/node_device_udev.c
浏览文件 @
e545806d
...
...
@@ -149,14 +149,14 @@ static int udevGetStringSysfsAttr(struct udev_device *udev_device,
char
**
value
)
{
if
(
VIR_STRDUP
(
*
value
,
udevGetDeviceSysfsAttr
(
udev_device
,
attr_name
))
<
0
)
return
PROPERTY_ERROR
;
return
-
1
;
virStringStripControlChars
(
*
value
);
if
(
*
value
!=
NULL
&&
(
STREQ
(
*
value
,
""
)))
VIR_FREE
(
*
value
);
return
*
value
==
NULL
?
PROPERTY_MISSING
:
PROPERTY_FOUND
;
return
0
;
}
...
...
@@ -443,9 +443,8 @@ static int udevProcessUSBDevice(struct udev_device *device,
goto
out
;
if
(
!
data
->
usb_dev
.
vendor_name
&&
udevGetStringSysfsAttr
(
device
,
"manufacturer"
,
&
data
->
usb_dev
.
vendor_name
)
==
PROPERTY_ERROR
)
udevGetStringSysfsAttr
(
device
,
"manufacturer"
,
&
data
->
usb_dev
.
vendor_name
)
<
0
)
goto
out
;
if
(
udevGetUintProperty
(
device
,
"ID_MODEL_ID"
,
&
data
->
usb_dev
.
product
,
16
)
<
0
)
...
...
@@ -457,9 +456,8 @@ static int udevProcessUSBDevice(struct udev_device *device,
goto
out
;
if
(
!
data
->
usb_dev
.
product_name
&&
udevGetStringSysfsAttr
(
device
,
"product"
,
&
data
->
usb_dev
.
product_name
)
==
PROPERTY_ERROR
)
udevGetStringSysfsAttr
(
device
,
"product"
,
&
data
->
usb_dev
.
product_name
)
<
0
)
goto
out
;
if
(
udevGenerateDeviceName
(
device
,
def
,
NULL
)
!=
0
)
...
...
@@ -534,11 +532,9 @@ static int udevProcessNetworkInterface(struct udev_device *device,
&
data
->
net
.
ifname
)
<
0
)
goto
out
;
if
(
udevGetStringSysfsAttr
(
device
,
"address"
,
&
data
->
net
.
address
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"address"
,
&
data
->
net
.
address
)
<
0
)
goto
out
;
}
if
(
udevGetUintSysfsAttr
(
device
,
"addr_len"
,
...
...
@@ -922,17 +918,11 @@ static int udevProcessStorage(struct udev_device *device,
if
(
udevGetStringProperty
(
device
,
"ID_SERIAL"
,
&
data
->
storage
.
serial
)
<
0
)
goto
out
;
if
(
udevGetStringSysfsAttr
(
device
,
"device/vendor"
,
&
data
->
storage
.
vendor
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"device/vendor"
,
&
data
->
storage
.
vendor
)
<
0
)
goto
out
;
}
udevStripSpaces
(
def
->
caps
->
data
.
storage
.
vendor
);
if
(
udevGetStringSysfsAttr
(
device
,
"device/model"
,
&
data
->
storage
.
model
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"device/model"
,
&
data
->
storage
.
model
)
<
0
)
goto
out
;
}
udevStripSpaces
(
def
->
caps
->
data
.
storage
.
model
);
/* There is no equivalent of the hotpluggable property in libudev,
* but storage is going toward a world in which hotpluggable is
...
...
@@ -1403,51 +1393,31 @@ udevGetDMIData(virNodeDevCapDataPtr data)
}
}
if
(
udevGetStringSysfsAttr
(
device
,
"product_name"
,
&
data
->
system
.
product_name
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"product_name"
,
&
data
->
system
.
product_name
)
<
0
)
goto
out
;
}
if
(
udevGetStringSysfsAttr
(
device
,
"sys_vendor"
,
&
data
->
system
.
hardware
.
vendor_name
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"sys_vendor"
,
&
data
->
system
.
hardware
.
vendor_name
)
<
0
)
goto
out
;
}
if
(
udevGetStringSysfsAttr
(
device
,
"product_version"
,
&
data
->
system
.
hardware
.
version
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"product_version"
,
&
data
->
system
.
hardware
.
version
)
<
0
)
goto
out
;
}
if
(
udevGetStringSysfsAttr
(
device
,
"product_serial"
,
&
data
->
system
.
hardware
.
serial
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"product_serial"
,
&
data
->
system
.
hardware
.
serial
)
<
0
)
goto
out
;
}
if
(
virGetHostUUID
(
data
->
system
.
hardware
.
uuid
))
goto
out
;
if
(
udevGetStringSysfsAttr
(
device
,
"bios_vendor"
,
&
data
->
system
.
firmware
.
vendor_name
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"bios_vendor"
,
&
data
->
system
.
firmware
.
vendor_name
)
<
0
)
goto
out
;
}
if
(
udevGetStringSysfsAttr
(
device
,
"bios_version"
,
&
data
->
system
.
firmware
.
version
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"bios_version"
,
&
data
->
system
.
firmware
.
version
)
<
0
)
goto
out
;
}
if
(
udevGetStringSysfsAttr
(
device
,
"bios_date"
,
&
data
->
system
.
firmware
.
release_date
)
==
PROPERTY_ERROR
)
{
if
(
udevGetStringSysfsAttr
(
device
,
"bios_date"
,
&
data
->
system
.
firmware
.
release_date
)
<
0
)
goto
out
;
}
out:
if
(
device
!=
NULL
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录