From cabef723285b3d2e61db2fd84440dca848d12888 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 29 May 2007 22:39:31 +0200 Subject: [PATCH] Cleaned up the fastbuf interfaces. The high-level functions of fb-mmap and fb-direct have been removed. --- lib/fastbuf.h | 22 +++++++--------------- lib/fb-direct.c | 24 ------------------------ lib/fb-mmap.c | 6 ------ 3 files changed, 7 insertions(+), 45 deletions(-) diff --git a/lib/fastbuf.h b/lib/fastbuf.h index 475f8335..68b2a9db 100644 --- a/lib/fastbuf.h +++ b/lib/fastbuf.h @@ -77,7 +77,7 @@ struct fastbuf { enum fb_type { /* Which back-end you want to use */ FB_STD, /* Standard buffered I/O */ - FB_DIRECT, /* Direct I/O bypassing system caches */ + FB_DIRECT, /* Direct I/O bypassing system caches (see fb-direct.c for description) */ FB_MMAP /* Memory mapped files */ }; @@ -111,26 +111,18 @@ void bfilesync(struct fastbuf *b); #define TEMP_FILE_NAME_LEN 256 void temp_file_name(byte *name); -/* FastIO on in-memory streams */ - -struct fastbuf *fbmem_create(unsigned blocksize); /* Create stream and return its writing fastbuf */ -struct fastbuf *fbmem_clone_read(struct fastbuf *); /* Create reading fastbuf */ - -/* FastIO on memory mapped files */ +/* Internal functions of some file back-ends */ struct fastbuf *bfmmopen_internal(int fd, byte *name, uns mode); -struct fastbuf *bopen_mm(byte *name, uns mode); - -/* FastIO on files opened with O_DIRECT (see fb-direct.c for description) */ extern uns fbdir_cheat; - struct asio_queue; struct fastbuf *fbdir_open_fd_internal(int fd, byte *name, struct asio_queue *io_queue, uns buffer_size, uns read_ahead, uns write_back); -struct fastbuf *fbdir_open(byte *name, uns mode, struct asio_queue *io_queue); -struct fastbuf *fbdir_open_try(byte *name, uns mode, struct asio_queue *io_queue); -struct fastbuf *fbdir_open_fd(int fd, struct asio_queue *io_queue); -struct fastbuf *fbdir_open_tmp(struct asio_queue *io_queue); + +/* FastIO on in-memory streams */ + +struct fastbuf *fbmem_create(unsigned blocksize); /* Create stream and return its writing fastbuf */ +struct fastbuf *fbmem_clone_read(struct fastbuf *); /* Create reading fastbuf */ /* FastI on file descriptors with limit */ diff --git a/lib/fb-direct.c b/lib/fb-direct.c index 31b12e15..b82faa91 100644 --- a/lib/fb-direct.c +++ b/lib/fb-direct.c @@ -314,30 +314,6 @@ fbdir_open_fd_internal(int fd, byte *name, struct asio_queue *q, uns buffer_size return f; } -struct fastbuf * -fbdir_open_try(byte *name, uns mode, struct asio_queue *q) -{ - return bopen_file_try(name, mode, &(struct fb_params){ .type = FB_DIRECT, .asio = q }); -} - -struct fastbuf * -fbdir_open(byte *name, uns mode, struct asio_queue *q) -{ - return bopen_file(name, mode, &(struct fb_params){ .type = FB_DIRECT, .asio = q }); -} - -struct fastbuf * -fbdir_open_fd(int fd, struct asio_queue *q) -{ - return bopen_fd(fd, &(struct fb_params){ .type = FB_DIRECT, .asio = q }); -} - -struct fastbuf * -fbdir_open_tmp(struct asio_queue *q) -{ - return bopen_tmp_file(&(struct fb_params){ .type = FB_DIRECT, .asio = q }); -} - #ifdef TEST #include "lib/getopt.h" diff --git a/lib/fb-mmap.c b/lib/fb-mmap.c index cb1fd06b..88dfed4d 100644 --- a/lib/fb-mmap.c +++ b/lib/fb-mmap.c @@ -189,12 +189,6 @@ bfmmopen_internal(int fd, byte *name, uns mode) return f; } -struct fastbuf * -bopen_mm(byte *name, uns mode) -{ - return bopen_file(name, mode, &(struct fb_params){ .type = FB_MMAP }); -} - #ifdef TEST int main(int argc, char **argv) -- 2.39.2