From: Martin Mares Date: Sat, 9 Dec 2006 19:02:48 +0000 (+0100) Subject: fb-direct: Implemented temporary files. X-Git-Tag: holmes-import~506^2~13^2~208 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2e88d6d4ca1576e3219421b0ee602d5e8936bbe0;p=libucw.git fb-direct: Implemented temporary files. --- diff --git a/lib/fastbuf.h b/lib/fastbuf.h index 27f0f584..abcf7118 100644 --- a/lib/fastbuf.h +++ b/lib/fastbuf.h @@ -106,7 +106,7 @@ struct asio_queue; 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(int fd, struct asio_queue *io_queue); +struct fastbuf *fbdir_open_tmp(struct asio_queue *io_queue); /* FastI on file descriptors with limit */ diff --git a/lib/fb-direct.c b/lib/fb-direct.c index a4277ec9..9262e7e1 100644 --- a/lib/fb-direct.c +++ b/lib/fb-direct.c @@ -356,6 +356,18 @@ fbdir_open_fd(int fd, struct asio_queue *q) return fbdir_open_internal(x, fd, q); } +struct fastbuf * +fbdir_open_tmp(struct asio_queue *q) +{ + byte buf[TEMP_FILE_NAME_LEN]; + struct fastbuf *f; + + temp_file_name(buf); + f = fbdir_open(buf, O_RDWR | O_CREAT | O_TRUNC, q); + bconfig(f, BCONFIG_IS_TEMP_FILE, 1); + return f; +} + #ifdef TEST #include "lib/getopt.h"