[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH 3/4] Add SharedInfo IOCTL interface
> -----Original Message----- > From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On > Behalf Of Owen Smith > Sent: 28 June 2016 11:36 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Owen Smith > Subject: [win-pv-devel] [PATCH 3/4] Add SharedInfo IOCTL interface > > Adds IOCTLs for: > * GetTime - returns Xen wallclock time > > Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> It's a nit, but I prefer SHARED_INFO or shared_info when not using CamelCase. I'll fix it up on commit so... Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> > --- > include/xeniface_ioctls.h | 9 ++++++ > src/xeniface/ioctl_sharedinfo.c | 68 > ++++++++++++++++++++++++++++++++++++++++ > src/xeniface/ioctls.c | 6 ++++ > src/xeniface/ioctls.h | 9 ++++++ > vs2012/xeniface/xeniface.vcxproj | 1 + > vs2013/xeniface/xeniface.vcxproj | 1 + > 6 files changed, 94 insertions(+) > create mode 100644 src/xeniface/ioctl_sharedinfo.c > > diff --git a/include/xeniface_ioctls.h b/include/xeniface_ioctls.h > index 5f65f14..dcddb5e 100644 > --- a/include/xeniface_ioctls.h > +++ b/include/xeniface_ioctls.h > @@ -360,4 +360,13 @@ typedef struct > _XENIFACE_SUSPEND_REGISTER_OUT { > #define IOCTL_XENIFACE_SUSPEND_DEREGISTER \ > CTL_CODE(FILE_DEVICE_UNKNOWN, 0x832, METHOD_BUFFERED, > FILE_ANY_ACCESS) > > +/*! \brief Gets the current time. > + > + Input: None > + > + Output: LARGE_INTEGER > +*/ > +#define IOCTL_XENIFACE_SHAREDINFO_GET_TIME \ > + CTL_CODE(FILE_DEVICE_UNKNOWN, 0x840, METHOD_BUFFERED, > FILE_ANY_ACCESS) > + > #endif // _XENIFACE_IOCTLS_H_ > diff --git a/src/xeniface/ioctl_sharedinfo.c b/src/xeniface/ioctl_sharedinfo.c > new file mode 100644 > index 0000000..c9dfe65 > --- /dev/null > +++ b/src/xeniface/ioctl_sharedinfo.c > @@ -0,0 +1,68 @@ > +/* Copyright (c) Citrix Systems Inc. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, > + * with or without modification, are permitted provided > + * that the following conditions are met: > + * > + * * Redistributions of source code must retain the above > + * copyright notice, this list of conditions and the > + * following disclaimer. > + * * Redistributions in binary form must reproduce the above > + * copyright notice, this list of conditions and the > + * following disclaimer in the documentation and/or other > + * materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, > + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR > + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, > + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING > + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#include "driver.h" > +#include "ioctls.h" > +#include "xeniface_ioctls.h" > +#include "log.h" > + > +DECLSPEC_NOINLINE > +NTSTATUS > +IoctlSharedInfoGetTime( > + __in PXENIFACE_FDO Fdo, > + __in PCHAR Buffer, > + __in ULONG InLen, > + __in ULONG OutLen, > + __out PULONG_PTR Info > + ) > +{ > + NTSTATUS status; > + PLARGE_INTEGER Value; > + > + status = STATUS_INVALID_BUFFER_SIZE; > + if (InLen != 0) > + goto fail1; > + > + if (OutLen != sizeof(LARGE_INTEGER)) > + goto fail2; > + > + Value = (PLARGE_INTEGER)Buffer; > + *Value = XENBUS_SHARED_INFO(GetTime, &Fdo->SharedInfoInterface); > + *Info = (ULONG_PTR)sizeof(LARGE_INTEGER); > + > + return STATUS_SUCCESS; > + > +fail2: > + XenIfaceDebugPrint(ERROR, "Fail2\n"); > +fail1: > + XenIfaceDebugPrint(ERROR, "Fail1 (%08x)\n", status); > + return status; > +} > diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c > index 2df299c..7092a56 100644 > --- a/src/xeniface/ioctls.c > +++ b/src/xeniface/ioctls.c > @@ -257,6 +257,12 @@ XenIfaceIoctl( > status = IoctlSuspendDeregister(Fdo, Buffer, InLen, OutLen, Stack- > >FileObject); > break; > > + // sharedinfo > + case IOCTL_XENIFACE_SHAREDINFO_GET_TIME: > + status = IoctlSharedInfoGetTime(Fdo, Buffer, InLen, OutLen, &Irp- > >IoStatus.Information); > + break; > + > + > default: > status = STATUS_INVALID_DEVICE_REQUEST; > break; > diff --git a/src/xeniface/ioctls.h b/src/xeniface/ioctls.h > index 7dd34ee..d06f6b5 100644 > --- a/src/xeniface/ioctls.h > +++ b/src/xeniface/ioctls.h > @@ -409,5 +409,14 @@ SuspendFreeEvent( > __inout PXENIFACE_SUSPEND_CONTEXT Context > ); > > +NTSTATUS > +IoctlSharedInfoGetTime( > + __in PXENIFACE_FDO Fdo, > + __in PCHAR Buffer, > + __in ULONG InLen, > + __in ULONG OutLen, > + __out PULONG_PTR Info > + ); > + > #endif // _IOCTLS_H_ > > diff --git a/vs2012/xeniface/xeniface.vcxproj > b/vs2012/xeniface/xeniface.vcxproj > index ff70eb0..bb344e4 100644 > --- a/vs2012/xeniface/xeniface.vcxproj > +++ b/vs2012/xeniface/xeniface.vcxproj > @@ -79,6 +79,7 @@ > <ClCompile Include="..\..\src\xeniface\fdo.c" /> > <ClCompile Include="..\..\src\xeniface\registry.c" /> > <ClCompile Include="..\..\src\xeniface\thread.c" /> > + <ClCompile Include="..\..\src\xeniface\ioctl_sharedinfo.c" /> > <ClCompile Include="..\..\src\xeniface\ioctl_suspend.c" /> > <ClCompile Include="..\..\src\xeniface\ioctl_evtchn.c" /> > <ClCompile Include="..\..\src\xeniface\ioctl_gnttab.c" /> > diff --git a/vs2013/xeniface/xeniface.vcxproj > b/vs2013/xeniface/xeniface.vcxproj > index 3a3a937..c6232e4 100644 > --- a/vs2013/xeniface/xeniface.vcxproj > +++ b/vs2013/xeniface/xeniface.vcxproj > @@ -131,6 +131,7 @@ > <ClCompile Include="..\..\src\xeniface\fdo.c" /> > <ClCompile Include="..\..\src\xeniface\registry.c" /> > <ClCompile Include="..\..\src\xeniface\thread.c" /> > + <ClCompile Include="..\..\src\xeniface\ioctl_sharedinfo.c" /> > <ClCompile Include="..\..\src\xeniface\ioctl_suspend.c" /> > <ClCompile Include="..\..\src\xeniface\ioctl_evtchn.c" /> > <ClCompile Include="..\..\src\xeniface\ioctl_gnttab.c" /> > -- > 1.9.4.msysgit.1 > > > _______________________________________________ > win-pv-devel mailing list > win-pv-devel@xxxxxxxxxxxxxxxxxxxx > http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |