Replace EFF_RDONLY by EFF_PRIVATE

Read-only was a bit of a misnomer: you could write to the table by
obtaining a pointer into it from ef_ptr(), you just couldn't write to
the backing file.

Semantic changes:

* ef_flush() is now allowed when the table is file-backed or privately
  mapped.  Before, it had to be file-backed.  Flushing a privately
  mapped table does nothing, just like flushing a read-only table did.

* ef_write() is now allowed when the table is file-backed or fully
  cached.  Before, it had to be file-backed and not read-only.
  Writing to a privately mapped file-backed table doesn't write to the
  file.

* ef_extend() is not implemented for privately mapped tables, just
  like it wasn't implemented for read-only tables.
This commit is contained in:
Markus Armbruster 2008-02-21 21:04:11 +01:00
parent 53bcf04664
commit 642c11eb64
3 changed files with 28 additions and 15 deletions

View file

@ -85,7 +85,7 @@
SZ((array)), 0, SZ((array)) - 1, SZ((array)) - 1, -1, NULL, NULL, NULL
/* Common configuration table flags */
#define EFF_CFG (EFF_RDONLY | EFF_MEM | EFF_STATIC)
#define EFF_CFG (EFF_PRIVATE | EFF_MEM | EFF_STATIC)
struct empfile empfile[] = {
/*
@ -95,7 +95,7 @@ struct empfile empfile[] = {
* bits of flags get their final value.
* If flags & EFF_STATIC, the cache is mapped here, and members
* cache, csize get their final value.
* Members baseid, cids, fids and the EFF_MEM|EFF_RDONLY bits of
* Members baseid, cids, fids and the EFF_MEM|EFF_PRIVATE bits of
* flags are initialized according the initial cache contents.
* Member fd is initialized to -1.
* Members init, postread, prewrite get initialized to NULL, but