linked_lists.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 linked_lists.h
  19. * \author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * \date September, 2011
  21. *
  22. * \brief Linked list node header structure and functions.
  23. */
  24. #ifndef LINKED_LISTS_H
  25. #define LINKED_LISTS_H
  26. #include "dmm_config.h"
  27. #ifndef LEON3
  28. #include <stdint.h>
  29. #else
  30. #include <sys/types.h>
  31. #endif /* LEON3 */
  32. #include <dmmlib/block_header.h>
  33. #include <dmmlib/raw_block.h>
  34. #ifdef BLOCKS_IN_DLL
  35. /**
  36. * Set the previous memory block of a block in a linked list.
  37. *
  38. * \param block The pointer to the data part of the current memory
  39. * block.
  40. * \param previous_block The pointer to the data part of the previous memory
  41. * block.
  42. */
  43. void set_previous(void *previous, void *previous_block);
  44. /**
  45. * Get the previous memory block in a linked list.
  46. *
  47. * \param ptr The pointer to the data part of the current memory block.
  48. *
  49. * \return The pointer of the data part of the previous (in list) memory block.
  50. * \retval NULL There is no previous memory block in the list.
  51. */
  52. void * get_previous(void *ptr);
  53. #endif /* BLOCKS_IN_DLL */
  54. /**
  55. * Removes a memory block from a linked list of memory blocks.
  56. *
  57. * \param block A pointer to the block to be removed.
  58. * \param raw_block A pointer to the raw block.
  59. */
  60. void remove_block(block_header_t *block, raw_block_header_t *raw_block);
  61. #endif /* LINKED_LISTS_H */