save works

This commit is contained in:
Rongsong Shen 2026-03-02 12:14:30 +08:00
parent b748e30d20
commit f4b1ba4cd7
21 changed files with 373 additions and 324 deletions

View file

@ -16,14 +16,14 @@ typedef struct {
static size_t queue_datasize(va_list ap)
{
size_t sz = sizeof(xce_queue_t);
size_t sz = sizeof(queue_t);
return sz;
}
static int queue_init(meta_obj_t* obj, va_list ap)
{
xce_queue_t* dst = RTTI_OBJ_TO_DATA(xce_queue_t, obj);
queue_t* dst = RTTI_OBJ_TO_DATA(queue_t, obj);
queue_private_t* priv = (queue_private_t*)RTTI_OBJ_TO_PRIV(obj);
xce_queue_t* src = va_arg(ap, xce_queue_t*);
@ -31,26 +31,26 @@ static int queue_init(meta_obj_t* obj, va_list ap)
return -EINVAL;
}
dst->queue = makeString(src->queue);
dst->attrs = src->attrs;
dst->status = src->status;
dst->priority = src->priority;
dst->accept_interval = src->accept_interval;
dst->sched_delay = src->sched_delay;
dst->resreq = makeString(src->resreq);
MOVE_PTR(dst->users, src->users);
MOVE_PTR(dst->hosts, src->hosts);
dst->nthresholds = src->nthresholds;
MOVE_PTR(dst->thresholds, src->thresholds);
dst->queue.queue = makeString(src->queue);
dst->queue.attrs = src->attrs;
dst->queue.status = src->status;
dst->queue.priority = src->priority;
dst->queue.accept_interval = src->accept_interval;
dst->queue.sched_delay = src->sched_delay;
dst->queue.resreq = makeString(src->resreq);
MOVE_PTR(dst->queue.users, src->users);
MOVE_PTR(dst->queue.hosts, src->hosts);
dst->queue.nthresholds = src->nthresholds;
MOVE_PTR(dst->queue.thresholds, src->thresholds);
MOVE_PTR(dst->runwindow, src->runwindow);
MOVE_PTR(dst->dispatchwindow, src->dispatchwindow);
MOVE_PTR(dst->runwindow_config, src->runwindow_config);
MOVE_PTR(dst->dispatchwindow_config, src->dispatchwindow_config);
dst->pending_ctrl = src->pending_ctrl;
dst->pre_exec = makeString(src->pre_exec);
dst->post_exec = makeString(src->post_exec);
dst->autopscaler = makeString(src->autopscaler);
MOVE_PTR(dst->queue.runwindow, src->runwindow);
MOVE_PTR(dst->queue.dispatchwindow, src->dispatchwindow);
MOVE_PTR(dst->queue.runwindow_config, src->runwindow_config);
MOVE_PTR(dst->queue.dispatchwindow_config, src->dispatchwindow_config);
dst->queue.pending_ctrl = src->pending_ctrl;
dst->queue.pre_exec = makeString(src->pre_exec);
dst->queue.post_exec = makeString(src->post_exec);
dst->queue.autopscaler = makeString(src->autopscaler);
my_rwlock_init(&(priv->lock));
priv->refcount = 1;
@ -60,30 +60,30 @@ static int queue_init(meta_obj_t* obj, va_list ap)
static void queue_destroy(meta_obj_t* obj)
{
xce_queue_t* q = RTTI_OBJ_TO_DATA(xce_queue_t, obj);
queue_t* q = RTTI_OBJ_TO_DATA(queue_t, obj);
queue_private_t* priv = (queue_private_t*)RTTI_OBJ_TO_PRIV(obj);
dereference(q->queue);
dereference(q->resreq);
dereference(q->queue.queue);
dereference(q->queue.resreq);
/* FIXME: */
if (q->users != NULL) { }
if (q->queue.users != NULL) { }
if (q->hosts != NULL) { }
if (q->queue.hosts != NULL) { }
if (q->thresholds != NULL) { }
if (q->queue.thresholds != NULL) { }
if (q->runwindow != NULL) { }
if (q->queue.runwindow != NULL) { }
if (q->dispatchwindow != NULL) { }
if (q->queue.dispatchwindow != NULL) { }
if (q->runwindow_config != NULL) { }
if (q->queue.runwindow_config != NULL) { }
if (q->dispatchwindow_config != NULL) { }
if (q->queue.dispatchwindow_config != NULL) { }
dereference(q->pre_exec);
dereference(q->post_exec);
dereference(q->autopscaler);
dereference(q->queue.pre_exec);
dereference(q->queue.post_exec);
dereference(q->queue.autopscaler);
my_rwlock_fini(&(priv->lock));
memset(priv, 0x0, sizeof(*priv));
@ -163,8 +163,9 @@ static typeinfo_t queue_type = {
.unlock = (unlock_fn_t)queue_unlock } }
};
xce_queue_t* makeQueue(xce_queue_t* w)
queue_t* makeQueue(var qmgr, xce_queue_t* w)
{
xce_queue_t* queue = makeInstance(&queue_type, w);
/* FIMXE: */
queue_t* queue = makeInstance(&queue_type, w);
return queue;
}