{
struct pb_manager base;
- pipe_mutex mutex;
+ mtx_t mutex;
pb_size size;
struct mem_block *heap;
};
-static INLINE struct mm_pb_manager *
+static inline struct mm_pb_manager *
mm_pb_manager(struct pb_manager *mgr)
{
assert(mgr);
};
-static INLINE struct mm_buffer *
+static inline struct mm_buffer *
mm_buffer(struct pb_buffer *buf)
{
assert(buf);
assert(!pipe_is_referenced(&mm_buf->base.reference));
- pipe_mutex_lock(mm->mutex);
+ mtx_lock(&mm->mutex);
u_mmFreeMem(mm_buf->block);
FREE(mm_buf);
- pipe_mutex_unlock(mm->mutex);
+ mtx_unlock(&mm->mutex);
}
if(!pb_check_alignment(desc->alignment, (pb_size)1 << mm->align2))
return NULL;
- pipe_mutex_lock(mm->mutex);
+ mtx_lock(&mm->mutex);
mm_buf = CALLOC_STRUCT(mm_buffer);
if (!mm_buf) {
- pipe_mutex_unlock(mm->mutex);
+ mtx_unlock(&mm->mutex);
return NULL;
}
mmDumpMemInfo(mm->heap);
#endif
FREE(mm_buf);
- pipe_mutex_unlock(mm->mutex);
+ mtx_unlock(&mm->mutex);
return NULL;
}
assert(0 <= (pb_size)mm_buf->block->ofs && (pb_size)mm_buf->block->ofs < mm->size);
assert(size <= (pb_size)mm_buf->block->size && (pb_size)mm_buf->block->ofs + (pb_size)mm_buf->block->size <= mm->size);
- pipe_mutex_unlock(mm->mutex);
+ mtx_unlock(&mm->mutex);
return SUPER(mm_buf);
}
{
struct mm_pb_manager *mm = mm_pb_manager(mgr);
- pipe_mutex_lock(mm->mutex);
+ mtx_lock(&mm->mutex);
u_mmDestroy(mm->heap);
pb_unmap(mm->buffer);
pb_reference(&mm->buffer, NULL);
- pipe_mutex_unlock(mm->mutex);
+ mtx_unlock(&mm->mutex);
FREE(mgr);
}
{
struct mm_pb_manager *mm;
- if(!buffer)
+ if (!buffer)
return NULL;
mm = CALLOC_STRUCT(mm_pb_manager);
mm->size = size;
mm->align2 = align2; /* 64-byte alignment */
- pipe_mutex_init(mm->mutex);
+ (void) mtx_init(&mm->mutex, mtx_plain);
mm->buffer = buffer;
return SUPER(mm);
failure:
-if(mm->heap)
- u_mmDestroy(mm->heap);
+ if(mm->heap)
+ u_mmDestroy(mm->heap);
if(mm->map)
pb_unmap(mm->buffer);
FREE(mm);
struct pb_manager *mgr;
struct pb_desc desc;
- if(!provider)
+ if (!provider)
return NULL;
memset(&desc, 0, sizeof(desc));