]> mj.ucw.cz Git - libucw.git/commitdiff
added the configuration item BCONFIG_CAN_OVERWRITE, which specifies whether the
authorRobert Spalek <robert@ucw.cz>
Fri, 25 Jun 2004 11:53:39 +0000 (11:53 +0000)
committerRobert Spalek <robert@ucw.cz>
Fri, 25 Jun 2004 11:53:39 +0000 (11:53 +0000)
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

lib/fastbuf.h
lib/fb-file.c
lib/fb-mmap.c

index 2ed05341dbcaa42b7268b09abd83de112024aba6..0104a61f1daa9a2519b0d5f2f9789ee2e0d53f9e 100644 (file)
@@ -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 */
 
index cfc586bb3a69918ed27c1004b1fa717593709e17..abb29ddf3f9bdd144c2f42417a94b2fe9eff1109 100644 (file)
@@ -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;
     }
index b6f827751fcf7f8b5152f8694806437c7074c5fb..f4f901840ced7a5cf205518149c4c10797215eef 100644 (file)
@@ -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;
     }