Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FPGA Configuration Space
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
FPGA Configuration Space
Commits
506e2d6d
Commit
506e2d6d
authored
May 02, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdb-extract: support non-mmappable file (i.e. sysfs)
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
b383ccdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
sdb-extract.c
sdbfs/userspace/sdb-extract.c
+14
-4
No files found.
sdbfs/userspace/sdb-extract.c
View file @
506e2d6d
...
...
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
void
*
mapaddr
;
char
*
fsname
,
*
dirname
;
struct
dirent
**
namelist
;
int
pagesize
=
getpagesize
();
int
i
,
pagesize
=
getpagesize
();
prgname
=
argv
[
0
];
...
...
@@ -127,9 +127,19 @@ int main(int argc, char **argv)
stbuf
.
st_size
&=
~
(
pagesize
-
1
);
mapaddr
=
mmap
(
0
,
stbuf
.
st_size
,
PROT_READ
,
MAP_PRIVATE
,
fileno
(
f
),
0
);
if
(
mapaddr
==
MAP_FAILED
)
{
fprintf
(
stderr
,
"%s: mmap(%s): %s
\n
"
,
prgname
,
fsname
,
strerror
(
errno
));
exit
(
1
);
/* I used to complain, but sysfs doesn't allow mmapping... */
mapaddr
=
malloc
(
stbuf
.
st_size
);
if
(
!
mapaddr
)
{
fprintf
(
stderr
,
"%s: out of memory reading
\"
%s
\"\n
"
,
argv
[
0
],
fsname
);
exit
(
1
);
}
i
=
fread
(
mapaddr
,
1
,
stbuf
.
st_size
,
f
);
if
(
i
<
stbuf
.
st_size
)
{
fprintf
(
stderr
,
"%s: %s: short read
\n
"
,
argv
[
0
],
fsname
);
exit
(
1
);
}
}
/* Check output dir is empty, open config file */
...
...
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