Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
3935bb94
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3935bb94
编写于
5月 20, 2011
作者:
T
Tony Luck
浏览文件
操作
浏览文件
下载
差异文件
Pull pstore into release branch
上级
61c4f2c8
5d2a8342
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
58 addition
and
20 deletion
+58
-20
drivers/acpi/apei/Kconfig
drivers/acpi/apei/Kconfig
+1
-0
drivers/acpi/apei/erst.c
drivers/acpi/apei/erst.c
+45
-16
fs/pstore/platform.c
fs/pstore/platform.c
+9
-3
include/linux/pstore.h
include/linux/pstore.h
+3
-1
未找到文件。
drivers/acpi/apei/Kconfig
浏览文件 @
3935bb94
config ACPI_APEI
bool "ACPI Platform Error Interface (APEI)"
select MISC_FILESYSTEMS
select PSTORE
depends on X86
help
...
...
drivers/acpi/apei/erst.c
浏览文件 @
3935bb94
...
...
@@ -929,13 +929,17 @@ static int erst_check_table(struct acpi_table_erst *erst_tab)
return
0
;
}
static
size_t
erst_reader
(
u64
*
id
,
enum
pstore_type_id
*
type
,
static
int
erst_open_pstore
(
struct
pstore_info
*
psi
);
static
int
erst_close_pstore
(
struct
pstore_info
*
psi
);
static
ssize_t
erst_reader
(
u64
*
id
,
enum
pstore_type_id
*
type
,
struct
timespec
*
time
);
static
u64
erst_writer
(
enum
pstore_type_id
type
,
size_t
size
);
static
struct
pstore_info
erst_info
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"erst"
,
.
open
=
erst_open_pstore
,
.
close
=
erst_close_pstore
,
.
read
=
erst_reader
,
.
write
=
erst_writer
,
.
erase
=
erst_clear
...
...
@@ -957,12 +961,32 @@ struct cper_pstore_record {
char
data
[];
}
__packed
;
static
size_t
erst_reader
(
u64
*
id
,
enum
pstore_type_id
*
type
,
static
int
reader_pos
;
static
int
erst_open_pstore
(
struct
pstore_info
*
psi
)
{
int
rc
;
if
(
erst_disable
)
return
-
ENODEV
;
rc
=
erst_get_record_id_begin
(
&
reader_pos
);
return
rc
;
}
static
int
erst_close_pstore
(
struct
pstore_info
*
psi
)
{
erst_get_record_id_end
();
return
0
;
}
static
ssize_t
erst_reader
(
u64
*
id
,
enum
pstore_type_id
*
type
,
struct
timespec
*
time
)
{
int
rc
;
ssize_t
len
;
unsigned
long
flags
;
ssize_t
len
=
0
;
u64
record_id
;
struct
cper_pstore_record
*
rcd
=
(
struct
cper_pstore_record
*
)
(
erst_info
.
buf
-
sizeof
(
*
rcd
));
...
...
@@ -970,24 +994,28 @@ static size_t erst_reader(u64 *id, enum pstore_type_id *type,
if
(
erst_disable
)
return
-
ENODEV
;
raw_spin_lock_irqsave
(
&
erst_lock
,
flags
);
skip:
rc
=
__erst_get_next_record_id
(
&
record_id
);
if
(
rc
)
{
raw_spin_unlock_irqrestore
(
&
erst_lock
,
flags
);
return
rc
;
}
rc
=
erst_get_record_id_next
(
&
reader_pos
,
&
record_id
);
if
(
rc
)
goto
out
;
/* no more record */
if
(
record_id
==
APEI_ERST_INVALID_RECORD_ID
)
{
r
aw_spin_unlock_irqrestore
(
&
erst_lock
,
flags
)
;
return
0
;
r
c
=
-
1
;
goto
out
;
}
len
=
__erst_read
(
record_id
,
&
rcd
->
hdr
,
sizeof
(
*
rcd
)
+
erst_erange
.
size
);
len
=
erst_read
(
record_id
,
&
rcd
->
hdr
,
sizeof
(
*
rcd
)
+
erst_info
.
bufsize
);
/* The record may be cleared by others, try read next record */
if
(
len
==
-
ENOENT
)
goto
skip
;
else
if
(
len
<
0
)
{
rc
=
-
1
;
goto
out
;
}
if
(
uuid_le_cmp
(
rcd
->
hdr
.
creator_id
,
CPER_CREATOR_PSTORE
)
!=
0
)
goto
skip
;
raw_spin_unlock_irqrestore
(
&
erst_lock
,
flags
);
*
id
=
record_id
;
if
(
uuid_le_cmp
(
rcd
->
sec_hdr
.
section_type
,
...
...
@@ -1005,7 +1033,8 @@ static size_t erst_reader(u64 *id, enum pstore_type_id *type,
time
->
tv_sec
=
0
;
time
->
tv_nsec
=
0
;
return
len
-
sizeof
(
*
rcd
);
out:
return
(
rc
<
0
)
?
rc
:
(
len
-
sizeof
(
*
rcd
));
}
static
u64
erst_writer
(
enum
pstore_type_id
type
,
size_t
size
)
...
...
fs/pstore/platform.c
浏览文件 @
3935bb94
...
...
@@ -152,21 +152,27 @@ EXPORT_SYMBOL_GPL(pstore_register);
void
pstore_get_records
(
void
)
{
struct
pstore_info
*
psi
=
psinfo
;
size_t
size
;
s
s
ize_t
size
;
u64
id
;
enum
pstore_type_id
type
;
struct
timespec
time
;
int
failed
=
0
;
int
failed
=
0
,
rc
;
if
(
!
psi
)
return
;
mutex_lock
(
&
psinfo
->
buf_mutex
);
rc
=
psi
->
open
(
psi
);
if
(
rc
)
goto
out
;
while
((
size
=
psi
->
read
(
&
id
,
&
type
,
&
time
))
>
0
)
{
if
(
pstore_mkfile
(
type
,
psi
->
name
,
id
,
psi
->
buf
,
size
,
if
(
pstore_mkfile
(
type
,
psi
->
name
,
id
,
psi
->
buf
,
(
size_t
)
size
,
time
,
psi
->
erase
))
failed
++
;
}
psi
->
close
(
psi
);
out:
mutex_unlock
(
&
psinfo
->
buf_mutex
);
if
(
failed
)
...
...
include/linux/pstore.h
浏览文件 @
3935bb94
...
...
@@ -35,7 +35,9 @@ struct pstore_info {
struct
mutex
buf_mutex
;
/* serialize access to 'buf' */
char
*
buf
;
size_t
bufsize
;
size_t
(
*
read
)(
u64
*
id
,
enum
pstore_type_id
*
type
,
int
(
*
open
)(
struct
pstore_info
*
psi
);
int
(
*
close
)(
struct
pstore_info
*
psi
);
ssize_t
(
*
read
)(
u64
*
id
,
enum
pstore_type_id
*
type
,
struct
timespec
*
time
);
u64
(
*
write
)(
enum
pstore_type_id
type
,
size_t
size
);
int
(
*
erase
)(
u64
id
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录