fitting_policy.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright 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 freelist/fitting_policy.h
  19. * \author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * \date October 2012
  21. *
  22. * \brief Defines the default fitting policy in freelist-organized raw blocks.
  23. */
  24. #ifndef FL_FITTING_POLICY_H
  25. #define FL_FITTING_POLICY_H
  26. #include "dmm_config.h"
  27. /**
  28. * @def SEARCH_LIST
  29. * Tries to find an available free memory block by using the default search
  30. * method.
  31. *
  32. * @param raw_block The freelist-organized raw block
  33. * @param size The requested size
  34. */
  35. #if defined (BEST_FIT)
  36. #include "freelist/fitting/best.h"
  37. #define SEARCH_LIST(raw_block, size) fl_best_fit(raw_block, size)
  38. #elif defined (EXACT_FIT)
  39. #include "freelist/fitting/exact.h"
  40. #define SEARCH_LIST(raw_block, size) fl_exact_fit(raw_block, size)
  41. #elif defined (FIRST_FIT)
  42. #include "freelist/fitting/first.h"
  43. #define SEARCH_LIST(raw_block, size) fl_first_fit(raw_block, size)
  44. #elif defined (GOOD_FIT)
  45. #include "freelist/fitting/good.h"
  46. #define SEARCH_LIST(raw_block, size) fl_good_fit(raw_block, size)
  47. #endif /* BEST_FIT */
  48. #endif /* FL_FITTING_POLICY_H */