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

[win-pv-devel] [PATCH] Add XENBUS_STORE and XENBUS_SUSPEND interfaces to exported set



To advertise driver distribution information to xenstore XENNET needs to
make use of the XENBUS_STORE and XENBUS_SUSPEND interfaces. As XENVIF is
XENNET's parent driver, it must export them. Adding them to the exported
set also requires update of the PDO revision number.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

Import updated store_interface.h from XENBUS and revised commit comment.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/revision.h        | 11 +++++---
 include/store_interface.h | 68 ++++++++++++++++++++++++++++++++++++++++++++---
 src/coinst/coinst.c       |  2 +-
 src/xenvif/pdo.c          | 32 +++++++++++++++++++---
 4 files changed, 100 insertions(+), 13 deletions(-)

diff --git a/include/revision.h b/include/revision.h
index e2decd0..77d1405 100644
--- a/include/revision.h
+++ b/include/revision.h
@@ -35,10 +35,13 @@
 // Key:
 // C  - XENBUS_CACHE_INTERFACE
 // V  - XENVIF_VIF_INTERFACE
+// ST - XENBUS_STORE_INTERFACE
+// SU - XENBUS_SUSPEND_INTERFACE
 
-//                    REVISION   C   V
-#define DEFINE_REVISION_TABLE               \
-    DEFINE_REVISION(0x08000002,  1,  2),    \
-    DEFINE_REVISION(0x08000003,  1,  3)
+//                    REVISION   C   V   ST  SU
+#define DEFINE_REVISION_TABLE                       \
+    DEFINE_REVISION(0x08000002,  1,  2,  0,  0),    \
+    DEFINE_REVISION(0x08000003,  1,  3,  0,  0),    \
+    DEFINE_REVISION(0x08000004,  1,  3,  2,  1)
 
 #endif  // _REVISION_H
diff --git a/include/store_interface.h b/include/store_interface.h
index 5bcbba3..52f1a1d 100644
--- a/include/store_interface.h
+++ b/include/store_interface.h
@@ -50,6 +50,23 @@ typedef struct _XENBUS_STORE_TRANSACTION    
XENBUS_STORE_TRANSACTION, *PXENBUS_S
 */
 typedef struct _XENBUS_STORE_WATCH          XENBUS_STORE_WATCH, 
*PXENBUS_STORE_WATCH;
 
+/*! \typedef XENBUS_STORE_PERMISSION_MASK
+    \brief Bitmask of XenStore key permissions
+*/
+typedef enum _XENBUS_STORE_PERMISSION_MASK {
+    XENBUS_STORE_PERM_NONE = 0,
+    XENBUS_STORE_PERM_READ = 1,
+    XENBUS_STORE_PERM_WRITE = 2,
+} XENBUS_STORE_PERMISSION_MASK;
+
+/*! \typedef XENBUS_STORE_PERMISSION
+    \brief XenStore key permissions entry for a single domain
+*/
+typedef struct _XENBUS_STORE_PERMISSION {
+    USHORT                          Domain;
+    XENBUS_STORE_PERMISSION_MASK    Mask;
+} XENBUS_STORE_PERMISSION, *PXENBUS_STORE_PERMISSION;
+
 /*! \typedef XENBUS_STORE_ACQUIRE
     \brief Acquire a reference to the STORE interface
 
@@ -247,10 +264,36 @@ typedef VOID
     IN  PINTERFACE  Interface
     );
 
+/*! \typedef XENBUS_STORE_PERMISSIONS_SET
+    \brief Set permissions for a XenStore key
+
+    \param Interface The interface header
+    \param Transaction The transaction handle (NULL if this is not
+    part of a transaction)
+    \param Prefix An optional prefix for the \a Node
+    \param Node The concatenation of the \a Prefix and this value specifies
+    the XenStore key to set permissions of
+    \param Permissions An array of permissions to set
+    \param NumberPermissions Number of elements in the \a Permissions array
+*/
+typedef NTSTATUS
+(*XENBUS_STORE_PERMISSIONS_SET)(
+    IN  PINTERFACE                  Interface,
+    IN  PXENBUS_STORE_TRANSACTION   Transaction OPTIONAL,
+    IN  PCHAR                       Prefix OPTIONAL,
+    IN  PCHAR                       Node,
+    IN  PXENBUS_STORE_PERMISSION    Permissions,
+    IN  ULONG                       NumberPermissions
+    );
+
 // {86824C3B-D34E-4753-B281-2F1E3AD214D7}
 DEFINE_GUID(GUID_XENBUS_STORE_INTERFACE, 
 0x86824c3b, 0xd34e, 0x4753, 0xb2, 0x81, 0x2f, 0x1e, 0x3a, 0xd2, 0x14, 0xd7);
 
