[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH] Add override for console log level
> -----Original Message----- > From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On > Behalf Of owen.smith@xxxxxxxxxx > Sent: 13 July 2017 12:46 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Owen Smith <owen.smith@xxxxxxxxxx> > Subject: [win-pv-devel] [PATCH] Add override for console log level > > From: Owen Smith <owen.smith@xxxxxxxxxx> > > Use the registry DWORD value called "ConsoleLogLevel" at > "HKLM\System\CurrentControlSet\services\xenbus\Parameters" to > override the default console logging output of: > LOG_LEVEL_INFO | LOG_LEVEL_WARNING | LOG_LEVEL_ERROR | > LOG_LEVEL_CRITICAL > > Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> > --- > src/xenbus/driver.c | 39 +++++++++++++++++++++++++++++++++++++++ > src/xenbus/driver.h | 5 +++++ > src/xenbus/fdo.c | 17 +++++++++-------- > 3 files changed, 53 insertions(+), 8 deletions(-) > > diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c > index bbbda6c..270b60f 100644 > --- a/src/xenbus/driver.c > +++ b/src/xenbus/driver.c > @@ -48,6 +48,7 @@ > typedef struct _XENBUS_DRIVER { > PDRIVER_OBJECT DriverObject; > HANDLE ParametersKey; > + ULONG ConsoleLogLevel; > > MUTEX Mutex; > LIST_ENTRY List; > @@ -122,6 +123,30 @@ DriverGetParametersKey( > return __DriverGetParametersKey(); > } > > +static FORCEINLINE VOID > +__DriverSetConsoleLogLevel( > + IN ULONG LogLevel > + ) > +{ > + Driver.ConsoleLogLevel = LogLevel; > +} > + > +static FORCEINLINE ULONG > +__DriverGetConsoleLogLevel( > + VOID > + ) > +{ > + return Driver.ConsoleLogLevel; > +} > + > +ULONG > +DriverGetConsoleLogLevel( > + VOID > + ) > +{ > + return __DriverGetConsoleLogLevel(); > +} > + > #define MAXNAMELEN 128 > > static FORCEINLINE VOID > @@ -568,6 +593,8 @@ DriverUnload( > RtlZeroMemory(&Driver.List, sizeof (LIST_ENTRY)); > RtlZeroMemory(&Driver.Mutex, sizeof (MUTEX)); > > + __DriverSetConsoleLogLevel(0); > + > ParametersKey = __DriverGetParametersKey(); > > RegistryCloseKey(ParametersKey); > @@ -680,6 +707,7 @@ DriverEntry( > HANDLE ServiceKey; > HANDLE ParametersKey; > ULONG Index; > + ULONG LogLevel; > NTSTATUS status; > > ASSERT3P(__DriverGetDriverObject(), ==, NULL); > @@ -721,6 +749,17 @@ DriverEntry( > > __DriverSetParametersKey(ParametersKey); > > + status = RegistryQueryDwordValue(ParametersKey, > + "ConsoleLogLevel", > + &LogLevel); > + if (!NT_SUCCESS(status)) > + LogLevel = (ULONG)(LOG_LEVEL_INFO | > + LOG_LEVEL_WARNING | > + LOG_LEVEL_ERROR | > + LOG_LEVEL_CRITICAL); > + > + __DriverSetConsoleLogLevel(LogLevel); > + A DWORD is not the most friendly thing here. It means that someone has to look up values in a header file to know what to set. I think a multi-string of "info", "warning", "error" and/or "critical" would be better. The INF file could populate the default. It might also be useful to pull the parsing into xen logging code (rather than xenbus code) as it could then be re-used for registry keys to configure Xen and QEMU logging too. Paul > RegistryCloseKey(ServiceKey); > > status = XenTouch(__MODULE__, > diff --git a/src/xenbus/driver.h b/src/xenbus/driver.h > index dd81e4c..5f26c0d 100644 > --- a/src/xenbus/driver.h > +++ b/src/xenbus/driver.h > @@ -42,6 +42,11 @@ DriverGetParametersKey( > VOID > ); > > +extern ULONG > +DriverGetConsoleLogLevel( > + VOID > + ); > + > extern VOID > DriverRequestReboot( > VOID > diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c > index 0aeea3d..d44521b 100644 > --- a/src/xenbus/fdo.c > +++ b/src/xenbus/fdo.c > @@ -2656,6 +2656,7 @@ __FdoD3ToD0( > IN PXENBUS_FDO Fdo > ) > { > + ULONG LogLevel; > NTSTATUS status; > > Trace("====>\n"); > @@ -2680,14 +2681,14 @@ __FdoD3ToD0( > Fdo->Channel, > FALSE); > > - status = LogAddDisposition(LOG_LEVEL_INFO | > - LOG_LEVEL_WARNING | > - LOG_LEVEL_ERROR | > - LOG_LEVEL_CRITICAL, > - FdoOutputBuffer, > - Fdo, > - &Fdo->LogDisposition); > - ASSERT(NT_SUCCESS(status)); > + LogLevel = DriverGetConsoleLogLevel(); > + if (LogLevel != 0) { > + status = LogAddDisposition(LogLevel, > + FdoOutputBuffer, > + Fdo, > + &Fdo->LogDisposition); > + ASSERT(NT_SUCCESS(status)); > + } > > status = XENBUS_STORE(WatchAdd, > &Fdo->StoreInterface, > -- > 2.8.3 > > > _______________________________________________ > win-pv-devel mailing list > win-pv-devel@xxxxxxxxxxxxxxxxxxxx > https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |