fitting_policy.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 <dmmlib/config.h>
  27. #include "padding.h"
  28. /**
  29. * @def SEARCH_LIST
  30. * Tries to find an available free memory block by using the default search
  31. * method.
  32. *
  33. * @param raw_block The freelist-organized raw block
  34. * @param size The requested size
  35. */
  36. #if defined (BEST_FIT)
  37. #include "freelist/fitting/best.h"
  38. #define SEARCH_LIST(raw_block, size) fl_best_fit(raw_block, size)
  39. #elif defined (EXACT_FIT)
  40. #include "freelist/fitting/exact.h"
  41. #define SEARCH_LIST(raw_block, size) fl_exact_fit(raw_block, size)
  42. #elif defined (FIRST_FIT)
  43. #include "freelist/fitting/first.h"
  44. #define SEARCH_LIST(raw_block, size) fl_first_fit(raw_block, size)
  45. #elif defined (GOOD_FIT)
  46. #include "freelist/fitting/good.h"
  47. #define SEARCH_LIST(raw_block, size) fl_good_fit(raw_block, size)
  48. #endif /* BEST_FIT */
  49. #endif /* FL_FITTING_POLICY_H */