diff --git a/include/file_io.h b/include/file_io.h new file mode 100644 index 0000000000000000000000000000000000000000..8c6948829db07cccfe5aa25e37732d6cc80f5456 --- /dev/null +++ b/include/file_io.h @@ -0,0 +1,39 @@ +/*! + @file + @date 18.01.2019 + @author Raphael Bach + @copyright + +The MIT License (MIT) + +Copyright (c) 2019 Raphael Bach + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @brief + @details +*/ +/*============================================================================== + GUARD +==============================================================================*/ +#ifndef FILE_IO_H_20190118185317 +#define FILE_IO_H_20190118185317 +/*============================================================================== + GUARD +==============================================================================*/ +#endif // FILE_IO_H_20190118185317 diff --git a/makefile b/makefile index b26b8b615649177f97a8897a4cfc8e68790a6e87..061877446eaf50985101cf639c7f7875c583eddf 100644 --- a/makefile +++ b/makefile @@ -200,11 +200,13 @@ LFLAGS += -o ./$@.out SPARSE2IMG_DEP := \ sparse2img.o \ sparse.o \ + file_io.o \ log.o IMG2SPARSE_DEP := \ img2sparse.o \ sparse.o \ + file_io.o \ log.o SPARSE2IMG_OBJ_LIST_PATH := $(addprefix $(OBJECT_PATH)/, $(SPARSE2IMG_DEP)) @@ -216,6 +218,10 @@ I2S_DEP := \ $(SOURCE_FOLDER)/img2sparse.c SPARSE_DEP := \ $(SOURCE_FOLDER)/sparse.c \ + $(HEADER_FOLDER)/file_io.h \ + $(HEADER_FOLDER)/log.h +FILE_IO_DEP := \ + $(SOURCE_FOLDER)/file_io.c \ $(HEADER_FOLDER)/log.h LOG_DEP := \ $(SOURCE_FOLDER)/log.c @@ -234,6 +240,8 @@ img2sparse.o: $(I2S_DEP) $(CFLAGS) sparse.o: $(SPARSE_DEP) $(CFLAGS) +file_io.o: $(FILE_IO_DEP) + $(CFLAGS) log.o: $(LOG_DEP) $(CFLAGS) @@ -245,7 +253,7 @@ tests: $(SCANBUILD) $(CPPCHECK) $(VALGRIND) ./sparse2img.out x x 2> $(ANALYZE_PATH)/valgrind - $(VALGRIND) ./img2sparse.out test.simg x 2>> $(ANALYZE_PATH)/valgrind + #$(VALGRIND) ./img2sparse.out test.simg x 2>> $(ANALYZE_PATH)/valgrind %.info: %.o $(LCOV) diff --git a/src/file_io.c b/src/file_io.c new file mode 100644 index 0000000000000000000000000000000000000000..b8699c92cb72a224ee610fa84919a051f7efaff1 --- /dev/null +++ b/src/file_io.c @@ -0,0 +1,44 @@ +/*! + @file + @date 18.01.2019 + @author Raphael Bach + @copyright + +The MIT License (MIT) + +Copyright (c) 2019 Raphael Bach + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @brief + @details +*/ +/*============================================================================== + INCLUDE +==============================================================================*/ +// Own header +#include "file_io.h" +// Internal +#include "log.h" +/*============================================================================== + STATIC +==============================================================================*/ +static struct Logger s_logger = { + .level_flag = LOG_LEVEL_ALL, + .output = LOG_OUTPUT_STDERR +};