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 ef71897051
commit f8dcb7b07b
3 changed files with 28 additions and 15 deletions

View file

@ -57,7 +57,7 @@ struct empfile {
int cids; /* # entries in cache */
int fids; /* # entries in table */
int fd; /* file descriptor, -1 if not open */
/* flags bits EFF_RDONLY, EFF_CUSTOM also vary */
/* flags bits EFF_PRIVATE, EFF_CUSTOM also vary */
/* User callbacks */
void (*init)(int, void *); /* called after entry creation, unless null */
@ -86,8 +86,8 @@ struct empfile {
/* Flags set when table contents is mapped */
/* Table is entirely in memory */
#define EFF_MEM bit(8)
/* Table is read-only */
#define EFF_RDONLY bit(9)
/* Table is privately mapped: changes don't affect the underlying file */
#define EFF_PRIVATE bit(9)
/* Table is customized (configuration tables only) */
#define EFF_CUSTOM bit(10)
/* Transient flags, only occur in argument of ef_open() */
@ -97,7 +97,8 @@ struct empfile {
/*
* Empire `file types'
* These are really table IDs. Some tables are backed by files, some
* are compiled into the server.
* are compiled into the server, some initialized from configuration
* files.
*/
enum {
/* Error value */