From: Robert Spalek Date: Fri, 25 Jun 2004 11:53:39 +0000 (+0000) Subject: added the configuration item BCONFIG_CAN_OVERWRITE, which specifies whether the X-Git-Tag: holmes-import~1023 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=6a8ae5549f28ef50110e23ffd418105ef8f38d79;p=libucw.git added the configuration item BCONFIG_CAN_OVERWRITE, which specifies whether the caller is allowed to perform the following 0-copy write operation: 1. call bdirect_read_prepare() 2. modify the data directly in the buffer returned (e.g. put \0's there) 3. call bflush() before any seek operation to let the fastbuf know --- diff --git a/lib/fastbuf.h b/lib/fastbuf.h index 2ed05341..0104a61f 100644 --- a/lib/fastbuf.h +++ b/lib/fastbuf.h @@ -100,6 +100,7 @@ fbbuf_count_written(struct fastbuf *f) int bconfig(struct fastbuf *f, uns type, int data); #define BCONFIG_IS_TEMP_FILE 0 +#define BCONFIG_CAN_OVERWRITE 1 /* Universal functions working on all fastbuf's */ diff --git a/lib/fb-file.c b/lib/fb-file.c index cfc586bb..abb29ddf 100644 --- a/lib/fb-file.c +++ b/lib/fb-file.c @@ -89,6 +89,8 @@ bfd_config(struct fastbuf *f, uns item, int value) case BCONFIG_IS_TEMP_FILE: FB_FILE(f)->is_temp_file = value; return 0; + case BCONFIG_CAN_OVERWRITE: + return 1; default: return -1; } diff --git a/lib/fb-mmap.c b/lib/fb-mmap.c index b6f82775..f4f90184 100644 --- a/lib/fb-mmap.c +++ b/lib/fb-mmap.c @@ -160,6 +160,8 @@ bfmm_config(struct fastbuf *f, uns item, int value) case BCONFIG_IS_TEMP_FILE: FB_MMAP(f)->is_temp_file = value; return 0; + case BCONFIG_CAN_OVERWRITE: + return 0; default: return -1; }