Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3e0552ee
Commit
3e0552ee
authored
Mar 31, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdth: switch to ->show_info()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
408bb25b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
170 deletions
+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
No files found.
drivers/scsi/gdth.c
View file @
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
View file @
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
View file @
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
View file @
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment