Commit 7f9436fd authored by Loic Hausammann's avatar Loic Hausammann
Browse files

logger: 2nd meeting

parent 22ba5b23
......@@ -29,10 +29,12 @@ struct logger_reader;
/**
* @brief This structure deals with the dump file.
*
* TODO
*/
struct logger_dump {
/* Information contained in the header. */
/* Information contained in the file header. */
struct header header;
/* The reader that is using this dump. */
......@@ -41,9 +43,6 @@ struct logger_dump {
/* Information about the time chunks */
struct time_array times;
/* Dump's filename */
char *filename;
/* The dump's variables. */
struct {
/* Mapped data */
......
......@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
/* Task type names. */
/* Offset type names. */
const char *logger_offset_name[logger_offset_count] = {
"Forward", "Backward", "Corrupted",
};
......
......@@ -29,14 +29,14 @@
* @brief get the size of a file
*
* @param fd file id
* @param size out: file size
*
* @return file size
*/
void io_get_file_size(int fd, size_t *size) {
size_t io_get_file_size(int fd) {
struct stat s;
int status = fstat(fd, &s);
if (status != 0) error("Unable to get file size (%s)", strerror(errno));
*size = s.st_size;
return s.st_size;
}
/**
......@@ -55,8 +55,7 @@ void *io_mmap_file(char *filename, size_t *file_size) {
error("Unable to open file %s (%s)", filename, strerror(errno));
/* get file size */
*file_size = 0;
io_get_file_size(fd, file_size);
*file_size = io_get_file_size(fd);
/* map memory */
void *map = mmap(NULL, *file_size, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0);
......
......@@ -28,7 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
void io_get_file_size(int fd, size_t *size);
size_t io_get_file_size(int fd);
void *io_mmap_file(char *filename, size_t *file_size);
void io_munmap_file(void *map, size_t file_size);
......
......@@ -75,7 +75,6 @@ static PyObject *loadFromIndex(__attribute__((unused)) PyObject *self,
}
/* initialize the reader */
verbose = 2;
struct logger_reader reader;
logger_reader_init(&reader, filename, verbose);
struct header *h = &reader.dump.header;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment