opque_t *new_opque() { opque_t *q; type_malloc(q, opque_t , 1); init_opque(q); return(q); }
data_attr_t *ds_ibp_new_attr(data_service_fn_t *arg) { ds_ibp_priv_t *ds = (ds_ibp_priv_t *)arg->priv; ds_ibp_attr_t *a; type_malloc(a, ds_ibp_attr_t, 1); *a = ds->attr_default; return((data_attr_t *)a); }
os_authz_t *osaz_fake_create(service_manager_t *ess, inip_file_t *ifd, char *section, object_service_fn_t *os) { os_authz_t *osaz; type_malloc(osaz, os_authz_t, 1); osaz->priv = NULL; osaz->object_create = osaz_fake_object_create_remove; osaz->object_remove = osaz_fake_object_create_remove; osaz->object_access = osaz_fake_object_access; osaz->attr_create = osaz_fake_attr_create_remove; osaz->attr_remove = osaz_fake_attr_create_remove; osaz->attr_access = osaz_fake_attr_access; osaz->destroy = osaz_fake_destroy; return(osaz); }
op_generic_t *segment_get(thread_pool_context_t *tpc, data_attr_t *da, segment_rw_hints_t *rw_hints, segment_t *src_seg, FILE *fd, ex_off_t src_offset, ex_off_t len, ex_off_t bufsize, char *buffer, int timeout) { segment_copy_t *sc; type_malloc(sc, segment_copy_t, 1); sc->da = da; sc->rw_hints = rw_hints; sc->timeout = timeout; sc->fd = fd; sc->src = src_seg; sc->src_offset = src_offset; sc->len = len; sc->bufsize = bufsize; sc->buffer = buffer; return(new_thread_pool_op(tpc, NULL, segment_get_func, (void *)sc, free, 1)); }
int internal_opque_add(opque_t *que, op_generic_t *gop, int dolock) { int err = 0; callback_t *cb; que_data_t *q = &(que->qd); //** Create the callback ** type_malloc(cb, callback_t, 1); callback_set(cb, _opque_cb, (void *)gop); //** Set the global callback for the list if (dolock != 0) lock_opque(q); log_printf(15, "opque_add: qid=%d gid=%d\n", que->op.base.id, gop_get_id(gop)); //** Add the list CB to the the op // lock_gop(gop) gop->base.parent_q = que; callback_append(&(gop->base.cb), cb); // unlock_gop(gop) //**Add the op to the q q->nsubmitted++; q->nleft++; if (q->opque->op.base.started_execution == 0) { move_to_bottom(q->list); insert_below(q->list, (void *)cb); } if (dolock != 0) unlock_opque(q); if (q->opque->op.base.started_execution == 1) { if (gop->type == Q_TYPE_OPERATION) { log_printf(15, "gid=%d started_execution=%d\n", gop_get_id(gop), gop->base.started_execution); gop->base.started_execution = 1; gop->base.pc->fn->submit(gop->base.pc->arg, gop); } else { //** It's a queue opque_start_execution(gop->q->opque); } } return(err); }