partition_init.c 877 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * partition_init.c
  3. */
  4. #include <stdlib.h>
  5. #include <assert.h>
  6. #include "private.h"
  7. /*-------------------------------------------------------- */
  8. void
  9. lub_partition_kill(lub_partition_t *this)
  10. {
  11. this->m_dying = BOOL_TRUE;
  12. /* try and die immediately... */
  13. lub_partition_time_to_die(this);
  14. }
  15. /*-------------------------------------------------------- */
  16. void
  17. lub_partition_init(lub_partition_t *this,
  18. const lub_partition_spec_t *spec)
  19. {
  20. this->m_spec = *spec;
  21. if(!this->m_spec.sysalloc)
  22. {
  23. this->m_spec.sysalloc = malloc;
  24. }
  25. this->m_partition_ceiling = spec->memory_limit ? (spec->memory_limit - sizeof(lub_partition_t)) : -1;
  26. this->m_dying = BOOL_FALSE;
  27. this->m_global_heap = 0; /* do this on demand */
  28. }
  29. /*-------------------------------------------------------- */