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

Re: [win-pv-devel] [PATCH 10/10] Tidy up target.h



> -----Original Message-----
> From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
> Behalf Of owen.smith@xxxxxxxxxx
> Sent: 23 June 2017 13:49
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith <owen.smith@xxxxxxxxxx>
> Subject: [win-pv-devel] [PATCH 10/10] Tidy up target.h
> 
> From: Owen Smith <owen.smith@xxxxxxxxxx>
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

> ---
>  src/xenvbd/adapter.c |  2 +-
>  src/xenvbd/target.c  | 99 +++++++++++++++++++++++++----------------------
> -----
>  src/xenvbd/target.h  | 42 +++++++---------------
>  3 files changed, 60 insertions(+), 83 deletions(-)
> 
> diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c
> index 55a1962..2f4cf9c 100644
> --- a/src/xenvbd/adapter.c
> +++ b/src/xenvbd/adapter.c
> @@ -450,7 +450,7 @@ __AdapterEnumerate(
>              }
>          }
> 
> -        if (Missing && !TargetIsMissing(Target)) {
> +        if (Missing && !TargetGetMissing(Target)) {
>              TargetSetMissing(Target, "Device Disappeared");
>              if (TargetGetDevicePnpState(Target) == Present)
>                  TargetSetDevicePnpState(Target, Deleted);
> diff --git a/src/xenvbd/target.c b/src/xenvbd/target.c
> index 2527360..ffffa3e 100644
> --- a/src/xenvbd/target.c
> +++ b/src/xenvbd/target.c
> @@ -246,8 +246,6 @@ __PnpStateName(
>      }
>  }
> 
> -
> //=========================================================
> ====================
> -// Power States
>  __checkReturn
>  static FORCEINLINE BOOLEAN
>  TargetSetDevicePowerState(
> @@ -269,49 +267,36 @@ TargetSetDevicePowerState(
>      return Changed;
>  }
> 
> -
> //=========================================================
> ====================
> -// PnP States
> -FORCEINLINE VOID
> +VOID
>  TargetSetMissing(
> -    __in PXENVBD_TARGET             Target,
> -    __in __nullterminated const CHAR* Reason
> +    IN  PXENVBD_TARGET  Target,
> +    IN  const CHAR      *Reason
>      )
>  {
> -    KIRQL   Irql;
> +    KIRQL               Irql;
> 
>      ASSERT3P(Reason, !=, NULL);
> 
>      KeAcquireSpinLock(&Target->Lock, &Irql);
>      if (Target->Missing) {
> -        Verbose("Target[%d] : Already MISSING (%s) when trying to set
> (%s)\n", TargetGetTargetId(Target), Target->Reason, Reason);
> +        Verbose("Target[%d] : Already MISSING (%s) when trying to set
> (%s)\n",
> +                TargetGetTargetId(Target),
> +                Target->Reason,
> +                Reason);
>      } else {
> -        Verbose("Target[%d] : MISSING %s\n", TargetGetTargetId(Target),
> Reason);
> +        Verbose("Target[%d] : MISSING %s\n",
> +                TargetGetTargetId(Target),
> +                Reason);
>          Target->Missing = TRUE;
>          Target->Reason = Reason;
>      }
>      KeReleaseSpinLock(&Target->Lock, Irql);
>  }
> 
> -__checkReturn
> -FORCEINLINE BOOLEAN
> -TargetIsMissing(
> -    __in PXENVBD_TARGET             Target
> -    )
> -{
> -    KIRQL   Irql;
> -    BOOLEAN Missing;
> -
> -    KeAcquireSpinLock(&Target->Lock, &Irql);
> -    Missing = Target->Missing;
> -    KeReleaseSpinLock(&Target->Lock, Irql);
> -
> -    return Missing;
> -}
> -
> -FORCEINLINE VOID
> +VOID
>  TargetSetDevicePnpState(
> -    __in PXENVBD_TARGET             Target,
> -    __in DEVICE_PNP_STATE        State
> +    IN  PXENVBD_TARGET      Target,
> +    IN  DEVICE_PNP_STATE    State
>      )
>  {
>      Verbose("Target[%d] : PNP %s to %s\n",
> @@ -326,15 +311,6 @@ TargetSetDevicePnpState(
>      Target->DevicePnpState = State;
>  }
> 
> -__checkReturn
> -FORCEINLINE DEVICE_PNP_STATE
> -TargetGetDevicePnpState(
> -    __in PXENVBD_TARGET             Target
> -    )
> -{
> -    return Target->DevicePnpState;
> -}
> -
>  static FORCEINLINE VOID
>  __TargetRestoreDevicePnpState(
>      __in PXENVBD_TARGET             Target,
> @@ -347,26 +323,27 @@ __TargetRestoreDevicePnpState(
>      }
>  }
> 
> -FORCEINLINE VOID
> +VOID
>  TargetSetDeviceObject(
> -    __in PXENVBD_TARGET             Target,
> -    __in PDEVICE_OBJECT          DeviceObject
> +    IN  PXENVBD_TARGET  Target,
> +    IN  PDEVICE_OBJECT  DeviceObject
>      )
>  {
> -    Verbose("Target[%d] : Setting DeviceObject = 0x%p\n",
> TargetGetTargetId(Target), DeviceObject);
> +    Verbose("Target[%d] : Setting DeviceObject = 0x%p\n",
> +            TargetGetTargetId(Target),
> +            DeviceObject);
> 
>      ASSERT3P(Target->DeviceObject, ==, NULL);
>      Target->DeviceObject = DeviceObject;
>  }
> 
> -__checkReturn
> -FORCEINLINE BOOLEAN
> +static FORCEINLINE BOOLEAN
>  TargetIsPaused(
> -    __in PXENVBD_TARGET             Target
> +    IN  PXENVBD_TARGET  Target
>      )
>  {
> -    BOOLEAN Paused;
> -    KIRQL   Irql;
> +    BOOLEAN             Paused;
> +    KIRQL               Irql;
> 
>      KeAcquireSpinLock(&Target->Lock, &Irql);
>      Paused = (Target->Paused > 0);
> @@ -1279,7 +1256,7 @@ BlkifOperationName(
> 
>  VOID
>  TargetSubmitRequests(
> -    __in PXENVBD_TARGET             Target
> +    IN  PXENVBD_TARGET  Target
>      )
>  {
>      for (;;) {
> @@ -1302,9 +1279,9 @@ TargetSubmitRequests(
> 
>  VOID
>  TargetCompleteResponse(
> -    __in PXENVBD_TARGET             Target,
> -    __in ULONG                   Tag,
> -    __in SHORT                   Status
> +    IN  PXENVBD_TARGET  Target,
> +    IN  ULONG           Tag,
> +    IN  SHORT           Status
>      )
>  {
>      PXENVBD_REQUEST     Request;
> @@ -1772,7 +1749,7 @@ __ValidateSrbForTarget(
>          return FALSE;
>      }
> 
> -    if (TargetIsMissing(Target)) {
> +    if (TargetGetMissing(Target)) {
>          Error("Target[%d] : %s (%s) (%02x:%s)\n",
>                TargetGetTargetId(Target),
>                Target->Missing ? "MISSING" : "NOT_MISSING",
> @@ -2602,4 +2579,22 @@ TargetGetSurpriseRemovable(
>      return FrontendGetCaps(Target->Frontend)->SurpriseRemovable;
>  }
> 
> +TARGET_GET_PROPERTY(DevicePnpState, DEVICE_PNP_STATE)
> +//TARGET_GET_PROPERTY(Missing, BOOLEAN)
> +
> +BOOLEAN
> +TargetGetMissing(
> +    IN  PXENVBD_TARGET  Target
> +    )
> +{
> +    KIRQL               Irql;
> +    BOOLEAN             Missing;
> +
> +    KeAcquireSpinLock(&Target->Lock, &Irql);
> +    Missing = Target->Missing;
> +    KeReleaseSpinLock(&Target->Lock, Irql);
> +
> +    return Missing;
> +}
> +
>  #undef TARGET_GET_PROPERTY
> diff --git a/src/xenvbd/target.h b/src/xenvbd/target.h
> index ac1de11..1e2b3ed 100644
> --- a/src/xenvbd/target.h
> +++ b/src/xenvbd/target.h
> @@ -75,54 +75,34 @@ TargetIssueDeviceEject(
>      IN  const CHAR      *Reason
>      );
> 
> -// PnP States
>  extern VOID
>  TargetSetMissing(
> -    __in PXENVBD_TARGET             Target,
> -    __in __nullterminated const CHAR* Reason
> -    );
> -
> -__checkReturn
> -extern BOOLEAN
> -TargetIsMissing(
> -    __in PXENVBD_TARGET             Target
> +    IN  PXENVBD_TARGET  Target,
> +    IN  const CHAR      *Reason
>      );
> 
>  extern VOID
>  TargetSetDevicePnpState(
> -    __in PXENVBD_TARGET             Target,
> -    __in DEVICE_PNP_STATE        State
> -    );
> -
> -__checkReturn
> -extern DEVICE_PNP_STATE
> -TargetGetDevicePnpState(
> -    __in PXENVBD_TARGET             Target
> +    IN  PXENVBD_TARGET      Target,
> +    IN  DEVICE_PNP_STATE    State
>      );
> 
>  extern VOID
>  TargetSetDeviceObject(
> -    __in PXENVBD_TARGET             Target,
> -    __in PDEVICE_OBJECT          DeviceObject
> -    );
> -
> -__checkReturn
> -extern BOOLEAN
> -TargetIsPaused(
> -    __in PXENVBD_TARGET             Target
> +    IN  PXENVBD_TARGET  Target,
> +    IN  PDEVICE_OBJECT  DeviceObject
>      );
> 
> -// Queue-Related
>  extern VOID
>  TargetSubmitRequests(
> -    __in PXENVBD_TARGET             Target
> +    IN  PXENVBD_TARGET  Target
>      );
> 
>  extern VOID
>  TargetCompleteResponse(
> -    __in PXENVBD_TARGET             Target,
> -    __in ULONG                   Tag,
> -    __in SHORT                   Status
> +    IN  PXENVBD_TARGET  Target,
> +    IN  ULONG           Tag,
> +    IN  SHORT           Status
>      );
> 
>  extern VOID
> @@ -166,6 +146,8 @@ TARGET_GET_PROPERTY(TargetId, ULONG)
>  TARGET_GET_PROPERTY(DeviceId, ULONG)
>  TARGET_GET_PROPERTY(Removable, BOOLEAN)
>  TARGET_GET_PROPERTY(SurpriseRemovable, BOOLEAN)
> +TARGET_GET_PROPERTY(DevicePnpState, DEVICE_PNP_STATE)
> +TARGET_GET_PROPERTY(Missing, BOOLEAN)
> 
>  #undef TARGET_GET_PROPERTY
> 
> --
> 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

 


Rackspace

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