Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.5 KiB

  1. /****************************************************************************/
  2. // aoacom.c
  3. //
  4. // Functions common to OA in WD and DD
  5. //
  6. // Copyright (C) 1997-2000 Microsoft Corporation
  7. /****************************************************************************/
  8. #ifdef DLL_DISP
  9. #define _pShm pddShm
  10. #else
  11. #define _pShm m_pShm
  12. #endif
  13. /****************************************************************************/
  14. // OA_ResetOrderList
  15. //
  16. // Frees all Orders and Additional Order Data in the Order List.
  17. // Frees up the Order Heap memory.
  18. /****************************************************************************/
  19. __inline void SHCLASS OA_ResetOrderList()
  20. {
  21. // Simply clear the list head, the heap contents become useless.
  22. _pShm->oa.TotalOrderBytes = 0;
  23. _pShm->oa.nextOrder = 0;
  24. InitializeListHead(&_pShm->oa.orderListHead);
  25. }
  26. /****************************************************************************/
  27. // OA_RemoveListOrder
  28. //
  29. // Removes the specified order from the Order List by marking it as spoilt.
  30. // Returns a pointer to the order following the removed order.
  31. /****************************************************************************/
  32. PINT_ORDER SHCLASS OA_RemoveListOrder(PINT_ORDER pCondemnedOrder)
  33. {
  34. PINT_ORDER pNextOrder;
  35. DC_BEGIN_FN("OA_RemoveListOrder");
  36. TRC_DBG((TB, "Remove list order (%p)", pCondemnedOrder));
  37. // Store a ptr to the next order. If we are at the end of the list
  38. // we return NULL.
  39. if (pCondemnedOrder->list.Flink != &_pShm->oa.orderListHead)
  40. pNextOrder = CONTAINING_RECORD(pCondemnedOrder->list.Flink,
  41. INT_ORDER, list);
  42. else
  43. pNextOrder = NULL;
  44. // Remove the order.
  45. RemoveEntryList(&pCondemnedOrder->list);
  46. TRC_ASSERT((_pShm->oa.TotalOrderBytes >= pCondemnedOrder->OrderLength),
  47. (TB,"We're removing too many bytes from the order heap - "
  48. "TotalOrderBytes=%u, ord size to remove=%u",
  49. _pShm->oa.TotalOrderBytes, pCondemnedOrder->OrderLength));
  50. _pShm->oa.TotalOrderBytes -= pCondemnedOrder->OrderLength;
  51. // Check that the list is still consistent with the total number of
  52. // order bytes.
  53. if (_pShm->oa.TotalOrderBytes == 0 &&
  54. !IsListEmpty(&_pShm->oa.orderListHead)) {
  55. TRC_ERR((TB, "List not empty when total ord bytes==0"));
  56. InitializeListHead(&_pShm->oa.orderListHead);
  57. }
  58. DC_END_FN();
  59. return pNextOrder;
  60. }