win-pvdrivers

changeset 21:e2d29b60b744

xennet: save path and backend path to xennet_info
author Andy Grover <andy@groveronline.com>
date Thu Nov 29 16:06:20 2007 -0800 (2007-11-29)
parents 1414d099b564
children 2e1ad5552529
files xennet/xennet.c
line diff
     1.1 --- a/xennet/xennet.c	Thu Nov 29 16:05:24 2007 -0800
     1.2 +++ b/xennet/xennet.c	Thu Nov 29 16:06:20 2007 -0800
     1.3 @@ -148,6 +148,10 @@ XenNet_Init(
     1.4    struct xennet_info *xi = NULL;
     1.5    ULONG length;
     1.6    WDF_OBJECT_ATTRIBUTES wdf_attrs;
     1.7 +  char *msg;
     1.8 +  char *Value;
     1.9 +  char **vif_devs;
    1.10 +  char TmpPath[128];
    1.11  
    1.12    UNREFERENCED_PARAMETER(OpenErrorStatus);
    1.13    UNREFERENCED_PARAMETER(WrapperConfigurationContext);
    1.14 @@ -273,25 +277,46 @@ XenNet_Init(
    1.15      xi->GntTblInterface.InterfaceHeader.Context, 0,
    1.16      *MmGetMdlPfnArray(xi->rx_mdl), FALSE);
    1.17  
    1.18 -  {
    1.19 -  char *msg;
    1.20 -  char **vif_devs;
    1.21 -  char buffer[128];
    1.22 -  // get mac addr
    1.23    msg = xi->XenBusInterface.List(xi->EvtChnInterface.InterfaceHeader.Context,
    1.24      XBT_NIL, "device/vif", &vif_devs);
    1.25 -  if (!msg)
    1.26 +  if (msg)
    1.27    {
    1.28 -    for (i = 0; vif_devs[i]; i++)
    1.29 +    KdPrint((__DRIVER_NAME ": " __FUNCTION__ ": List retval is nonzero!\n"));
    1.30 +    status = NDIS_STATUS_FAILURE;
    1.31 +    goto err;
    1.32 +  }
    1.33 +
    1.34 +  for (i = 0; vif_devs[i]; i++)
    1.35 +  {
    1.36 +    if (i > 0)
    1.37      {
    1.38 -      RtlStringCbPrintfA(buffer, ARRAY_SIZE(buffer),
    1.39 -        "device/vif/%s/state", vif_devs[i]);
    1.40 -      KdPrint(("%s\n", buffer));
    1.41 -      //XenVbd_HotPlugHandler(buffer, NULL);
    1.42 -      //ExFreePoolWithTag(bdDevices[i], XENPCI_POOL_TAG);
    1.43 +      KdPrint((__DRIVER_NAME "Can only handle 1 vif so far, ignoring vif %s\n", vif_devs[i]));
    1.44 +      continue;
    1.45      }
    1.46 +    RtlStringCbPrintfA(xi->Path, ARRAY_SIZE(xi->Path), "device/vif/%s", vif_devs[i]);
    1.47 +
    1.48 +    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath),
    1.49 +      "device/vif/%s/state", vif_devs[i]);
    1.50 +    KdPrint(("%s\n", TmpPath));
    1.51 +
    1.52 +    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath), "%s/backend", xi->Path);
    1.53 +    xi->XenBusInterface.Read(xi->XenBusInterface.InterfaceHeader.Context,
    1.54 +      XBT_NIL, TmpPath, &Value);
    1.55 +    if (!Value)
    1.56 +    {
    1.57 +      KdPrint((__DRIVER_NAME "     Read Failed\n"));
    1.58 +    }
    1.59 +    else
    1.60 +    {
    1.61 +      RtlStringCbCopyA(xi->BackendPath, ARRAY_SIZE(xi->BackendPath), Value);
    1.62 +      KdPrint((__DRIVER_NAME "backend path = %s\n", xi->BackendPath));
    1.63 +    }
    1.64 +    ExFreePool(Value);
    1.65 +
    1.66 +    //XenVbd_HotPlugHandler(buffer, NULL);
    1.67 +    //ExFreePoolWithTag(bdDevices[i], XENPCI_POOL_TAG);
    1.68    }
    1.69 -  }
    1.70 +  ExFreePool(vif_devs);
    1.71  
    1.72    return NDIS_STATUS_SUCCESS;
    1.73