Skip to content
Snippets Groups Projects
Commit 35726d72 authored by raphael.bach's avatar raphael.bach
Browse files

Remove mode parameter from Sparse_Open()

parent 0219b4ea
No related branches found
No related tags found
No related merge requests found
......@@ -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()
------------------------------------------------------------------------------*/
......
......@@ -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 {
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment