[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH] Add registry overrides for features
> -----Original Message----- > From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On > Behalf Of owen.smith@xxxxxxxxxx > Sent: 02 February 2017 14:08 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Owen Smith <owen.smith@xxxxxxxxxx> > Subject: [win-pv-devel] [PATCH] Add registry overrides for features > > From: Owen Smith <owen.smith@xxxxxxxxxx> > > * Add a REG_DWORD to XenVbd's Parameters key, with names based > on the features, as per xenstore value, and set to 0 to > override use of that feature. > > For example, > "HKLM\System\CCS\Services\XenVbd\Parameters" "feature-barrier" 0 > will prevent the frontend issuing BLKIF_OP_WRITE_BARRIERs > "HKLM\System\CCS\Services\XenVbd\Parameters" "feature-discard" 0 > will prevent the frontend issuing BLKIF_OP_DISCARDs > > Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> > --- > src/xenvbd/driver.c | 16 ++++++++++++++++ > src/xenvbd/driver.h | 5 +++++ > src/xenvbd/frontend.c | 37 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 58 insertions(+) > > diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c > index 114c740..1f713c4 100644 > --- a/src/xenvbd/driver.c > +++ b/src/xenvbd/driver.c > @@ -82,6 +82,22 @@ __DriverParseOption( > RegistryFreeSzValue(Option); > } > > +static FORCEINLINE HANDLE > +__DriverGetParametersKey( > + VOID > + ) > +{ > + return Driver.ParametersKey; > +} > + > +HANDLE > +DriverGetParametersKey( > + VOID > + ) > +{ > + return __DriverGetParametersKey(); > +} > + > NTSTATUS > DriverDispatchPnp( > IN PDEVICE_OBJECT DeviceObject, > diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h > index cf55330..e7730a9 100644 > --- a/src/xenvbd/driver.h > +++ b/src/xenvbd/driver.h > @@ -57,6 +57,11 @@ typedef struct _XENVBD_PARAMETERS { > > extern XENVBD_PARAMETERS DriverParameters; > > +extern HANDLE > +DriverGetParametersKey( > + VOID > + ); > + > extern NTSTATUS > DriverDispatchPnp( > IN PDEVICE_OBJECT DeviceObject, > diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c > index 11e9121..e141f92 100644 > --- a/src/xenvbd/frontend.c > +++ b/src/xenvbd/frontend.c > @@ -30,6 +30,7 @@ > */ > > #include "frontend.h" > +#include "registry.h" > #include "driver.h" > #include "fdo.h" > #include "pdoinquiry.h" > @@ -621,6 +622,8 @@ FrontendReadFeature( > { > NTSTATUS status; > PCHAR Buffer; > + ULONG Override; > + HANDLE Key; > BOOLEAN Old = *Value; > > status = XENBUS_STORE(Read, > @@ -637,6 +640,18 @@ FrontendReadFeature( > Frontend->Store, > Buffer); > > + // check registry for disable-override > + Key = DriverGetParametersKey(); > + if (Key != NULL) { I don't think Key can be NULL here can it? IIRC DriverEntry() will fail if there's no parameters key. Paul > + status = RegistryQueryDwordValue(Key, > + Name, > + &Override); > + if (NT_SUCCESS(status)) { > + if (Override == 0) > + *Value = FALSE; > + } > + } > + > return Old != *Value; > } > > @@ -644,11 +659,14 @@ static FORCEINLINE BOOLEAN > FrontendReadValue32( > IN PXENVBD_FRONTEND Frontend, > IN PCHAR Name, > + IN BOOLEAN AllowOverride, > IN PULONG Value > ) > { > NTSTATUS status; > PCHAR Buffer; > + HANDLE Key; > + ULONG Override; > ULONG Old = *Value; > > status = XENBUS_STORE(Read, > @@ -665,6 +683,19 @@ FrontendReadValue32( > Frontend->Store, > Buffer); > > + // check registry for disable-override > + if (AllowOverride) { > + Key = DriverGetParametersKey(); > + if (Key != NULL) { > + status = RegistryQueryDwordValue(Key, > + Name, > + &Override); > + if (NT_SUCCESS(status)) { > + *Value = Override; > + } > + } > + } > + > return Old != *Value; > } > > @@ -727,12 +758,15 @@ __ReadDiskInfo( > > Changed |= FrontendReadValue32(Frontend, > "info", > + FALSE, > &Frontend->DiskInfo.DiskInfo); > Changed |= FrontendReadValue32(Frontend, > "sector-size", > + FALSE, > &Frontend->DiskInfo.SectorSize); > Changed |= FrontendReadValue32(Frontend, > "physical-sector-size", > + FALSE, > &Frontend->DiskInfo.PhysSectorSize); > Changed |= FrontendReadValue64(Frontend, > "sectors", > @@ -780,6 +814,7 @@ FrontendReadFeatures( > &Frontend->Caps.Removable); > Changed |= FrontendReadValue32(Frontend, > "feature-max-indirect-segments", > + TRUE, > &Frontend->Features.Indirect); > Changed |= FrontendReadFeature(Frontend, > "feature-persistent", > @@ -821,9 +856,11 @@ FrontendReadDiskInfo( > &Frontend->DiskInfo.DiscardSecure); > Changed |= FrontendReadValue32(Frontend, > "discard-alignment", > + TRUE, > &Frontend->DiskInfo.DiscardAlignment); > Changed |= FrontendReadValue32(Frontend, > "discard-granularity", > + TRUE, > &Frontend->DiskInfo.DiscardGranularity); > > if (!Changed) > -- > 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 |