(file) Return to emlog.h CVS log (file) Jump to this file's LXR Page (dir) Up to [CENS] / misc / emlog

File: [CENS] / misc / emlog / emlog.h (download) / (as text)
Revision: 1.4, Mon Aug 13 07:10:18 2001 UTC (8 years, 3 months ago) by jelson
Branch: MAIN
Changes since 1.3: +12 -10 lines
First pass at an emlog that knows how to keep reader-specific offsets

/*
 * EMLOG: the EMbedded-device LOGger
 *
 * Jeremy Elson
 * USC/ISI
 *
 * $Id: emlog.h,v 1.4 2001/08/13 08:10:18 jelson Exp $
 */

#define EMLOG_MAJOR_NUMBER   241
#define EMLOG_MAX_SIZE       128 /* max size in kilobytes of a buffer */


/************************ Private Definitions *****************************/

struct emlog_info {

#if defined(DECLARE_WAIT_QUEUE_HEAD)
  wait_queue_head_t read_q;
#else
  struct wait_queue *read_q;
#endif
  
  unsigned long i_ino;		/* Inode number of this emlog buffer */
  char *data;			/* The circular buffer data */
  int size;			/* Size of the buffer pointed to by 'data' */
  int refcount;			/* Files that have this buffer open */
  int read_point;		/* Offset in circ. buffer of oldest data */
  int write_point;		/* Offset in circ. buffer of newest data */
  int offset;			/* Byte number of read_point in the stream */
  struct emlog_info *next;
};


/* amount of data in the queue */
#define EMLOG_QLEN(einfo) ( (einfo)->write_point >= (einfo)->read_point ? \
         (einfo)->write_point - (einfo)->read_point : \
         (einfo)->size - (einfo)->read_point + (einfo)->write_point)
			
#define EMLOG_EMPTY(einfo) (((einfo)->read_point) == ((einfo)->write_point))
#define EMLOG_READQ(einfo) (&((einfo)->read_q))


CENS CVS Mailing List
Powered by
ViewCVS 0.9.2