1 jelson 1.1 /*
2 * EMLOG: the EMbedded-device LOGger
3 *
|
4 jelson 1.5 * Jeremy Elson <jelson@circlemud.org>
5 * USC/Information Sciences Institute
|
6 jelson 1.1 *
|
7 jelson 1.5 * This code is released under the GPL
8 *
9 * This is emlog version 0.40, released 13 August 2001
10 * For more information see http://www.circlemud.org/~jelson/software/emlog
11 *
12 * $Id: emlog.h,v 1.4 2001/08/13 08:10:18 jelson Exp $
|
13 jelson 1.1 */
14
15 #define EMLOG_MAJOR_NUMBER 241
16 #define EMLOG_MAX_SIZE 128 /* max size in kilobytes of a buffer */
17
|
18 jelson 1.5 #define EMLOG_VERSION "0.40"
|
19 jelson 1.1
20 /************************ Private Definitions *****************************/
21
22 struct emlog_info {
|
23 jelson 1.2
24 #if defined(DECLARE_WAIT_QUEUE_HEAD)
25 wait_queue_head_t read_q;
26 #else
|
27 jelson 1.3 struct wait_queue *read_q;
|
28 jelson 1.2 #endif
|
29 jelson 1.1
|
30 jelson 1.4 unsigned long i_ino; /* Inode number of this emlog buffer */
31 char *data; /* The circular buffer data */
32 int size; /* Size of the buffer pointed to by 'data' */
33 int refcount; /* Files that have this buffer open */
34 int read_point; /* Offset in circ. buffer of oldest data */
35 int write_point; /* Offset in circ. buffer of newest data */
36 int offset; /* Byte number of read_point in the stream */
|
37 jelson 1.1 struct emlog_info *next;
38 };
39
|
40 jelson 1.4
41 /* amount of data in the queue */
42 #define EMLOG_QLEN(einfo) ( (einfo)->write_point >= (einfo)->read_point ? \
|
43 jelson 1.1 (einfo)->write_point - (einfo)->read_point : \
44 (einfo)->size - (einfo)->read_point + (einfo)->write_point)
|
45 jelson 1.5
46 /* byte number of the last byte in the queue */
47 #define EMLOG_FIRST_EMPTY_BYTE(einfo) ((einfo)->offset + EMLOG_QLEN(einfo))
|
48 jelson 1.1
|
49 jelson 1.5 /* macro to make it more convenient to access the wait q */
|
50 jelson 1.2 #define EMLOG_READQ(einfo) (&((einfo)->read_q))
|
51 jelson 1.1
|