queue_busy = memory_allocation(sizeof(&queue_busy) * queue_subbuffer_count);
if (!queue_busy) {
- result = E_SB_NO_MEM_QUEUE_BUSY;
+ result = -E_SB_NO_MEM_QUEUE_BUSY;
goto buffer_allocation_error_ret;
}
write_queue.start_ptr = memory_allocation(sizeof(&write_queue.start_ptr));
if (!write_queue.start_ptr) {
- result = E_SB_NO_MEM_BUFFER_STRUCT;
+ result = -E_SB_NO_MEM_BUFFER_STRUCT;
goto buffer_allocation_queue_busy_free;
}
allocated_structs++;
write_queue.end_ptr->data_buffer = buffer_allocation(queue_subbuffer_size);
if (!write_queue.end_ptr->data_buffer) {
print_err("Cannot allocate memory for buffer 1\n");
- result = E_SB_NO_MEM_DATA_BUFFER;
+ result = -E_SB_NO_MEM_DATA_BUFFER;
goto buffer_allocation_error_free;
}
allocated_buffers++;
write_queue.end_ptr->next_in_queue =
memory_allocation(sizeof(write_queue.end_ptr->next_in_queue));
if (!write_queue.end_ptr->next_in_queue) {
- result = E_SB_NO_MEM_BUFFER_STRUCT;
+ result = -E_SB_NO_MEM_BUFFER_STRUCT;
goto buffer_allocation_error_free;
}
allocated_structs++;
write_queue.end_ptr->data_buffer =
buffer_allocation(queue_subbuffer_size);
if (!write_queue.end_ptr->data_buffer) {
- result = E_SB_NO_MEM_DATA_BUFFER;
+ result = -E_SB_NO_MEM_DATA_BUFFER;
goto buffer_allocation_error_free;
}
allocated_buffers++;
/* Remove subbuffer from busy list when it is released */
int remove_from_busy_list(struct swap_subbuffer *subbuffer)
{
- int result = E_SB_NO_SUBBUFFER_IN_BUSY; // For sanitization
+ int result = -E_SB_NO_SUBBUFFER_IN_BUSY; // For sanitization
int i;
/* Lock busy list sync primitive */
* On success returns number of bytes written (>=0) or error code (<0) otherwise */
ssize_t swap_buffer_write(size_t size, void* data);
-/* SWAP Buffer get. Put subbuffer pointer to the variable *subbuffer. */
+/* SWAP Buffer get. Put subbuffer pointer to the variable *subbuffer.
+ * Return pages count in subbuffer. */
int swap_buffer_get(struct swap_subbuffer **subbuffer);
/* SWAP Buffer release. All 'get' buffers must be released with this function.