#include <lunaix/mm/valloc.h>
#include <lunaix/spike.h>
-#include <klibc/stdio.h>
+#include <klibc/strfmt.h>
#include <klibc/string.h>
-#define TWIMAP_BUFFER_SIZE 1024
+#define TWIMAP_BUFFER_SIZE 4096
void
__twimap_default_reset(struct twimap* map)
acc_size += rdlen;
}
+ if (acc_size <= len - 1) {
+ // pad zero
+ *(char*)(buffer + acc_size + 1) = 0;
+ }
+
vfree(map->buffer);
return acc_size;
}
char* buf = mapping->buffer + mapping->size_acc;
mapping->size_acc +=
- __ksprintf_internal(buf, fmt, TWIMAP_BUFFER_SIZE, args);
+ ksnprintfv(buf, fmt, TWIMAP_BUFFER_SIZE, args) - 1;
va_end(args);
}
struct v_file_ops twimap_file_ops = { .close = default_file_close,
.read = __twimap_file_read,
+ .read_page = __twimap_file_read,
.readdir = default_file_readdir,
.seek = default_file_seek,
.write = default_file_write };
\ No newline at end of file