Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sparse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raphael.bach
sparse
Commits
35726d72
Commit
35726d72
authored
6 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Remove mode parameter from Sparse_Open()
parent
0219b4ea
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/sparse.h
+1
-2
1 addition, 2 deletions
include/sparse.h
src/sparse.c
+4
-6
4 additions, 6 deletions
src/sparse.c
src/sparse2img.c
+2
-2
2 additions, 2 deletions
src/sparse2img.c
with
7 additions
and
10 deletions
include/sparse.h
+
1
−
2
View file @
35726d72
...
...
@@ -114,8 +114,7 @@ struct Sparse * Sparse_Create(size_t block_size, size_t img_size);
/*------------------------------------------------------------------------------
Sparse_Open()
------------------------------------------------------------------------------*/
struct
Sparse
*
Sparse_Open
(
const
char
*
const
restrict
path
,
const
char
*
const
restrict
mode
);
struct
Sparse
*
Sparse_Open
(
const
char
*
const
restrict
path
);
/*------------------------------------------------------------------------------
Sparse_Close()
------------------------------------------------------------------------------*/
...
...
This diff is collapsed.
Click to expand it.
src/sparse.c
+
4
−
6
View file @
35726d72
...
...
@@ -92,22 +92,20 @@ struct Sparse * Sparse_Create(size_t block_size, size_t img_size)
/*------------------------------------------------------------------------------
Sparse_Open()
------------------------------------------------------------------------------*/
struct
Sparse
*
Sparse_Open
(
const
char
*
const
restrict
path
,
const
char
*
const
restrict
mode
)
struct
Sparse
*
Sparse_Open
(
const
char
*
const
path
)
{
assert
(
path
!=
NULL
);
assert
(
mode
!=
NULL
);
struct
Sparse
*
sparse
=
malloc
(
sizeof
(
*
sparse
));
if
(
sparse
!=
NULL
)
{
int
fd
=
FIO_Open
(
path
,
mode
);
int
fd
=
FIO_Open
(
path
,
"r"
);
if
(
fd
!=
-
1
)
{
sparse
->
chunks
=
NULL
;
sparse
->
size
=
FIO_GetSize
(
fd
);
sparse
->
fd
=
fd
;
}
else
{
Log_Fatal
(
&
s_logger
,
"FIO_Open(%s,
\"
%s
\"
) failed! %s
\n
"
,
path
,
mode
,
strerror
(
errno
));
Log_Fatal
(
&
s_logger
,
"FIO_Open(%s,
\"
r
\"
) failed! %s
\n
"
,
path
,
strerror
(
errno
));
exit
(
-
1
);
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/sparse2img.c
+
2
−
2
View file @
35726d72
...
...
@@ -109,7 +109,7 @@ int main(int argc, char * argv[])
------------------------------------------------------------------------------*/
void
Sparse2Img
(
const
struct
Args
*
const
args
)
{
struct
Sparse
*
sparse
=
Sparse_Open
(
args
->
sparse_path
,
"r"
);
struct
Sparse
*
sparse
=
Sparse_Open
(
args
->
sparse_path
);
Sparse_Read
(
sparse
);
int
fd
=
FIO_Open
(
args
->
image_path
,
"w"
);
if
(
fd
!=
-
1
)
{
...
...
@@ -127,7 +127,7 @@ void Sparse2Img(const struct Args * const args)
void
DumpInfo
(
const
char
*
const
path
)
{
assert
(
path
!=
NULL
);
struct
Sparse
*
sparse
=
Sparse_Open
(
path
,
"r"
);
struct
Sparse
*
sparse
=
Sparse_Open
(
path
);
Sparse_ReadHeader
(
sparse
);
Sparse_ReadChunksHeader
(
sparse
);
Sparse_DumpInfo
(
sparse
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment