read-op-impl.c 901 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
/*
 * (C) 2017 The University of Chicago
 * 
 * See COPYRIGHT in top-level directory.
 */

#include <stdlib.h>
#include <string.h>
#include "mobject-store-config.h"
#include "libmobject-store.h"
Matthieu Dorier's avatar
Matthieu Dorier committed
11 12 13
#include "src/io-chain/read-op-impl.h"
#include "src/util/utlist.h"
#include "src/util/log.h"
14

15
mobject_store_read_op_t create_read_op(void)
16 17 18 19
{
	mobject_store_read_op_t read_op = 
		(mobject_store_read_op_t)calloc(1, sizeof(*read_op));
	MOBJECT_ASSERT(read_op != MOBJECT_READ_OP_NULL, "Could not allocate read_op");
20
	read_op->actions     = (rd_action_base_t)0;
21
	read_op->bulk_handle = HG_BULK_NULL;
22
	read_op->ready       = 0;
23 24 25
	return read_op;
}

26
void release_read_op(mobject_store_read_op_t read_op)
27 28 29 30 31 32 33 34 35 36 37 38
{
	if(read_op == MOBJECT_READ_OP_NULL) return;
	
	rd_action_base_t action, tmp;

	DL_FOREACH_SAFE(read_op->actions, action, tmp) {
		DL_DELETE(read_op->actions, action);
		free(action);
	}

	free(read_op);
}