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
nexedi
linux
Commits
ee127fec
Commit
ee127fec
authored
Mar 31, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sym53c8xx_2: switch to ->show_info()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
0ffddfbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
94 deletions
+21
-94
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/scsi/sym53c8xx_2/sym_glue.c
+21
-94
No files found.
drivers/scsi/sym53c8xx_2/sym_glue.c
View file @
ee127fec
...
...
@@ -1171,112 +1171,36 @@ printk("sym_user_command: data=%ld\n", uc->data);
#endif
/* SYM_LINUX_USER_COMMAND_SUPPORT */
#ifdef SYM_LINUX_USER_INFO_SUPPORT
/*
* Informations through the proc file system.
*/
struct
info_str
{
char
*
buffer
;
int
length
;
int
offset
;
int
pos
;
};
static
void
copy_mem_info
(
struct
info_str
*
info
,
char
*
data
,
int
len
)
{
if
(
info
->
pos
+
len
>
info
->
length
)
len
=
info
->
length
-
info
->
pos
;
if
(
info
->
pos
+
len
<
info
->
offset
)
{
info
->
pos
+=
len
;
return
;
}
if
(
info
->
pos
<
info
->
offset
)
{
data
+=
(
info
->
offset
-
info
->
pos
);
len
-=
(
info
->
offset
-
info
->
pos
);
}
if
(
len
>
0
)
{
memcpy
(
info
->
buffer
+
info
->
pos
,
data
,
len
);
info
->
pos
+=
len
;
}
}
static
int
copy_info
(
struct
info_str
*
info
,
char
*
fmt
,
...)
{
va_list
args
;
char
buf
[
81
];
int
len
;
va_start
(
args
,
fmt
);
len
=
vsprintf
(
buf
,
fmt
,
args
);
va_end
(
args
);
copy_mem_info
(
info
,
buf
,
len
);
return
len
;
}
/*
* Copy formatted information into the input buffer.
*/
static
int
sym_
host_info
(
struct
Scsi_Host
*
shost
,
char
*
ptr
,
off_t
offset
,
int
len
)
static
int
sym_
show_info
(
struct
seq_file
*
m
,
struct
Scsi_Host
*
shost
)
{
#ifdef SYM_LINUX_USER_INFO_SUPPORT
struct
sym_data
*
sym_data
=
shost_priv
(
shost
);
struct
pci_dev
*
pdev
=
sym_data
->
pdev
;
struct
sym_hcb
*
np
=
sym_data
->
ncb
;
struct
info_str
info
;
info
.
buffer
=
ptr
;
info
.
length
=
len
;
info
.
offset
=
offset
;
info
.
pos
=
0
;
copy_info
(
&
info
,
"Chip "
NAME53C
"%s, device id 0x%x, "
"revision id 0x%x
\n
"
,
np
->
s
.
chip_name
,
pdev
->
device
,
pdev
->
revision
);
copy_info
(
&
info
,
"At PCI address %s, IRQ %u
\n
"
,
seq_printf
(
m
,
"Chip "
NAME53C
"%s, device id 0x%x, "
"revision id 0x%x
\n
"
,
np
->
s
.
chip_name
,
pdev
->
device
,
pdev
->
revision
);
seq_printf
(
m
,
"At PCI address %s, IRQ %u
\n
"
,
pci_name
(
pdev
),
pdev
->
irq
);
copy_info
(
&
info
,
"Min. period factor %d, %s SCSI BUS%s
\n
"
,
(
int
)
(
np
->
minsync_dt
?
np
->
minsync_dt
:
np
->
minsync
),
np
->
maxwide
?
"Wide"
:
"Narrow"
,
np
->
minsync_dt
?
", DT capable"
:
""
);
seq_printf
(
m
,
"Min. period factor %d, %s SCSI BUS%s
\n
"
,
(
int
)
(
np
->
minsync_dt
?
np
->
minsync_dt
:
np
->
minsync
),
np
->
maxwide
?
"Wide"
:
"Narrow"
,
np
->
minsync_dt
?
", DT capable"
:
""
);
copy_info
(
&
info
,
"Max. started commands %d, "
"max. commands per LUN %d
\n
"
,
SYM_CONF_MAX_START
,
SYM_CONF_MAX_TAG
);
seq_printf
(
m
,
"Max. started commands %d, "
"max. commands per LUN %d
\n
"
,
SYM_CONF_MAX_START
,
SYM_CONF_MAX_TAG
);
return
info
.
pos
>
info
.
offset
?
info
.
pos
-
info
.
offset
:
0
;
}
#endif
/* SYM_LINUX_USER_INFO_SUPPORT */
/*
* Entry point of the scsi proc fs of the driver.
* - func = 0 means read (returns adapter infos)
* - func = 1 means write (not yet merget from sym53c8xx)
*/
static
int
sym53c8xx_proc_info
(
struct
Scsi_Host
*
shost
,
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
,
int
func
)
{
int
retv
;
if
(
func
)
{
#ifdef SYM_LINUX_USER_COMMAND_SUPPORT
retv
=
sym_user_command
(
shost
,
buffer
,
length
);
#else
retv
=
-
EINVAL
;
#endif
}
else
{
if
(
start
)
*
start
=
buffer
;
#ifdef SYM_LINUX_USER_INFO_SUPPORT
retv
=
sym_host_info
(
shost
,
buffer
,
offset
,
length
);
return
0
;
#else
retv
=
-
EINVAL
;
#endif
}
return
retv
;
return
-
EINVAL
;
#endif
/* SYM_LINUX_USER_INFO_SUPPORT */
}
#endif
/* SYM_LINUX_PROC_INFO_SUPPORT */
/*
...
...
@@ -1742,7 +1666,10 @@ static struct scsi_host_template sym2_template = {
.
use_clustering
=
ENABLE_CLUSTERING
,
.
max_sectors
=
0xFFFF
,
#ifdef SYM_LINUX_PROC_INFO_SUPPORT
.
proc_info
=
sym53c8xx_proc_info
,
.
show_info
=
sym_show_info
,
#ifdef SYM_LINUX_USER_COMMAND_SUPPORT
.
write_info
=
sym_user_command
,
#endif
.
proc_name
=
NAME53C8XX
,
#endif
};
...
...
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