save works
This commit is contained in:
parent
b748e30d20
commit
f4b1ba4cd7
21 changed files with 373 additions and 324 deletions
|
|
@ -16,14 +16,14 @@ typedef struct {
|
|||
|
||||
static size_t worker_datasize(va_list ap)
|
||||
{
|
||||
size_t sz = sizeof(xce_worker_t);
|
||||
size_t sz = sizeof(worker_t);
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int worker_init(meta_obj_t* obj, va_list ap)
|
||||
{
|
||||
xce_worker_t* dst = RTTI_OBJ_TO_DATA(xce_worker_t, obj);
|
||||
worker_t* dst = RTTI_OBJ_TO_DATA(worker_t, obj);
|
||||
worker_private_t* priv = (worker_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_worker_t* src = va_arg(ap, xce_worker_t*);
|
||||
|
||||
|
|
@ -31,28 +31,28 @@ static int worker_init(meta_obj_t* obj, va_list ap)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
dst->name = makeString(src->name);
|
||||
dst->attrs = (hostattrs_t*)calloc(1, sizeof(hostattrs_t));
|
||||
if (dst->attrs == NULL) {
|
||||
dst->host.name = makeString(src->name);
|
||||
dst->host.attrs = (hostattrs_t*)calloc(1, sizeof(hostattrs_t));
|
||||
if (dst->host.attrs == NULL) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
memcpy(dst->attrs, src->attrs, sizeof(*(dst->attrs)));
|
||||
memcpy(dst->host.attrs, src->attrs, sizeof(*(dst->host.attrs)));
|
||||
|
||||
dst->attrs->hosttype = makeString(src->attrs->hosttype);
|
||||
dst->attrs->hostmodel = makeString(src->attrs->hostmodel);
|
||||
dst->status = src->status;
|
||||
dst->host.attrs->hosttype = makeString(src->attrs->hosttype);
|
||||
dst->host.attrs->hostmodel = makeString(src->attrs->hostmodel);
|
||||
dst->host.status = src->status;
|
||||
|
||||
/* FIXME: */
|
||||
zarray_init(&(dst->resvals), 64, NULL);
|
||||
zarray_init(&(dst->host.resvals), 64, NULL);
|
||||
|
||||
dst->dead_since = src->dead_since;
|
||||
dst->pending_ctrl = src->pending_ctrl;
|
||||
MOVE_PTR(dst->dispatch_window_config, src->dispatch_window_config);
|
||||
dst->nthresholds = src->nthresholds;
|
||||
MOVE_PTR(dst->thresholds, src->thresholds);
|
||||
dst->nresvals_to_sched = 0;
|
||||
dst->resvals_to_sched = NULL;
|
||||
dst->host.dead_since = src->dead_since;
|
||||
dst->host.pending_ctrl = src->pending_ctrl;
|
||||
MOVE_PTR(dst->host.dispatch_window_config, src->dispatch_window_config);
|
||||
dst->host.nthresholds = src->nthresholds;
|
||||
MOVE_PTR(dst->host.thresholds, src->thresholds);
|
||||
dst->host.nresvals_to_sched = 0;
|
||||
dst->host.resvals_to_sched = NULL;
|
||||
|
||||
my_rwlock_init(&(priv->lock));
|
||||
priv->refcount = 1;
|
||||
|
|
@ -62,24 +62,24 @@ static int worker_init(meta_obj_t* obj, va_list ap)
|
|||
|
||||
static void worker_destroy(meta_obj_t* obj)
|
||||
{
|
||||
xce_worker_t* w = RTTI_OBJ_TO_DATA(xce_worker_t, obj);
|
||||
worker_t* w = RTTI_OBJ_TO_DATA(worker_t, obj);
|
||||
worker_private_t* priv = (worker_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
|
||||
dereference(w->name);
|
||||
dereference(w->host.name);
|
||||
|
||||
if (w->attrs != NULL) {
|
||||
dereference(w->attrs->hosttype);
|
||||
dereference(w->attrs->hostmodel);
|
||||
FREEUP(w->attrs);
|
||||
if (w->host.attrs != NULL) {
|
||||
dereference(w->host.attrs->hosttype);
|
||||
dereference(w->host.attrs->hostmodel);
|
||||
FREEUP(w->host.attrs);
|
||||
}
|
||||
|
||||
if (w->dispatch_window_config != NULL) { }
|
||||
if (w->host.dispatch_window_config != NULL) { }
|
||||
|
||||
if (w->thresholds != NULL) { }
|
||||
if (w->host.thresholds != NULL) { }
|
||||
|
||||
if (w->resvals_to_sched != NULL) { }
|
||||
if (w->host.resvals_to_sched != NULL) { }
|
||||
|
||||
zarray_fini(&(w->resvals));
|
||||
zarray_fini(&(w->host.resvals));
|
||||
|
||||
my_rwlock_fini(&(priv->lock));
|
||||
memset(priv, 0x0, sizeof(*priv));
|
||||
|
|
@ -101,7 +101,7 @@ static int worker_reference(meta_obj_t* obj)
|
|||
static void worker_dereference(meta_obj_t* obj)
|
||||
{
|
||||
worker_private_t* priv = (worker_private_t*)RTTI_OBJ_TO_PRIV(obj);
|
||||
xce_worker_t* w = RTTI_OBJ_TO_DATA(xce_worker_t, obj);
|
||||
worker_t* w = RTTI_OBJ_TO_DATA(worker_t, obj);
|
||||
uint64_t count = 0;
|
||||
|
||||
my_rwlock_wlock(&(priv->lock));
|
||||
|
|
@ -159,8 +159,9 @@ static typeinfo_t worker_type = {
|
|||
.unlock = (unlock_fn_t)worker_unlock } }
|
||||
};
|
||||
|
||||
xce_worker_t* makeWorker(xce_worker_t* w)
|
||||
worker_t* makeWorker(var workermgr, xce_worker_t* w)
|
||||
{
|
||||
xce_worker_t* worker = makeInstance(&worker_type, w);
|
||||
worker_t* worker = makeInstance(&worker_type, w);
|
||||
/* fIXME */
|
||||
return worker;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue