pulsecore: Transform pa_mempool_new() into a factory method

Soon we're going to have three types of memory pools: POSIX shm_open()
pools, memfd memfd_create() ones, and privately malloc()-ed pools.

Thus introduce annotations for the memory types supported and change
pa_mempool_new() into a factory method based on required memory.

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
This commit is contained in:
Ahmed S. Darwish 2016-03-13 00:57:06 +02:00 committed by David Henningsson
parent 211a520543
commit b88acd0266
18 changed files with 97 additions and 37 deletions

View file

@ -23,16 +23,17 @@
#include <sys/types.h>
#include <pulsecore/macro.h>
#include <pulsecore/mem.h>
typedef struct pa_shm {
pa_mem_type_t type;
unsigned id;
void *ptr;
size_t size;
bool do_unlink:1;
bool shared:1;
} pa_shm;
int pa_shm_create_rw(pa_shm *m, size_t size, bool shared, mode_t mode);
int pa_shm_create_rw(pa_shm *m, pa_mem_type_t type, size_t size, mode_t mode);
int pa_shm_attach(pa_shm *m, unsigned id, bool writable);
void pa_shm_punch(pa_shm *m, size_t offset, size_t size);