Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha - Software
Commits
ae601b1a
Commit
ae601b1a
authored
Mar 20, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: add optional tracing of open/close
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
eb8e9d95
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
fdelay-init.c
lib/fdelay-init.c
+12
-4
No files found.
lib/fdelay-init.c
View file @
ae601b1a
...
...
@@ -122,17 +122,20 @@ void fdelay_exit(void)
}
/* Open one specific device. -1 arguments mean "not installed" */
struct
fdelay_board
*
fdelay_open
(
int
offset
,
int
dev_id
)
struct
fdelay_board
*
fdelay_open
(
int
index
,
int
dev_id
)
{
struct
__fdelay_board
*
b
=
NULL
;
int
i
;
if
(
offset
>=
fd_nboards
)
{
if
(
fdelay_is_verbose
())
fprintf
(
stderr
,
"called: %s(index %i, dev_id 0x%x);
\n
"
,
__func__
,
index
,
dev_id
);
if
(
index
>=
fd_nboards
)
{
errno
=
ENODEV
;
return
NULL
;
}
if
(
offset
>=
0
)
{
b
=
fd_boards
+
offset
;
if
(
index
>=
0
)
{
b
=
fd_boards
+
index
;
if
(
dev_id
>=
0
&&
dev_id
!=
b
->
dev_id
)
{
errno
=
EINVAL
;
return
NULL
;
...
...
@@ -166,6 +169,8 @@ struct fdelay_board *fdelay_open_by_lun(int lun)
char
path
[
sizeof
(
path_pattern
)
+
1
];
int
dev_id
;
if
(
fdelay_is_verbose
())
fprintf
(
stderr
,
"called: %s(lun %i);
\n
"
,
__func__
,
lun
);
ret
=
snprintf
(
path
,
sizeof
(
path
),
path_pattern
,
lun
);
if
(
ret
<
0
||
ret
>=
sizeof
(
path
))
{
errno
=
EINVAL
;
...
...
@@ -184,6 +189,9 @@ int fdelay_close(struct fdelay_board *userb)
__define_board
(
b
,
userb
);
int
j
;
if
(
fdelay_is_verbose
())
fprintf
(
stderr
,
"called: %s(index %i, dev_id 0x%x);
\n
"
,
__func__
,
b
-
fd_boards
,
b
->
dev_id
);
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
b
->
fdc
);
j
++
)
{
if
(
b
->
fdc
[
j
]
>=
0
)
close
(
b
->
fdc
[
j
]);
...
...
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