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
8b69a115
Commit
8b69a115
authored
Mar 23, 2022
by
Grzegorz Daniluk
Committed by
Érico Nogueira Rolim
Mar 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdbfs: adding file erase function.
Commit taken from [1]. [1]
wrpc-sw@bcb4fdef
parent
3d3fd837
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
access.c
sdbfs/lib/access.c
+20
-0
libsdbfs.h
sdbfs/lib/libsdbfs.h
+1
-0
No files found.
sdbfs/lib/access.c
View file @
8b69a115
...
...
@@ -58,3 +58,23 @@ int sdbfs_fwrite(struct sdbfs *fs, int offset, void *buf, int count)
fs
->
read_offset
=
offset
+
ret
;
return
ret
;
}
int
sdbfs_ferase
(
struct
sdbfs
*
fs
,
int
offset
,
int
count
)
{
int
ret
;
if
(
!
fs
->
currentp
)
return
-
ENOENT
;
if
(
offset
<
0
)
offset
=
fs
->
read_offset
;
if
((
unsigned
int
)(
offset
+
count
)
>
fs
->
f_len
)
count
=
fs
->
f_len
-
offset
;
ret
=
count
;
if
(
fs
->
data
)
memset
(
fs
->
data
+
fs
->
f_offset
+
offset
,
0xFF
,
count
);
else
ret
=
fs
->
erase
(
fs
,
fs
->
f_offset
+
offset
,
count
);
if
(
ret
>
0
)
fs
->
read_offset
=
offset
+
ret
;
return
ret
;
}
sdbfs/lib/libsdbfs.h
View file @
8b69a115
...
...
@@ -79,6 +79,7 @@ struct sdb_device *sdbfs_scan(struct sdbfs *fs, int newscan);
int
sdbfs_fstat
(
struct
sdbfs
*
fs
,
struct
sdb_device
*
record_return
);
int
sdbfs_fread
(
struct
sdbfs
*
fs
,
int
offset
,
void
*
buf
,
int
count
);
int
sdbfs_fwrite
(
struct
sdbfs
*
fs
,
int
offset
,
void
*
buf
,
int
count
);
int
sdbfs_ferase
(
struct
sdbfs
*
fs
,
int
offset
,
int
count
);
/* This is needed to convert endianness. Hoping it is not defined elsewhere */
static
inline
uint64_t
htonll
(
uint64_t
ll
)
...
...
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