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 jelson 1.6 * $Id: emlog.h,v 1.5 2001/08/13 21:12:48 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.6
|
30 jelson 1.4 unsigned long i_ino; /* Inode number of this emlog buffer */
|
31 jelson 1.6 kdev_t i_dev; /* Device number of this emlog buffer */
|
32 jelson 1.4 char *data; /* The circular buffer data */
33 int size; /* Size of the buffer pointed to by 'data' */
34 int refcount; /* Files that have this buffer open */
35 int read_point; /* Offset in circ. buffer of oldest data */
36 int write_point; /* Offset in circ. buffer of newest data */
37 int offset; /* Byte number of read_point in the stream */
|
38 jelson 1.1 struct emlog_info *next;
39 };
40
|
41 jelson 1.4
42 /* amount of data in the queue */
43 #define EMLOG_QLEN(einfo) ( (einfo)->write_point >= (einfo)->read_point ? \
|
44 jelson 1.1 (einfo)->write_point - (einfo)->read_point : \
45 (einfo)->size - (einfo)->read_point + (einfo)->write_point)
|
46 jelson 1.5
47 /* byte number of the last byte in the queue */
48 #define EMLOG_FIRST_EMPTY_BYTE(einfo) ((einfo)->offset + EMLOG_QLEN(einfo))
|
49 jelson 1.1
|
50 jelson 1.5 /* macro to make it more convenient to access the wait q */
|
51 jelson 1.2 #define EMLOG_READQ(einfo) (&((einfo)->read_q))
|
52 jelson 1.1
|