[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 18/20] Add IOCTL_XENIFACE_LOG to dump a log message to Dom0



Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 include/xeniface_ioctls.h  |  9 +++++++++
 src/xeniface/ioctl_store.c | 29 +++++++++++++++++++++++++++++
 src/xeniface/ioctls.c      |  5 +++++
 src/xeniface/ioctls.h      |  8 ++++++++
 4 files changed, 51 insertions(+)

diff --git a/include/xeniface_ioctls.h b/include/xeniface_ioctls.h
index b2631f6..d6d1f03 100644
--- a/include/xeniface_ioctls.h
+++ b/include/xeniface_ioctls.h
@@ -369,4 +369,13 @@ typedef struct _XENIFACE_SUSPEND_REGISTER_OUT {
 #define IOCTL_XENIFACE_SHAREDINFO_GET_TIME \
     CTL_CODE(FILE_DEVICE_UNKNOWN, 0x840, METHOD_BUFFERED, FILE_ANY_ACCESS)
 
+/*! \brief Logs a message to Dom0
+
+    Input: NUL-terminated CHAR array containing the message to log
+
+    Output: None
+*/
+#define IOCTL_XENIFACE_LOG \
+    CTL_CODE(FILE_DEVICE_UNKNOWN, 0x84F, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
 #endif // _XENIFACE_IOCTLS_H_
diff --git a/src/xeniface/ioctl_store.c b/src/xeniface/ioctl_store.c
index 5bd4649..f1c816b 100644
--- a/src/xeniface/ioctl_store.c
+++ b/src/xeniface/ioctl_store.c
@@ -91,6 +91,35 @@ __DisplayMultiSz(
 
 DECLSPEC_NOINLINE
 NTSTATUS
+IoctlLog(
+    __in  PXENIFACE_FDO     Fdo,
+    __in  PCHAR             Buffer,
+    __in  ULONG             InLen,
+    __in  ULONG             OutLen
+    )
+{
+    NTSTATUS    status;
+
+    status = STATUS_INVALID_BUFFER_SIZE;
+    if (InLen == 0 || OutLen != 0)
+        goto fail1;
+
+    status = STATUS_INVALID_PARAMETER;
+    if (!__IsValidStr(Buffer, InLen))
+        goto fail2;
+
+    XenIfaceDebugPrint(INFO, "USER: %s\n", Buffer);
+    return STATUS_SUCCESS;
+
+fail2:
+    XenIfaceDebugPrint(ERROR, "Fail2\n");
+fail1:
+    XenIfaceDebugPrint(ERROR, "Fail1 (%08x)\n", status);
+    return status;
+}
+
+DECLSPEC_NOINLINE
+NTSTATUS
 IoctlStoreRead(
     __in  PXENIFACE_FDO     Fdo,
     __in  PCHAR             Buffer,
diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c
index 928c2be..7f172d7 100644
--- a/src/xeniface/ioctls.c
+++ b/src/xeniface/ioctls.c
@@ -262,6 +262,11 @@ XenIfaceIoctl(
         status = IoctlSharedInfoGetTime(Fdo, Buffer, InLen, OutLen, 
&Irp->IoStatus.Information);
         break;
 
+        // misc
+    case IOCTL_XENIFACE_LOG:
+        status = IoctlLog(Fdo, Buffer, InLen, OutLen);
+        break;
+
     default:
         status = STATUS_INVALID_DEVICE_REQUEST;
         break;
diff --git a/src/xeniface/ioctls.h b/src/xeniface/ioctls.h
index c1d7c0f..d08ffb4 100644
--- a/src/xeniface/ioctls.h
+++ b/src/xeniface/ioctls.h
@@ -418,5 +418,13 @@ IoctlSharedInfoGetTime(
     __out PULONG_PTR        Info
     );
 
+NTSTATUS
+IoctlLog(
+    __in  PXENIFACE_FDO     Fdo,
+    __in  PCHAR             Buffer,
+    __in  ULONG             InLen,
+    __in  ULONG             OutLen
+    );
+
 #endif // _IOCTLS_H_
 
-- 
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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.