[14301] | 1 | /*- |
---|
| 2 | * Copyright (c) 1992, 1993, 1994 |
---|
| 3 | * The Regents of the University of California. All rights reserved. |
---|
| 4 | * Copyright (c) 1992, 1993, 1994, 1995, 1996 |
---|
| 5 | * Keith Bostic. All rights reserved. |
---|
| 6 | * |
---|
| 7 | * See the LICENSE file for redistribution information. |
---|
| 8 | * |
---|
| 9 | * @(#)exf.h 10.7 (Berkeley) 7/9/96 |
---|
| 10 | */ |
---|
| 11 | /* Undo direction. */ |
---|
| 12 | /* |
---|
| 13 | * exf -- |
---|
| 14 | * The file structure. |
---|
| 15 | */ |
---|
| 16 | struct _exf { |
---|
| 17 | int refcnt; /* Reference count. */ |
---|
| 18 | |
---|
| 19 | /* Underlying database state. */ |
---|
| 20 | DB *db; /* File db structure. */ |
---|
| 21 | char *c_lp; /* Cached line. */ |
---|
| 22 | size_t c_len; /* Cached line length. */ |
---|
| 23 | recno_t c_lno; /* Cached line number. */ |
---|
| 24 | recno_t c_nlines; /* Cached lines in the file. */ |
---|
| 25 | |
---|
| 26 | DB *log; /* Log db structure. */ |
---|
| 27 | char *l_lp; /* Log buffer. */ |
---|
| 28 | size_t l_len; /* Log buffer length. */ |
---|
| 29 | recno_t l_high; /* Log last + 1 record number. */ |
---|
| 30 | recno_t l_cur; /* Log current record number. */ |
---|
| 31 | MARK l_cursor; /* Log cursor position. */ |
---|
| 32 | dir_t lundo; /* Last undo direction. */ |
---|
| 33 | |
---|
| 34 | LIST_HEAD(_markh, _lmark) marks;/* Linked list of file MARK's. */ |
---|
| 35 | |
---|
| 36 | /* |
---|
| 37 | * XXX |
---|
| 38 | * Mtime should be a struct timespec, but time_t is more portable. |
---|
| 39 | */ |
---|
| 40 | dev_t mdev; /* Device. */ |
---|
| 41 | ino_t minode; /* Inode. */ |
---|
| 42 | time_t mtime; /* Last modification time. */ |
---|
| 43 | |
---|
| 44 | int fcntl_fd; /* Fcntl locking fd; see exf.c. */ |
---|
| 45 | |
---|
| 46 | /* |
---|
| 47 | * Recovery in general, and these fields specifically, are described |
---|
| 48 | * in recover.c. |
---|
| 49 | */ |
---|
| 50 | #define RCV_PERIOD 120 /* Sync every two minutes. */ |
---|
| 51 | char *rcv_path; /* Recover file name. */ |
---|
| 52 | char *rcv_mpath; /* Recover mail file name. */ |
---|
| 53 | int rcv_fd; /* Locked mail file descriptor. */ |
---|
| 54 | |
---|
| 55 | #define F_DEVSET 0x001 /* mdev/minode fields initialized. */ |
---|
| 56 | #define F_FIRSTMODIFY 0x002 /* File not yet modified. */ |
---|
| 57 | #define F_MODIFIED 0x004 /* File is currently dirty. */ |
---|
| 58 | #define F_MULTILOCK 0x008 /* Multiple processes running, lock. */ |
---|
| 59 | #define F_NOLOG 0x010 /* Logging turned off. */ |
---|
| 60 | #define F_RCV_NORM 0x020 /* Don't delete recovery files. */ |
---|
| 61 | #define F_RCV_ON 0x040 /* Recovery is possible. */ |
---|
| 62 | #define F_UNDO 0x080 /* No change since last undo. */ |
---|
| 63 | u_int8_t flags; |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | /* Flags to db_get(). */ |
---|
| 67 | #define DBG_FATAL 0x001 /* If DNE, error message. */ |
---|
| 68 | #define DBG_NOCACHE 0x002 /* Ignore the front-end cache. */ |
---|
| 69 | |
---|
| 70 | /* Flags to file_init() and file_write(). */ |
---|
| 71 | #define FS_ALL 0x001 /* Write the entire file. */ |
---|
| 72 | #define FS_APPEND 0x002 /* Append to the file. */ |
---|
| 73 | #define FS_FORCE 0x004 /* Force is set. */ |
---|
| 74 | #define FS_OPENERR 0x008 /* Open failed, try it again. */ |
---|
| 75 | #define FS_POSSIBLE 0x010 /* Force could have been set. */ |
---|
| 76 | #define FS_SETALT 0x020 /* Set alternate file name. */ |
---|
| 77 | |
---|
| 78 | /* Flags to rcv_sync(). */ |
---|
| 79 | #define RCV_EMAIL 0x01 /* Send the user email, IFF file modified. */ |
---|
| 80 | #define RCV_ENDSESSION 0x02 /* End the file session. */ |
---|
| 81 | #define RCV_PRESERVE 0x04 /* Preserve backup file, IFF file modified. */ |
---|
| 82 | #define RCV_SNAPSHOT 0x08 /* Snapshot the recovery, and send email. */ |
---|