#define EFF_OWNER bit(2) /* has concept of owner */
#define EFF_GROUP bit(3) /* has concept of group */
+/* Flags that may be passed to ef_open() */
+#define EFF_OPEN EFF_MEM
+
/*
* Empire `file types'
* These are really table IDs. Some tables are backed by files, some
static void fillcache(struct empfile *ep, int start);
/*
- * Open the file containing objects of the type 'type' with mode 'mode'.
- * 'how' sets whether the file should be cached (EFF_MEM), or type specific
- * flags (EFF_XY,EFF_OWNER,EFF,EFF_GROUP).
+ * Open a the file for table TYPE (EF_SECTOR, ...).
+ * MODE is passed to open().
+ * HOW are EFF_OPEN flags to control operation.
+ * Return non-zero on success, zero on failure.
*/
int
ef_open(int type, int mode, int how)
#endif
if (ef_check(type) < 0)
return 0;
+ if (CANT_HAPPEN(how & ~EFF_OPEN))
+ how &= EFF_OPEN;
ep = &empfile[type];
if ((ep->fd = open(ep->file, mode, 0660)) < 0) {
logerror("%s: open failed", ep->file);