Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
3e0552ee
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3e0552ee
编写于
3月 31, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gdth: switch to ->show_info()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
408bb25b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
52 addition
and
170 deletion
+52
-170
drivers/scsi/gdth.c
drivers/scsi/gdth.c
+2
-1
drivers/scsi/gdth.h
drivers/scsi/gdth.h
+2
-1
drivers/scsi/gdth_proc.c
drivers/scsi/gdth_proc.c
+48
-163
drivers/scsi/gdth_proc.h
drivers/scsi/gdth_proc.h
+0
-5
未找到文件。
drivers/scsi/gdth.c
浏览文件 @
3e0552ee
...
...
@@ -4676,7 +4676,8 @@ static struct scsi_host_template gdth_template = {
.
eh_bus_reset_handler
=
gdth_eh_bus_reset
,
.
slave_configure
=
gdth_slave_configure
,
.
bios_param
=
gdth_bios_param
,
.
proc_info
=
gdth_proc_info
,
.
show_info
=
gdth_show_info
,
.
write_info
=
gdth_set_info
,
.
eh_timed_out
=
gdth_timed_out
,
.
proc_name
=
"gdth"
,
.
can_queue
=
GDTH_MAXCMDS
,
...
...
drivers/scsi/gdth.h
浏览文件 @
3e0552ee
...
...
@@ -1007,6 +1007,7 @@ typedef struct {
/* function prototyping */
int
gdth_proc_info
(
struct
Scsi_Host
*
,
char
*
,
char
**
,
off_t
,
int
,
int
);
int
gdth_show_info
(
struct
seq_file
*
,
struct
Scsi_Host
*
);
int
gdth_set_info
(
struct
Scsi_Host
*
,
char
*
,
int
);
#endif
drivers/scsi/gdth_proc.c
浏览文件 @
3e0552ee
...
...
@@ -5,23 +5,9 @@
#include <linux/completion.h>
#include <linux/slab.h>
int
gdth_proc_info
(
struct
Scsi_Host
*
host
,
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
int
inout
)
int
gdth_set_info
(
struct
Scsi_Host
*
host
,
char
*
buffer
,
int
length
)
{
gdth_ha_str
*
ha
=
shost_priv
(
host
);
TRACE2
((
"gdth_proc_info() length %d offs %d inout %d
\n
"
,
length
,(
int
)
offset
,
inout
));
if
(
inout
)
return
(
gdth_set_info
(
buffer
,
length
,
host
,
ha
));
else
return
(
gdth_get_info
(
buffer
,
start
,
offset
,
length
,
host
,
ha
));
}
static
int
gdth_set_info
(
char
*
buffer
,
int
length
,
struct
Scsi_Host
*
host
,
gdth_ha_str
*
ha
)
{
int
ret_val
=
-
EINVAL
;
TRACE2
((
"gdth_set_info() ha %d
\n
"
,
ha
->
hanum
,));
...
...
@@ -149,12 +135,10 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer,
return
(
-
EINVAL
);
}
static
int
gdth_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
struct
Scsi_Host
*
host
,
gdth_ha_str
*
ha
)
int
gdth_show_info
(
struct
seq_file
*
m
,
struct
Scsi_Host
*
host
)
{
int
size
=
0
,
len
=
0
;
gdth_ha_str
*
ha
=
shost_priv
(
host
)
;
int
hlen
;
off_t
begin
=
0
,
pos
=
0
;
int
id
,
i
,
j
,
k
,
sec
,
flag
;
int
no_mdrv
=
0
,
drv_no
,
is_mirr
;
u32
cnt
;
...
...
@@ -189,8 +173,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
/* request is i.e. "cat /proc/scsi/gdth/0" */
/* format: %-15s\t%-10s\t%-15s\t%s */
/* driver parameters */
size
=
sprintf
(
buffer
+
len
,
"Driver Parameters:
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
seq_printf
(
m
,
"Driver Parameters:
\n
"
);
if
(
reserve_list
[
0
]
==
0xff
)
strcpy
(
hrec
,
"--"
);
else
{
...
...
@@ -201,69 +184,50 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
hlen
+=
snprintf
(
hrec
+
hlen
,
161
-
hlen
,
",%d"
,
reserve_list
[
i
]);
}
}
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" reserve_mode:
\t
%d
\t
reserve_list:
\t
%s
\n
"
,
reserve_mode
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
size
=
sprintf
(
buffer
+
len
,
seq_printf
(
m
,
" max_ids:
\t
%-3d
\t
hdr_channel:
\t
%d
\n
"
,
max_ids
,
hdr_channel
);
len
+=
size
;
pos
=
begin
+
len
;
/* controller information */
size
=
sprintf
(
buffer
+
len
,
"
\n
Disk Array Controller Information:
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
strcpy
(
hrec
,
ha
->
binfo
.
type_string
);
size
=
sprintf
(
buffer
+
len
,
seq_printf
(
m
,
"
\n
Disk Array Controller Information:
\n
"
);
seq_printf
(
m
,
" Number:
\t
%d
\t
Name:
\t
%s
\n
"
,
ha
->
hanum
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
ha
->
hanum
,
ha
->
binfo
.
type_string
);
seq_printf
(
m
,
" Driver Ver.:
\t
%-10s
\t
Firmware Ver.:
\t
"
,
GDTH_VERSION_STR
);
if
(
ha
->
more_proc
)
s
printf
(
hrec
,
"%d.%02d.%02d-%c%03X
"
,
s
eq_printf
(
m
,
"%d.%02d.%02d-%c%03X
\n
"
,
(
u8
)(
ha
->
binfo
.
upd_fw_ver
>>
24
),
(
u8
)(
ha
->
binfo
.
upd_fw_ver
>>
16
),
(
u8
)(
ha
->
binfo
.
upd_fw_ver
),
ha
->
bfeat
.
raid
?
'R'
:
'N'
,
ha
->
binfo
.
upd_revision
);
else
s
printf
(
hrec
,
"%d.%02d
"
,
(
u8
)(
ha
->
cpar
.
version
>>
8
),
s
eq_printf
(
m
,
"%d.%02d
\n
"
,
(
u8
)(
ha
->
cpar
.
version
>>
8
),
(
u8
)(
ha
->
cpar
.
version
));
size
=
sprintf
(
buffer
+
len
,
" Driver Ver.:
\t
%-10s
\t
Firmware Ver.:
\t
%s
\n
"
,
GDTH_VERSION_STR
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
if
(
ha
->
more_proc
)
{
if
(
ha
->
more_proc
)
/* more information: 1. about controller */
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Serial No.:
\t
0x%8X
\t
Cache RAM size:
\t
%d KB
\n
"
,
ha
->
binfo
.
ser_no
,
ha
->
binfo
.
memsize
/
1024
);
len
+=
size
;
pos
=
begin
+
len
;
}
#ifdef GDTH_DMA_STATISTICS
/* controller statistics */
size
=
sprintf
(
buffer
+
len
,
"
\n
Controller Statistics:
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
size
=
sprintf
(
buffer
+
len
,
seq_printf
(
m
,
"
\n
Controller Statistics:
\n
"
);
seq_printf
(
m
,
" 32-bit DMA buffer:
\t
%lu
\t
64-bit DMA buffer:
\t
%lu
\n
"
,
ha
->
dma32_cnt
,
ha
->
dma64_cnt
);
len
+=
size
;
pos
=
begin
+
len
;
#endif
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
goto
stop_output
;
if
(
ha
->
more_proc
)
{
/* more information: 2. about physical devices */
size
=
sprintf
(
buffer
+
len
,
"
\n
Physical Devices:"
);
len
+=
size
;
pos
=
begin
+
len
;
seq_printf
(
m
,
"
\n
Physical Devices:"
);
flag
=
FALSE
;
buf
=
gdth_ioctl_alloc
(
ha
,
GDTH_SCRATCH
,
FALSE
,
&
paddr
);
...
...
@@ -309,21 +273,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
strncpy
(
hrec
+
8
,
pdi
->
product
,
16
);
strncpy
(
hrec
+
24
,
pdi
->
revision
,
4
);
hrec
[
28
]
=
0
;
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
"
\n
Chn/ID/LUN:
\t
%c/%02d/%d
\t
Name:
\t
%s
\n
"
,
'A'
+
i
,
pdi
->
target_id
,
pdi
->
lun
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
flag
=
TRUE
;
pdi
->
no_ldrive
&=
0xffff
;
if
(
pdi
->
no_ldrive
==
0xffff
)
strcpy
(
hrec
,
"--"
);
else
sprintf
(
hrec
,
"%d"
,
pdi
->
no_ldrive
);
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Capacity [MB]:
\t
%-6d
\t
To Log. Drive:
\t
%s
\n
"
,
pdi
->
blkcnt
/
(
1024
*
1024
/
pdi
->
blksize
),
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
}
else
{
pdi
->
devtype
=
0xff
;
}
...
...
@@ -333,11 +295,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
for
(
k
=
0
;
k
<
pds
->
count
;
++
k
)
{
if
(
pds
->
list
[
k
].
tid
==
pdi
->
target_id
&&
pds
->
list
[
k
].
lun
==
pdi
->
lun
)
{
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Retries:
\t
%-6d
\t
Reassigns:
\t
%d
\n
"
,
pds
->
list
[
k
].
retries
,
pds
->
list
[
k
].
reassigns
);
len
+=
size
;
pos
=
begin
+
len
;
break
;
}
}
...
...
@@ -355,32 +316,20 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
pdef
->
sddc_type
=
0x08
;
if
(
gdth_execute
(
host
,
gdtcmd
,
cmnd
,
30
,
NULL
)
==
S_OK
)
{
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Grown Defects:
\t
%d
\n
"
,
pdef
->
sddc_cnt
);
len
+=
size
;
pos
=
begin
+
len
;
}
}
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
{
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
goto
stop_output
;
}
}
}
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
if
(
!
flag
)
{
size
=
sprintf
(
buffer
+
len
,
"
\n
--
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
}
if
(
!
flag
)
seq_printf
(
m
,
"
\n
--
\n
"
);
/* 3. about logical drives */
size
=
sprintf
(
buffer
+
len
,
"
\n
Logical Drives:"
);
len
+=
size
;
pos
=
begin
+
len
;
seq_printf
(
m
,
"
\n
Logical Drives:"
);
flag
=
FALSE
;
buf
=
gdth_ioctl_alloc
(
ha
,
GDTH_SCRATCH
,
FALSE
,
&
paddr
);
...
...
@@ -418,10 +367,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
}
if
(
drv_no
==
i
)
{
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
"
\n
Number:
\t
%-2d
\t
Status:
\t
%s
\n
"
,
drv_no
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
flag
=
TRUE
;
no_mdrv
=
pcdi
->
cd_ldcnt
;
if
(
no_mdrv
>
1
||
pcdi
->
ld_slave
!=
-
1
)
{
...
...
@@ -436,61 +384,37 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
}
else
{
strcpy
(
hrec
,
"???"
);
}
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Capacity [MB]:
\t
%-6d
\t
Type:
\t
%s
\n
"
,
pcdi
->
ld_blkcnt
/
(
1024
*
1024
/
pcdi
->
ld_blksize
),
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
}
else
{
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Slave Number:
\t
%-2d
\t
Status:
\t
%s
\n
"
,
drv_no
&
0x7fff
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
}
drv_no
=
pcdi
->
ld_slave
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
{
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
goto
stop_output
;
}
}
while
(
drv_no
!=
-
1
);
if
(
is_mirr
)
{
s
ize
=
sprintf
(
buffer
+
len
,
if
(
is_mirr
)
s
eq_printf
(
m
,
" Missing Drv.:
\t
%-2d
\t
Invalid Drv.:
\t
%d
\n
"
,
no_mdrv
-
j
-
k
,
k
);
len
+=
size
;
pos
=
begin
+
len
;
}
if
(
!
ha
->
hdr
[
i
].
is_arraydrv
)
strcpy
(
hrec
,
"--"
);
else
sprintf
(
hrec
,
"%d"
,
ha
->
hdr
[
i
].
master_no
);
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" To Array Drv.:
\t
%s
\n
"
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
{
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
goto
stop_output
;
}
}
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
if
(
!
flag
)
{
size
=
sprintf
(
buffer
+
len
,
"
\n
--
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
}
if
(
!
flag
)
seq_printf
(
m
,
"
\n
--
\n
"
);
/* 4. about array drives */
size
=
sprintf
(
buffer
+
len
,
"
\n
Array Drives:"
);
len
+=
size
;
pos
=
begin
+
len
;
seq_printf
(
m
,
"
\n
Array Drives:"
);
flag
=
FALSE
;
buf
=
gdth_ioctl_alloc
(
ha
,
GDTH_SCRATCH
,
FALSE
,
&
paddr
);
...
...
@@ -525,10 +449,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
strcat
(
hrec
,
"/expand"
);
else
if
(
pai
->
ai_ext_state
&
0x1
)
strcat
(
hrec
,
"/patch"
);
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
"
\n
Number:
\t
%-2d
\t
Status:
\t
%s
\n
"
,
i
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
flag
=
TRUE
;
if
(
pai
->
ai_type
==
0
)
...
...
@@ -539,31 +462,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
strcpy
(
hrec
,
"RAID-5"
);
else
strcpy
(
hrec
,
"RAID-10"
);
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Capacity [MB]:
\t
%-6d
\t
Type:
\t
%s
\n
"
,
pai
->
ai_size
/
(
1024
*
1024
/
pai
->
ai_secsize
),
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
{
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
goto
stop_output
;
}
}
}
gdth_ioctl_free
(
ha
,
GDTH_SCRATCH
,
buf
,
paddr
);
if
(
!
flag
)
{
size
=
sprintf
(
buffer
+
len
,
"
\n
--
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
}
if
(
!
flag
)
seq_printf
(
m
,
"
\n
--
\n
"
);
/* 5. about host drives */
size
=
sprintf
(
buffer
+
len
,
"
\n
Host Drives:"
);
len
+=
size
;
pos
=
begin
+
len
;
seq_printf
(
m
,
"
\n
Host Drives:"
);
flag
=
FALSE
;
buf
=
gdth_ioctl_alloc
(
ha
,
sizeof
(
gdth_hget_str
),
FALSE
,
&
paddr
);
...
...
@@ -605,33 +516,22 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
if
(
!
(
ha
->
hdr
[
i
].
present
))
continue
;
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
"
\n
Number:
\t
%-2d
\t
Arr/Log. Drive:
\t
%d
\n
"
,
i
,
ha
->
hdr
[
i
].
ldr_no
);
len
+=
size
;
pos
=
begin
+
len
;
flag
=
TRUE
;
s
ize
=
sprintf
(
buffer
+
len
,
s
eq_printf
(
m
,
" Capacity [MB]:
\t
%-6d
\t
Start Sector:
\t
%d
\n
"
,
(
u32
)(
ha
->
hdr
[
i
].
size
/
2048
),
ha
->
hdr
[
i
].
start_sec
);
len
+=
size
;
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
goto
stop_output
;
}
if
(
!
flag
)
{
size
=
sprintf
(
buffer
+
len
,
"
\n
--
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
}
if
(
!
flag
)
seq_printf
(
m
,
"
\n
--
\n
"
);
}
/* controller events */
size
=
sprintf
(
buffer
+
len
,
"
\n
Controller Events:
\n
"
);
len
+=
size
;
pos
=
begin
+
len
;
seq_printf
(
m
,
"
\n
Controller Events:
\n
"
);
for
(
id
=
-
1
;;)
{
id
=
gdth_read_event
(
ha
,
id
,
estr
);
...
...
@@ -643,29 +543,14 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length,
do_gettimeofday
(
&
tv
);
sec
=
(
int
)(
tv
.
tv_sec
-
estr
->
first_stamp
);
if
(
sec
<
0
)
sec
=
0
;
s
ize
=
sprintf
(
buffer
+
len
,
" date- %02d:%02d:%02d
\t
%s
\n
"
,
s
eq_printf
(
m
,
" date- %02d:%02d:%02d
\t
%s
\n
"
,
sec
/
3600
,
sec
%
3600
/
60
,
sec
%
60
,
hrec
);
len
+=
size
;
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
goto
stop_output
;
}
if
(
id
==
-
1
)
break
;
}
stop_output:
*
start
=
buffer
+
(
offset
-
begin
);
len
-=
(
offset
-
begin
);
if
(
len
>
length
)
len
=
length
;
TRACE2
((
"get_info() len %d pos %d begin %d offset %d length %d size %d
\n
"
,
len
,(
int
)
pos
,(
int
)
begin
,(
int
)
offset
,
length
,
size
));
rc
=
len
;
rc
=
0
;
free_fail:
kfree
(
gdtcmd
);
kfree
(
estr
);
...
...
drivers/scsi/gdth_proc.h
浏览文件 @
3e0552ee
...
...
@@ -8,11 +8,6 @@
int
gdth_execute
(
struct
Scsi_Host
*
shost
,
gdth_cmd_str
*
gdtcmd
,
char
*
cmnd
,
int
timeout
,
u32
*
info
);
static
int
gdth_set_info
(
char
*
buffer
,
int
length
,
struct
Scsi_Host
*
host
,
gdth_ha_str
*
ha
);
static
int
gdth_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
struct
Scsi_Host
*
host
,
gdth_ha_str
*
ha
);
static
int
gdth_set_asc_info
(
struct
Scsi_Host
*
host
,
char
*
buffer
,
int
length
,
gdth_ha_str
*
ha
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录