use callback based infrastructure to reset iob's
parent
527efc70b6
commit
8b17690318
@ -1,5 +1,10 @@
|
||||
#include <stdlib.h>
|
||||
#include "iob_internal.h"
|
||||
|
||||
static void cleanup(struct iob_entry* x) {
|
||||
free((char*)x->buf);
|
||||
}
|
||||
|
||||
int iob_addbuf_free(io_batch* b,const void* buf,uint64 n) {
|
||||
return iob_addbuf_internal(b,buf,n,1);
|
||||
return iob_addbuf_internal(b,buf,n,cleanup);
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include "iob_internal.h"
|
||||
|
||||
int iob_addbuf_free(io_batch* b,const void* buf,uint64 n) {
|
||||
return iob_addbuf_internal(b,buf,n,2);
|
||||
static void cleanup(struct iob_entry* x) {
|
||||
munmap((char*)x->buf,x->n);
|
||||
}
|
||||
|
||||
int iob_addbuf_munmap(io_batch* b,const void* buf,uint64 n) {
|
||||
return iob_addbuf_internal(b,buf,n,cleanup);
|
||||
}
|
||||
|
Loading…
Reference in New Issue