fsctl/include/fsctl/fugue/bits/logger.h

41 lines
1.3 KiB
C

#ifndef FSCTL_FUGUE_BITS_LOGGER_H
#define FSCTL_FUGUE_BITS_LOGGER_H 1
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include <stdarg.h>
/* fugue_logger : simple FS logger information */
struct fugue_logger
{
#if 0
/* logger primitive (can be NULL)
* - init() : initialize buffer and internal information
* - clear() : clear the content of the buffer (reset)
* - vwrite() : inject a text in the buffer (va_arg version)
* - getlines() : fetch the line starting at `*lineptr`
* - quit() : uninitialize buffer and internal information */
struct {
int (*init)(struct fugue_logger *l, size_t buffer_size);
int (*clear)(struct fugue_logger *l);
ssize_t (*vwrite)(struct fugue_logger *l, char *text, va_list ap);
ssize_t (*getline)(struct fugue_logger *l, char **lineptr, size_t *n);
int (*quit)(struct fugue_logger *logger);
} primitive;
#endif
/* buffer geometry information
* - buffer.data : buffer data
* - buffer.size : buffer size
* - buffer.inject_pos : text injection position
* */
struct {
char *data;
size_t size;
int pos;
} buffer;
};
typedef struct fugue_logger fugue_logger_t;
#endif /* FSCTL_FUGUE_BITS_LOGGER_H */