2
* (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
3
* All rights reserved. The file named COPYRIGHT specifies the terms
4
* and conditions for redistribution.
9
* $Id: impl.h,v 1.1.1.1 2003/02/19 17:29:27 bbraun Exp $
15
#include <stdlib.h> /* For malloc() & free() prototypes */
17
#define DEFINE_LINK_TYPE( type, name ) struct { type *next, *prev ; } name
20
#define NEXT( obj, field ) (obj)->field.next
21
#define PREV( obj, field ) (obj)->field.prev
23
#define INIT_LINKS( obj, field ) \
25
NEXT( obj, field ) = obj ; \
26
PREV( obj, field ) = obj ; \
30
* Link new object after object using the specified field
32
#define LINK( obj, new_obj, field ) \
34
NEXT( new_obj, field ) = NEXT( obj, field ) ; \
35
PREV( new_obj, field ) = obj ; \
36
NEXT( obj, field ) = new_obj ; \
37
PREV( NEXT( obj, field ), field ) = new_obj ; \
40
#define UNLINK( obj, field ) \
42
NEXT( PREV( obj, field ), field ) = NEXT( obj, field ) ; \
43
PREV( NEXT( obj, field ), field ) = PREV( obj, field ) ; \
49
* When xlog1 is linked to xlog2 (i.e. errors on xlog1 are reported to
50
* xlog2) we use the xl_clients field on xlog2 and the xl_other_users
58
void (*xl_callback)() ;
59
void *xl_callback_arg ;
60
struct xlog *xl_use ; /* xlog we report errors to */
61
struct xlog *xl_clients ; /* linked list of xlogs that use */
62
/* this xlog to report errors */
63
DEFINE_LINK_TYPE( struct xlog, xl_other_users ) ;
66
int (*init) ( struct xlog *, va_list ) ;
67
void (*fini) ( struct xlog * ) ;
68
int (*write) ( struct xlog *, const char *, int, int, va_list ) ;
69
int (*control) ( struct xlog *, xlog_cmd_e, va_list ) ;
70
int (*parms) ( xlog_e, va_list ) ;
75
#define XL_INIT( xp, ap ) (*(xp)->xl_ops->init)( (xp), (ap) )
76
#define XL_FINI( xp ) (*(xp)->xl_ops->fini)( xp )
77
#define XL_WRITE( xp, buf, size, flags, ap ) \
78
(*(xp)->xl_ops->write)( (xp), (buf), (size), (flags), (ap ) )
79
#define XL_CONTROL( xp, cmd, ap ) \
80
(*(xp)->xl_ops->control)( (xp), (cmd), (ap) )
82
typedef struct xlog xlog_s ;
84
typedef void (*voidfunc)() ;
85
typedef int bool_int ;
87
#define XP( p ) ((struct xlog *)(p))
89
#define XLOG_NULL XP( NULL )
100
#define NEW( type ) (type *) malloc( sizeof( type ) )
102
int __xlog_add_errno(const char *, int) ;
103
char *__xlog_explain_errno(char *, unsigned *) ;
104
char *__xlog_new_string(const char *) ;