X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Ffb-mmap.c;h=d355a66253d3310428476e39889c015625c1144a;hb=d4123b266f32fe1c84c03cc66ed7cc6c943a355b;hp=d1882ee77b848d33a696eb429e33961dd324b942;hpb=c62bb1ae58e77c9b0b6094c43fd666e8e35cf82d;p=libucw.git diff --git a/ucw/fb-mmap.c b/ucw/fb-mmap.c index d1882ee7..d355a662 100644 --- a/ucw/fb-mmap.c +++ b/ucw/fb-mmap.c @@ -9,10 +9,10 @@ #undef LOCAL_DEBUG -#include "ucw/lib.h" -#include "ucw/fastbuf.h" -#include "ucw/lfs.h" -#include "ucw/conf.h" +#include +#include +#include +#include #include #include @@ -47,7 +47,7 @@ struct fb_mmap { uns window_size; int mode; }; -#define FB_MMAP(f) ((struct fb_mmap *)(f)->is_fastbuf) +#define FB_MMAP(f) ((struct fb_mmap *)(f)) static void bfmm_map_window(struct fastbuf *f) @@ -72,7 +72,7 @@ bfmm_map_window(struct fastbuf *f) if (f->buffer == (byte *) MAP_FAILED) { f->buffer = NULL; - bthrow(f, "fb.mmap", "mmap(%s): %m", f->name); + bthrow(f, "mmap", "mmap(%s): %m", f->name); } #ifdef MADV_SEQUENTIAL if (ll > CPU_PAGE_SIZE) @@ -118,7 +118,7 @@ bfmm_spout(struct fastbuf *f) { F->file_extend = ALIGN_TO(F->file_extend + mmap_extend_size, (ucw_off_t)CPU_PAGE_SIZE); if (ucw_ftruncate(F->fd, F->file_extend)) - bthrow(f, "fb.write", "ftruncate(%s): %m", f->name); + bthrow(f, "write", "ftruncate(%s): %m", f->name); } bfmm_map_window(f); f->bstop = f->bptr; @@ -148,7 +148,7 @@ bfmm_close(struct fastbuf *f) if (!(f->flags & FB_DEAD) && F->file_extend > F->file_size && ucw_ftruncate(F->fd, F->file_size)) - bthrow(f, "fb.write", "ftruncate(%s): %m", f->name); + bthrow(f, "write", "ftruncate(%s): %m", f->name); bclose_file_helper(f, F->fd, F->is_temp_file); xfree(f); } @@ -182,7 +182,7 @@ bfmmopen_internal(int fd, const char *name, uns mode) F->fd = fd; F->file_extend = F->file_size = ucw_seek(fd, 0, SEEK_END); if (F->file_size < 0) - die("seek(%s): %m", name); + bthrow(f, "open", "fb-mmap: Cannot detect size of %s -- is it seekable?", name); if (mode & O_APPEND) f->pos = F->file_size; F->mode = mode; @@ -192,7 +192,6 @@ bfmmopen_internal(int fd, const char *name, uns mode) f->seek = bfmm_seek; f->close = bfmm_close; f->config = bfmm_config; - fb_tie(f); return f; }