Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
31
Issues
31
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
bcb4fdef
Commit
bcb4fdef
authored
Jan 08, 2015
by
Grzegorz Daniluk
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdb-lib: adding file erase function
parent
3aebf265
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
access.c
sdb-lib/access.c
+20
-0
libsdbfs.h
sdb-lib/libsdbfs.h
+1
-0
No files found.
sdb-lib/access.c
View file @
bcb4fdef
...
...
@@ -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
(
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
;
}
sdb-lib/libsdbfs.h
View file @
bcb4fdef
...
...
@@ -70,6 +70,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
)
...
...
Grzegorz Daniluk
@greg.d
mentioned in commit
fpga-config-space@8b69a115
·
Apr 11, 2022
mentioned in commit
fpga-config-space@8b69a115
mentioned in commit fpga-config-space@8b69a1154e5126ea830224aa4f5b139fd474ea87
Toggle commit list
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