Changeset 7115 for trunk/src/win32k


Ignore:
Timestamp:
Oct 19, 2001, 2:04:45 AM (24 years ago)
Author:
bird
Message:

New logging facility with some mess/cleanups.

Location:
trunk/src/win32k/kKrnlLib/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/kKrnlLib/include/kKLlog.h

    r6701 r7115  
    1 /* $Id: kKLlog.h,v 1.1 2001-09-14 01:50:17 bird Exp $
     1/* $Id: kKLlog.h,v 1.2 2001-10-19 00:04:44 bird Exp $
    22 *
    33 * log - C-style logging - kprintf.
     
    2626#define dprintf kprintf
    2727#if defined(DEBUG) && !defined(NOLOGGING)
    28     #ifdef INCL_16
    29         /* 16-bit */
    30         #include "vprntf16.h"
    31         #define kprintf(a)          printf16 a
    32         #define printf this function is not used in 16-bit code! Use printf16!
     28    #if 0
     29        #ifdef INCL_16
     30            /* 16-bit */
     31            #include <vprntf16.h>
     32            #define kprintf(a)          printf16 a
     33            #define printf this function is not used in 16-bit code! Use printf16!
     34        #else
     35            /* 32-bit */
     36            #include <stdarg.h>
     37            #include <kKLprintf.h>
     38            #ifdef __cplusplus
     39                #define kprintf(a)      ::printf a
     40            #else
     41                #define kprintf(a)      printf a
     42            #endif
     43        #endif
    3344    #else
    34         /* 32-bit */
    35         #include <stdarg.h>
    36         #include "kKLprintf.h"
    37         #ifdef __cplusplus
    38             #define kprintf(a)      ::printf a
     45        #ifndef KLOG_MOD
     46            #define KLOG_MOD    0
     47        #endif
     48
     49        #ifdef INCL_16
     50            /* 16-bit */
     51            #include <vprntf16.h>
     52            #define kprintf(a)          printf16 a
     53            #define printf this function is not used in 16-bit code! Use printf16!
    3954        #else
    40             #define kprintf(a)      printf a
     55            /* 32-bit */
     56            #include <kKLstdarg.h>
     57            #ifdef __cplusplus
     58                #define kprintf(a)      ::kLogv(KLOG_MOD, KLOGPOS_EXT, KLOG_TYPE_PRINTF, ::kLogFixPrintf a)
     59            #else
     60                #define kprintf(a)      kLogv(KLOG_MOD, KLOGPOS_EXT, KLOG_TYPE_PRINTF, kLogFixPrintf a)
     61            #endif
    4162        #endif
    4263    #endif
  • trunk/src/win32k/kKrnlLib/include/kKLprintf.h

    r6838 r7115  
    1 /* $Id: kKLprintf.h,v 1.2 2001-09-27 03:04:32 bird Exp $
     1/* $Id: kKLprintf.h,v 1.3 2001-10-19 00:04:45 bird Exp $
    22 *
    33 * printf/vprintf header file.
     
    2828int vprintf2(const char *pszFormat, va_list args);
    2929
    30 /*
    31  * va_start have to be redeclared. Compiler don't accept SSToDS() as va_start argument.
    32  */
    33 #undef va_start
    34 #define va_start(ap, last) ap = ((va_list)SSToDS(&last)) + __nextword(last)
     30#include <kKLstdarg.h>
    3531
    3632#ifdef __cplusplus
  • trunk/src/win32k/kKrnlLib/include/kKrnlLib.h

    r6737 r7115  
    1 /* $Id: kKrnlLib.h,v 1.2 2001-09-17 01:44:01 bird Exp $
     1/* $Id: kKrnlLib.h,v 1.3 2001-10-19 00:04:45 bird Exp $
    22 *
    33 * Top level header file for kKrnlLib exports.
     
    6161 */
    6262#ifdef INCL_KKL_LOG
     63    #include "kKLstdarg.h"
     64    #include "kLog.h"
    6365    #include "kKLlog.h"
    6466#endif
  • trunk/src/win32k/kKrnlLib/include/kLog.h

    r7070 r7115  
    1 /* $Id: kLog.h,v 1.2 2001-10-16 02:20:39 bird Exp $
     1/* $Id: kLog.h,v 1.3 2001-10-19 00:04:45 bird Exp $
    22 *
    33 * kLog - Generic Logging and Trace Routines.
     
    1010#define _kLog_h_
    1111
     12#ifdef __cplusplus
     13extern "C" {
     14#endif
    1215
    1316/*******************************************************************************
     
    1720 * Standard log types.
    1821 */
    19 #define KLOG_INITMOD    1               /* Function entry */
    20 #define KLOG_TERMMOD    2               /* Function entry */
    21 #define KLOG_ENTRY      3               /* Function entry */
    22 #define KLOG_EXIT       4               /* Function exit  */
    23 #define KLOG_ASSERT     5               /* Assertion failed / Kernel Panic. */
    24 
    25 #define KLOG_USER       0x1000          /* First user log type.  */
     22#define KLOG_TYPE_INITMOD    1          /* Log Module Init. */
     23#define KLOG_TYPE_TERMMOD    2          /* Log Module Termination. */
     24#define KLOG_TYPE_START      3          /* Start sequence and function entry. */
     25#define KLOG_TYPE_ENTRY      4          /* Function entry. */
     26#define KLOG_TYPE_EXIT       5          /* Function exit. */
     27#define KLOG_TYPE_STOP       6          /* Stop sequence and function exit.  */
     28#define KLOG_TYPE_PRINTF     7          /* kprintf and printf log output. */
     29#define KLOG_TYPE_ASSERT     8          /* Assertion failed / Kernel Panic. */
     30#define KLOG_TYPE_LOGASSERT  9          /* Assertion failed within kLog. */
     31
     32#define KLOG_TYPE_LAST_REQ   KLOG_TYPE_ASSERT   /* Last required type. */
     33
     34#define KLOG_TYPE_USER       0x1000     /* First user log type.  */
    2635
    2736
     
    2938 * Flags.
    3039 */
    31 #define KLOG_TYPEDEF_PTR    0x8000      /* flags this typedef as a pointer. */
    32 #define KLOG_TYPEDEF_SIZE   0xfff       /* Mask to get the size. */
    33 
    34 #define KLOG_TYPE_DISABLED  0x00
    35 #define KLOG_TYPE_ENABLED   0x01
    36 #define KLOG_TYPE_COMOUTPUT 0x10
    37 #define KLOG_TYPE_MASK      0x11
     40#define KLOG_TYPEDEF_PTR        0x8000  /* flags this typedef as a pointer. */
     41#define KLOG_TYPEDEF_SIZE       0x0fff  /* Mask to get the size. */
     42
     43#define KLOG_FLAGS_DISABLED     0x0000
     44#define KLOG_FLAGS_ENABLED      0x0001
     45#ifdef RING0
     46#define KLOG_FLAGS_COMOUTPUT    0x0010
     47#else
     48#define KLOG_FLAGS_COMOUTPUT    0x0000
     49#endif
     50#define KLOG_FLAGS_MASK         0x0011
     51#define KLOG_FLAGS_AS_ABOVE     0xffff  /* Inherit options from above option level. */
    3852
    3953/*
     
    6478typedef unsigned long int  HKLOGMOD;    /* Loghandle for a module. */
    6579
     80#ifdef _kAVL_h_
    6681
    6782/**
     
    8297typedef struct kLogTypedefInfo
    8398{
    84     const char *            pszType;
     99    union
     100    {
     101        const char *        pszType;
     102        AVLSTRNODECORE      avlnodecore;
     103    } u1;
    85104    const char *            pszFormat;
    86105    const unsigned short    cb;
     
    113132
    114133
     134/**
     135 * Describes one file.
     136 */
     137typedef struct kLogFileInfo
     138{
     139    union
     140    {
     141        const char *        pszFile;
     142        AVLSTRNODECORE      avlnodecore;
     143    } u1;
     144    unsigned short          fCurrent;
     145    const unsigned short    fDefault;
     146} KLOGFILEINFO, *PKLOGFILEINFO;
     147
     148
    115149
    116150/**
     
    120154{
    121155    const char *    pszModuleName;      /* Module name. */
    122     const char *    pszModuleDescription; /* Module description. */
    123 
    124     int             cTypedefs;          /* Number of typesdef in paTypedefs. */
    125     PKLOGTYPEDEFINFO paTypedefs;        /* Array of typedef descriptions. */
    126 
    127     int             cUserTypes;         /* Number of user types in paUserTypes. */
    128     PKLOGTYPEINFO   paUserTypes;        /* Array of user type descriptions. */
    129 
    130     int             cDefTypes;          /* Number of default types in paDefTypes. */
    131     PKLOGDEFTYPEINFO paDefTypes;        /* Array of default type descriptions. */
     156    const char *    pszModuleDescription;/*Module description. */
     157
     158    int                     cTypedefs;  /* Number of typesdef in paTypedefs. */
     159    PKLOGTYPEDEFINFO        paTypedefs; /* Array of typedef descriptions. */
     160
     161    int                     cUserTypes; /* Number of user types in paUserTypes. */
     162    PKLOGTYPEINFO           paUserTypes;/* Array of user type descriptions. */
     163
     164    int                     cDefTypes;  /* Number of default types in paDefTypes. */
     165    PKLOGDEFTYPEINFO        paDefTypes; /* Array of default type descriptions. */
     166
     167    int                     cFiles;     /* Number of files in paFiles. */
     168    PKLOGFILEINFO           paFiles;    /* Array of per file settings. */
    132169
    133170    /* Module Data Used by Log System - Do NOT touch! */
    134     AVLULNODECORE   avlnodecore;        /* AVL Tree node with module handle as key. */
    135     unsigned long   ulLastSeq;           /* Last sequence number. */
     171    AVLULNODECORE           avlnodecore;/* AVL Tree node with module handle as key. */
     172    PAVLSTRNODECORE         pavlTypedefs;/*Tree of typedef into entries. */
     173    PAVLSTRNODECORE         pavlFiles;  /* Tree of file into entries. */
     174    unsigned long           ulLastSeq;  /* Last sequence number. */
     175    unsigned short          fCurrent;
     176    const unsigned short    fDefault;
    136177
    137178} KLOGMODDATA, *PKLOGMODDATA;
    138 
    139 
     179#endif /* #ifdef _kAVL_h_ */
     180
     181
     182/**
     183 * The sequence handle on the stack.
     184 */
    140185typedef union kLogSeqHandle
    141186{
     
    156201KBOOL       KLIBCALL kLogInitBuffer(unsigned long cbBufferSize);
    157202
     203#ifdef _kAVL_h_
    158204HKLOGMOD    KLIBCALL kLogInitMod(PKLOGMODDATA pMod, KLOGPOS_DECL);
     205#endif
    159206void        KLIBCALL kLogEntry(HKLOGMOD hLogMod, KLOGPOS_DECL, const char *pszFuncProto, KBOOL fOptlink, ...);
    160207void        KLIBCALL kLogExit(HKLOGMOD hLogMod, KLOGPOS_DECL, const char *pszReturnType, unsigned uReturn);
    161208void        KLIBCALL kLog(HKLOGMOD hLogMod, KLOGPOS_DECL, int iType, ...);
     209#if defined(va_arg) || defined(va_list) || defined(va_start) || defined(va_end)
     210void        KLIBCALL kLogv(HKLOGMOD hLogMod, KLOGPOS_DECL, int iType, va_list args);
     211va_list     KLIBCALL kLogFixPrintf(const char *pszFormat, ...); /* a hack! */
     212#endif
    162213
    163214#define KLOGINITMOD(pMod)                   kLogInitMod(pMod, KLOGPOS_EXT)
    164 #define KLOGENTRY(hLogMod, pszFuncProto)        kLogEntry(hLogMod, KLOGPOS_EXT, pszFuncProto, FALSE)
    165 #define KLOGEXIT(hLogMod, pszType, uValue)      kLogExit(hLogMod, KLOGPOS_EXT, pszType, uValue)
    166 
    167 
    168 #endif
    169 
     215#define KLOGENTRY(hLogMod, pszProto, parg0) kLogEntry(hLogMod, KLOGPOS_EXT, pszFuncProto, FALSE, parg0)
     216#define KLOGEXIT(hLogMod, pszType, uValue)  kLogExit(hLogMod, KLOGPOS_EXT, pszType, uValue)
     217
     218#ifdef __cplusplus
     219}
     220#endif
     221
     222#endif
     223
Note: See TracChangeset for help on using the changeset viewer.