+/*! \struct _XENBUS_STORE_INTERFACE_V1
+    \brief STORE interface version 1
+    \ingroup interfaces
+*/
 struct _XENBUS_STORE_INTERFACE_V1 {
     INTERFACE                       Interface;
     XENBUS_STORE_ACQUIRE            StoreAcquire;
@@ -267,11 +310,28 @@ struct _XENBUS_STORE_INTERFACE_V1 {
     XENBUS_STORE_POLL               StorePoll;
 };
 
-/*! \struct _XENBUS_STORE_INTERFACE_V1
-    \brief STORE interface version 1
+/*! \struct _XENBUS_STORE_INTERFACE_V2
+    \brief STORE interface version 2
     \ingroup interfaces
 */
-typedef struct _XENBUS_STORE_INTERFACE_V1 XENBUS_STORE_INTERFACE, 
*PXENBUS_STORE_INTERFACE;
+struct _XENBUS_STORE_INTERFACE_V2 {
+    INTERFACE                       Interface;
+    XENBUS_STORE_ACQUIRE            StoreAcquire;
+    XENBUS_STORE_RELEASE            StoreRelease;
+    XENBUS_STORE_FREE               StoreFree;
+    XENBUS_STORE_READ               StoreRead;
+    XENBUS_STORE_PRINTF             StorePrintf;
+    XENBUS_STORE_PERMISSIONS_SET    StorePermissionsSet;
+    XENBUS_STORE_REMOVE             StoreRemove;
+    XENBUS_STORE_DIRECTORY          StoreDirectory;
+    XENBUS_STORE_TRANSACTION_START  StoreTransactionStart;
+    XENBUS_STORE_TRANSACTION_END    StoreTransactionEnd;
+    XENBUS_STORE_WATCH_ADD          StoreWatchAdd;
+    XENBUS_STORE_WATCH_REMOVE       StoreWatchRemove;
+    XENBUS_STORE_POLL               StorePoll;
+};
+
+typedef struct _XENBUS_STORE_INTERFACE_V2 XENBUS_STORE_INTERFACE, 
*PXENBUS_STORE_INTERFACE;
 
 /*! \def XENBUS_STORE
     \brief Macro at assist in method invocation
@@ -282,7 +342,7 @@ typedef struct _XENBUS_STORE_INTERFACE_V1 
XENBUS_STORE_INTERFACE, *PXENBUS_STORE
 #endif  // _WINDLL
 
 #define XENBUS_STORE_INTERFACE_VERSION_MIN  1
-#define XENBUS_STORE_INTERFACE_VERSION_MAX  1
+#define XENBUS_STORE_INTERFACE_VERSION_MAX  2
 
 #endif  // _XENBUS_STORE_INTERFACE_H
 
diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c
index 156a6a3..0d792f7 100644
--- a/src/coinst/coinst.c
+++ b/src/coinst/coinst.c
@@ -717,7 +717,7 @@ fail1:
     return FALSE;
 }
 
-#define DEFINE_REVISION(_N, _C, _V) \
+#define DEFINE_REVISION(_N, _C, _V, _ST, _SU) \
     (_N)
 
 static DWORD    DeviceRevision[] = {
diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 53bed7a..07cf23a 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -534,10 +534,12 @@ typedef struct _XENVIF_PDO_REVISION {
     ULONG   Number;
     ULONG   CacheInterfaceVersion;
     ULONG   VifInterfaceVersion;
+    ULONG   StoreInterfaceVersion;
+    ULONG   SuspendInterfaceVersion;
 } XENVIF_PDO_REVISION, *PXENVIF_PDO_REVISION;
 
-#define DEFINE_REVISION(_N, _C, _V) \
-    { (_N), (_C), (_V) }
+#define DEFINE_REVISION(_N, _C, _V, _ST, _SU) \
+    { (_N), (_C), (_V), (_ST), (_SU) }
 
 static XENVIF_PDO_REVISION PdoRevision[] = {
     DEFINE_REVISION_TABLE
@@ -567,14 +569,34 @@ PdoDumpRevisions(
         ASSERT(IMPLY(Index == ARRAYSIZE(PdoRevision) - 1,
                      Revision->VifInterfaceVersion == 
XENVIF_VIF_INTERFACE_VERSION_MAX));
 
+        if (Revision->StoreInterfaceVersion == 0) { // not-supported
+            ASSERT(Index != ARRAYSIZE(PdoRevision) - 1);
+            goto show_revision;
+        }
+
+        ASSERT3U(Revision->StoreInterfaceVersion, >=, 
XENBUS_STORE_INTERFACE_VERSION_MIN);
+        ASSERT3U(Revision->StoreInterfaceVersion, <=, 
XENBUS_STORE_INTERFACE_VERSION_MAX);
+        ASSERT(IMPLY(Index == ARRAYSIZE(PdoRevision) - 1,
+                     Revision->StoreInterfaceVersion == 
XENBUS_STORE_INTERFACE_VERSION_MAX));
+
+        ASSERT3U(Revision->SuspendInterfaceVersion, >=, 
XENBUS_SUSPEND_INTERFACE_VERSION_MIN);
+        ASSERT3U(Revision->SuspendInterfaceVersion, <=, 
XENBUS_SUSPEND_INTERFACE_VERSION_MAX);
+        ASSERT(IMPLY(Index == ARRAYSIZE(PdoRevision) - 1,
+                     Revision->SuspendInterfaceVersion == 
XENBUS_SUSPEND_INTERFACE_VERSION_MAX));
+
+show_revision:
         ASSERT3U(Revision->Number >> 24, ==, MAJOR_VERSION);
 
         Info("%08X -> "
              "CACHE v%u "
-             "VIF v%u\n",
+             "VIF v%u "
+             "STORE v%u "
+             "SUSPEND v%u\n",
              Revision->Number,
              Revision->CacheInterfaceVersion,
-             Revision->VifInterfaceVersion);
+             Revision->VifInterfaceVersion,
+             Revision->StoreInterfaceVersion,
+             Revision->SuspendInterfaceVersion);
     }
 }
 
@@ -1628,6 +1650,8 @@ struct _INTERFACE_ENTRY PdoInterfaceTable[] = {
     { &GUID_BUS_INTERFACE_STANDARD, "BUS_INTERFACE", PdoQueryBusInterface },
     { &GUID_XENVIF_VIF_INTERFACE, "VIF_INTERFACE", PdoQueryVifInterface },
     { &GUID_XENBUS_CACHE_INTERFACE, "CACHE_INTERFACE", PdoDelegateIrp },
+    { &GUID_XENBUS_STORE_INTERFACE, "STORE_INTERFACE", PdoDelegateIrp },
+    { &GUID_XENBUS_SUSPEND_INTERFACE, "SUSPEND_INTERFACE", PdoDelegateIrp },
     { NULL, NULL, NULL }
 };
 
-- 
2.1.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®.