fifo_order.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2011 Institute of Communication and Computer Systems (ICCS)
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. /**
  18. * \file fifo_order.h
  19. * \author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * \date January, 2012
  21. *
  22. * \brief Add a block in a FIFO-ordered linked list.
  23. */
  24. #ifndef FIFO_ORDER_H
  25. #define FIFO_ORDER_H
  26. #ifdef COUNT_HOPS
  27. #include <dmmlib/heap.h>
  28. #endif /* COUNT_HOPS */
  29. #include "dmm_config.h"
  30. #ifdef FIFO_SORT_POLICY
  31. #ifdef COUNT_HOPS
  32. #define add_block(heap, block, head, tail) add_block_fifo_order(heap, block, head, tail)
  33. #else /* COUNT_HOPS */
  34. #define add_block(block, head, tail) add_block_fifo_order(block, head, tail)
  35. #endif /* COUNT_HOPS */
  36. #endif /* FIFO_SORT_POLICY */
  37. /**
  38. * Adds a block in a LIFO-ordered list.
  39. *
  40. * @param block The pointer of the data part of the block to be added.
  41. * @param head_node The pointer to the head memory block of the list.
  42. * @param tail_node The pointer to the tail memory block of the list.
  43. */
  44. void add_block_fifo_order(
  45. #ifdef COUNT_HOPS
  46. heap_t *heap, /**< A pointer to the heap which manages the block. */
  47. #endif /* COUNT_HOPS */
  48. void **block,
  49. void **head_node,
  50. void **tail_node);
  51. #endif /* FIFO_ORDER_H */