Newer
Older
}
static void
_pack_old_job_desc_msg(old_job_alloc_msg_t * job_desc_ptr, Buf buffer)
{
/* load the data values */
pack32(job_desc_ptr->job_id, buffer);
pack32(job_desc_ptr->uid, buffer);
static int
_unpack_old_job_desc_msg(old_job_alloc_msg_t **
job_desc_buffer_ptr, Buf buffer)
{
old_job_alloc_msg_t *job_desc_ptr;
/* alloc memory for structure */
assert(job_desc_buffer_ptr != NULL);
job_desc_ptr = xmalloc(sizeof(old_job_alloc_msg_t));
*job_desc_buffer_ptr = job_desc_ptr;
/* load the data values */
safe_unpack32(&job_desc_ptr->job_id, buffer);
safe_unpack32(&job_desc_ptr->uid, buffer);
return SLURM_SUCCESS;
*job_desc_buffer_ptr = NULL;
return SLURM_ERROR;
static void
_pack_last_update_msg(last_update_msg_t * msg, Buf buffer)
{
xassert(msg != NULL);
pack_time(msg->last_update, buffer);
}
static int
_unpack_last_update_msg(last_update_msg_t ** msg, Buf buffer)
{
last_update_msg_t *last_update_msg;
xassert(msg != NULL);
last_update_msg = xmalloc(sizeof(last_update_msg_t));
*msg = last_update_msg;
safe_unpack_time(&last_update_msg->last_update, buffer);
return SLURM_SUCCESS;
*msg = NULL;
return SLURM_ERROR;
static void
_pack_return_code_msg(return_code_msg_t * msg, Buf buffer)
xassert(msg != NULL);
pack32(msg->return_code, buffer);
static int
_unpack_return_code_msg(return_code_msg_t ** msg, Buf buffer)
return_code_msg_t *return_code_msg;
xassert(msg != NULL);
return_code_msg = xmalloc(sizeof(return_code_msg_t));
*msg = return_code_msg;
safe_unpack32(&return_code_msg->return_code, buffer);
return SLURM_SUCCESS;
*msg = NULL;
return SLURM_ERROR;
static void
_pack_reattach_tasks_request_msg(reattach_tasks_request_msg_t * msg,
Buf buffer)
xassert(msg != NULL);
pack32(msg->job_id, buffer);
pack32(msg->job_step_id, buffer);
pack32(msg->srun_node_id, buffer);
pack16(msg->resp_port, buffer);
pack16(msg->io_port, buffer);
packstr(msg->ofname, buffer);
packstr(msg->efname, buffer);
packstr(msg->ifname, buffer);
slurm_cred_pack(msg->cred, buffer);
static int
_unpack_reattach_tasks_request_msg(reattach_tasks_request_msg_t ** msg_ptr,
Buf buffer)
reattach_tasks_request_msg_t *msg;
xassert(msg_ptr != NULL);
msg = xmalloc(sizeof(*msg));
*msg_ptr = msg;
safe_unpack32(&msg->job_id, buffer);
safe_unpack32(&msg->job_step_id, buffer);
safe_unpack32(&msg->srun_node_id, buffer);
safe_unpack16(&msg->resp_port, buffer);
safe_unpack16(&msg->io_port, buffer);
safe_unpackstr_xmalloc(&msg->ofname, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&msg->efname, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&msg->ifname, &uint16_tmp, buffer);
if (!(msg->cred = slurm_cred_unpack(buffer)))
goto unpack_error;
return SLURM_SUCCESS;
unpack_error:
slurm_free_reattach_tasks_request_msg(msg);
*msg_ptr = NULL;
return SLURM_ERROR;
static void
_pack_reattach_tasks_response_msg(reattach_tasks_response_msg_t * msg,
Buf buffer)
xassert(msg != NULL);
packstr(msg->node_name, buffer);
packstr(msg->executable_name, buffer);
pack32(msg->return_code, buffer);
pack32(msg->srun_node_id, buffer);
pack32(msg->ntasks, buffer);
pack32_array(msg->gids, msg->ntasks, buffer);
pack32_array(msg->local_pids, msg->ntasks, buffer);
static int
_unpack_reattach_tasks_response_msg(reattach_tasks_response_msg_t ** msg_ptr,
Buf buffer)
uint32_t ntasks;
uint16_t uint16_tmp;
reattach_tasks_response_msg_t *msg = xmalloc(sizeof(*msg));
xassert(msg_ptr != NULL);
safe_unpackstr_xmalloc(&msg->node_name, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&msg->executable_name, &uint16_tmp, buffer);
safe_unpack32(&msg->return_code, buffer);
safe_unpack32(&msg->srun_node_id, buffer);
safe_unpack32(&msg->ntasks, buffer);
safe_unpack32_array(&msg->gids, &ntasks, buffer);
safe_unpack32_array(&msg->local_pids, &ntasks, buffer);
if (msg->ntasks != ntasks)
goto unpack_error;
unpack_error:
slurm_free_reattach_tasks_response_msg(msg);
*msg_ptr = NULL;
return SLURM_ERROR;
}
static void
_pack_task_exit_msg(task_exit_msg_t * msg, Buf buffer)
{
xassert(msg != NULL);
pack32(msg->return_code, buffer);
pack32(msg->num_tasks, buffer);
pack32_array(msg->task_id_list,
msg->num_tasks, buffer);
static int
_unpack_task_exit_msg(task_exit_msg_t ** msg_ptr, Buf buffer)
{
task_exit_msg_t *msg;
uint32_t uint32_tmp;
xassert(msg_ptr != NULL);
msg = xmalloc(sizeof(task_exit_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->return_code, buffer);
safe_unpack32(&msg->num_tasks, buffer);
safe_unpack32_array(&msg->task_id_list, &uint32_tmp, buffer);
if (msg->num_tasks != uint32_tmp)
goto unpack_error;
*msg_ptr = NULL;
return SLURM_ERROR;
}
static void
_pack_launch_tasks_response_msg(launch_tasks_response_msg_t * msg, Buf buffer)
xassert(msg != NULL);
pack32(msg->return_code, buffer);
packstr(msg->node_name, buffer);
pack32(msg->srun_node_id, buffer);
pack32(msg->count_of_pids, buffer);
pack32_array(msg->local_pids,
msg->count_of_pids, buffer);
static int
_unpack_launch_tasks_response_msg(launch_tasks_response_msg_t **
msg_ptr, Buf buffer)
{
uint16_t uint16_tmp;
uint32_t uint32_tmp;
launch_tasks_response_msg_t *msg;
xassert(msg_ptr != NULL);
msg = xmalloc(sizeof(launch_tasks_response_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->return_code, buffer);
safe_unpackstr_xmalloc(&msg->node_name, &uint16_tmp, buffer);
safe_unpack32(&msg->srun_node_id, buffer);
safe_unpack32(&msg->count_of_pids, buffer);
safe_unpack32_array(&msg->local_pids, &uint32_tmp, buffer);
if (msg->count_of_pids != uint32_tmp)
goto unpack_error;
xfree(msg->node_name);
xfree(msg);
*msg_ptr = NULL;
return SLURM_ERROR;
}
static void
_pack_launch_tasks_request_msg(launch_tasks_request_msg_t * msg, Buf buffer)
{
xassert(msg != NULL);
pack32(msg->job_id, buffer);
pack32(msg->job_step_id, buffer);
pack32(msg->nnodes, buffer);
pack32(msg->nprocs, buffer);
pack32(msg->uid, buffer);
pack32(msg->srun_node_id, buffer);
slurm_cred_pack(msg->cred, buffer);
pack32(msg->tasks_to_launch, buffer);
packstr_array(msg->env, msg->envc, buffer);
packstr(msg->cwd, buffer);
packstr_array(msg->argv, msg->argc, buffer);
pack16(msg->resp_port, buffer);
pack16(msg->io_port, buffer);
pack16(msg->task_flags, buffer);
pack16(msg->cpus_allocated, buffer);
packstr(msg->ofname, buffer);
packstr(msg->efname, buffer);
packstr(msg->ifname, buffer);
pack32(msg->slurmd_debug, buffer);
pack32_array(msg->global_task_ids,
msg->tasks_to_launch, buffer);
switch_pack_jobinfo(msg->switch_job, buffer);
static int
_unpack_launch_tasks_request_msg(launch_tasks_request_msg_t **
msg_ptr, Buf buffer)
uint32_t uint32_tmp;
launch_tasks_request_msg_t *msg;
xassert(msg_ptr != NULL);
msg = xmalloc(sizeof(launch_tasks_request_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->job_id, buffer);
safe_unpack32(&msg->job_step_id, buffer);
safe_unpack32(&msg->nnodes, buffer);
safe_unpack32(&msg->nprocs, buffer);
safe_unpack32(&msg->uid, buffer);
safe_unpack32(&msg->srun_node_id, buffer);
if (!(msg->cred = slurm_cred_unpack(buffer)))
goto unpack_error;
safe_unpack32(&msg->tasks_to_launch, buffer);
safe_unpackstr_array(&msg->env, &msg->envc, buffer);
safe_unpackstr_xmalloc(&msg->cwd, &uint16_tmp, buffer);
safe_unpackstr_array(&msg->argv, &msg->argc, buffer);
safe_unpack16(&msg->resp_port, buffer);
safe_unpack16(&msg->io_port, buffer);
safe_unpack16(&msg->task_flags, buffer);
safe_unpack16(&msg->cpus_allocated, buffer);
safe_unpackstr_xmalloc(&msg->ofname, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&msg->efname, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&msg->ifname, &uint16_tmp, buffer);
safe_unpack32(&msg->slurmd_debug, buffer);
safe_unpack32_array(&msg->global_task_ids, &uint32_tmp, buffer);
if (msg->tasks_to_launch != uint32_tmp)
goto unpack_error;
switch_alloc_jobinfo(&msg->switch_job);
if (switch_unpack_jobinfo(msg->switch_job, buffer) < 0) {
error("switch_unpack_jobinfo: %m");
switch_free_jobinfo(msg->switch_job);
goto unpack_error;
slurm_free_launch_tasks_request_msg(msg);
*msg_ptr = NULL;
return SLURM_ERROR;
static void
_pack_spawn_task_request_msg(spawn_task_request_msg_t * msg, Buf buffer)
{
xassert(msg != NULL);
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
pack32(msg->job_id, buffer);
pack32(msg->job_step_id, buffer);
pack32(msg->nnodes, buffer);
pack32(msg->nprocs, buffer);
pack32(msg->uid, buffer);
pack32(msg->srun_node_id, buffer);
slurm_cred_pack(msg->cred, buffer);
packstr_array(msg->env, msg->envc, buffer);
packstr(msg->cwd, buffer);
packstr_array(msg->argv, msg->argc, buffer);
pack16(msg->io_port, buffer);
pack16(msg->task_flags, buffer);
pack16(msg->cpus_allocated, buffer);
pack32(msg->slurmd_debug, buffer);
pack32(msg->global_task_id, buffer);
switch_pack_jobinfo(msg->switch_job, buffer);
}
static int
_unpack_spawn_task_request_msg(spawn_task_request_msg_t **
msg_ptr, Buf buffer)
{
uint16_t uint16_tmp;
spawn_task_request_msg_t *msg;
xassert(msg_ptr != NULL);
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
msg = xmalloc(sizeof(launch_tasks_request_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->job_id, buffer);
safe_unpack32(&msg->job_step_id, buffer);
safe_unpack32(&msg->nnodes, buffer);
safe_unpack32(&msg->nprocs, buffer);
safe_unpack32(&msg->uid, buffer);
safe_unpack32(&msg->srun_node_id, buffer);
if (!(msg->cred = slurm_cred_unpack(buffer)))
goto unpack_error;
safe_unpackstr_array(&msg->env, &msg->envc, buffer);
safe_unpackstr_xmalloc(&msg->cwd, &uint16_tmp, buffer);
safe_unpackstr_array(&msg->argv, &msg->argc, buffer);
safe_unpack16(&msg->io_port, buffer);
safe_unpack16(&msg->task_flags, buffer);
safe_unpack16(&msg->cpus_allocated, buffer);
safe_unpack32(&msg->slurmd_debug, buffer);
safe_unpack32(&msg->global_task_id, buffer);
switch_alloc_jobinfo(&msg->switch_job);
if (switch_unpack_jobinfo(msg->switch_job, buffer) < 0) {
error("switch_unpack_jobinfo: %m");
switch_free_jobinfo(msg->switch_job);
goto unpack_error;
}
return SLURM_SUCCESS;
unpack_error:
slurm_free_spawn_task_request_msg(msg);
*msg_ptr = NULL;
return SLURM_ERROR;
}
static void
_pack_cancel_tasks_msg(kill_tasks_msg_t * msg, Buf buffer)
pack32(msg->job_id, buffer);
pack32(msg->job_step_id, buffer);
pack32(msg->signal, buffer);
static int
_unpack_cancel_tasks_msg(kill_tasks_msg_t ** msg_ptr, Buf buffer)
msg = xmalloc(sizeof(kill_tasks_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->job_id, buffer);
safe_unpack32(&msg->job_step_id, buffer);
safe_unpack32(&msg->signal, buffer);
return SLURM_SUCCESS;
*msg_ptr = NULL;
return SLURM_ERROR;
static void
_pack_shutdown_msg(shutdown_msg_t * msg, Buf buffer)

Moe Jette
committed
{

Moe Jette
committed
}
static int
_unpack_shutdown_msg(shutdown_msg_t ** msg_ptr, Buf buffer)

Moe Jette
committed
{

Moe Jette
committed
msg = xmalloc(sizeof(shutdown_msg_t));
*msg_ptr = msg;
safe_unpack16(&msg->core, buffer);
return SLURM_SUCCESS;
*msg_ptr = NULL;
return SLURM_ERROR;

Moe Jette
committed
}
/* _pack_job_step_kill_msg
* packs a slurm job step signal message
* IN msg - pointer to the job step signal message
* IN/OUT buffer - destination of the pack, contains pointers that are
* automatically updated
*/
static void
_pack_job_step_kill_msg(job_step_kill_msg_t * msg, Buf buffer)
{
pack32(msg->job_id, buffer);
pack32(msg->job_step_id, buffer);
pack16(msg->signal, buffer);
pack16(msg->batch_flag, buffer);
}
/* _unpack_job_step_kill_msg
* unpacks a slurm job step signal message
* OUT msg_ptr - pointer to the job step signal message buffer
* IN/OUT buffer - source of the unpack, contains pointers that are
* automatically updated
*/
static int
_unpack_job_step_kill_msg(job_step_kill_msg_t ** msg_ptr, Buf buffer)
{
job_step_kill_msg_t *msg;
msg = xmalloc(sizeof(job_step_kill_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->job_id, buffer);
safe_unpack32(&msg->job_step_id, buffer);
safe_unpack16(&msg->signal, buffer);
safe_unpack16(&msg->batch_flag, buffer);
return SLURM_SUCCESS;
unpack_error:
*msg_ptr = NULL;
return SLURM_ERROR;
}
static void
_pack_complete_job_step_msg(complete_job_step_msg_t * msg, Buf buffer)
pack32(msg->job_id, buffer);
pack32(msg->job_step_id, buffer);
pack32(msg->job_rc, buffer);
pack32(msg->slurm_rc, buffer);
packstr(msg->node_name, buffer);
static int
_unpack_complete_job_step_msg(complete_job_step_msg_t ** msg_ptr, Buf buffer)
complete_job_step_msg_t *msg;
uint16_t uint16_tmp;
msg = xmalloc(sizeof(complete_job_step_msg_t));
*msg_ptr = msg;
safe_unpack32(&msg->job_id, buffer);
safe_unpack32(&msg->job_step_id, buffer);
safe_unpack32(&msg->job_rc, buffer);
safe_unpack32(&msg->slurm_rc, buffer);
safe_unpackstr_xmalloc(&msg->node_name, &uint16_tmp, buffer);
return SLURM_SUCCESS;
*msg_ptr = NULL;
return SLURM_ERROR;
}
_pack_job_info_request_msg(job_info_request_msg_t * msg,
Buf buffer)
{
pack_time(msg->last_update, buffer);
pack16(msg->show_flags, buffer);
}
static int
_unpack_job_info_request_msg(job_info_request_msg_t** msg,
Buf buffer)
{
job_info_request_msg_t*job_info;
job_info = xmalloc(sizeof(job_step_info_request_msg_t));
*msg = job_info;
safe_unpack_time(&job_info->last_update, buffer);
safe_unpack16(&job_info->show_flags, buffer);
return SLURM_SUCCESS;
unpack_error:
xfree(job_info);
*msg = NULL;
return SLURM_ERROR;
}
static void
_pack_job_step_info_req_msg(job_step_info_request_msg_t * msg, Buf buffer)
pack_time(msg->last_update, buffer);
pack32(msg->job_id, buffer);
pack32(msg->step_id, buffer);
pack16(msg->show_flags, buffer);
_unpack_job_step_info_req_msg(job_step_info_request_msg_t ** msg, Buf buffer)
job_step_info_request_msg_t *job_step_info;
job_step_info = xmalloc(sizeof(job_step_info_request_msg_t));
*msg = job_step_info;
safe_unpack_time(&job_step_info->last_update, buffer);
safe_unpack32(&job_step_info->job_id, buffer);
safe_unpack32(&job_step_info->step_id, buffer);
safe_unpack16(&job_step_info->show_flags, buffer);
return SLURM_SUCCESS;
unpack_error:
*msg = NULL;
return SLURM_ERROR;
static void
_pack_node_info_request_msg(node_info_request_msg_t * msg, Buf buffer)
{
pack_time(msg->last_update, buffer);
pack16(msg->show_flags, buffer);
}
static int
_unpack_node_info_request_msg(node_info_request_msg_t ** msg, Buf buffer)
{
node_info_request_msg_t* node_info;
node_info = xmalloc(sizeof(node_info_request_msg_t));
*msg = node_info;
safe_unpack_time(&node_info->last_update, buffer);
safe_unpack16(&node_info->show_flags, buffer);
return SLURM_SUCCESS;
unpack_error:
xfree(node_info);
*msg = NULL;
return SLURM_ERROR;
}
static void
_pack_part_info_request_msg(part_info_request_msg_t * msg, Buf buffer)
{
pack_time(msg->last_update, buffer);
pack16(msg->show_flags, buffer);
}
static int
_unpack_part_info_request_msg(part_info_request_msg_t ** msg, Buf buffer)
{
part_info_request_msg_t* part_info;
part_info = xmalloc(sizeof(part_info_request_msg_t));
*msg = part_info;
safe_unpack_time(&part_info->last_update, buffer);
safe_unpack16(&part_info->show_flags, buffer);
return SLURM_SUCCESS;
unpack_error:
xfree(part_info);
*msg = NULL;
return SLURM_ERROR;
}
static void
_pack_slurm_addr_array(slurm_addr * slurm_address,
uint16_t size_val, Buf buffer)
uint16_t nl = htons(size_val);
for (i = 0; i < size_val; i++) {
slurm_pack_slurm_addr(slurm_address + i, buffer);
static int
_unpack_slurm_addr_array(slurm_addr ** slurm_address,
uint16_t * size_val, Buf buffer)
*slurm_address = NULL;
safe_unpack16(&nl, buffer);
*size_val = ntohs(nl);
*slurm_address = xmalloc((*size_val) * sizeof(slurm_addr));
for (i = 0; i < *size_val; i++) {
if (slurm_unpack_slurm_addr_no_alloc((*slurm_address) + i,
buffer))
goto unpack_error;
return SLURM_SUCCESS;
*slurm_address = NULL;
return SLURM_ERROR;
static void
_pack_batch_job_launch_msg(batch_job_launch_msg_t * msg, Buf buffer)
xassert(msg != NULL);
pack32(msg->job_id, buffer);
pack32(msg->uid, buffer);
pack16(msg->num_cpu_groups, buffer);
pack32_array(msg->cpus_per_node, msg->num_cpu_groups, buffer);
pack32_array(msg->cpu_count_reps, msg->num_cpu_groups, buffer);
packstr(msg->nodes, buffer);
packstr(msg->script, buffer);
packstr(msg->work_dir, buffer);
packstr(msg->err, buffer);
packstr(msg->in, buffer);
packstr(msg->out, buffer);
pack16(msg->argc, buffer);
packstr_array(msg->argv, msg->argc, buffer);
pack16(msg->envc, buffer);
packstr_array(msg->environment, msg->envc, buffer);
select_g_pack_jobinfo(msg->select_jobinfo, buffer);
static int
_unpack_batch_job_launch_msg(batch_job_launch_msg_t ** msg, Buf buffer)
{
uint16_t uint16_tmp;
uint32_t uint32_tmp;
batch_job_launch_msg_t *launch_msg_ptr;
xassert(msg != NULL);
launch_msg_ptr = xmalloc(sizeof(batch_job_launch_msg_t));
*msg = launch_msg_ptr;
safe_unpack32(&launch_msg_ptr->job_id, buffer);
safe_unpack32(&launch_msg_ptr->uid, buffer);
safe_unpack16(&launch_msg_ptr->num_cpu_groups, buffer);
if (launch_msg_ptr->num_cpu_groups > 0) {
safe_unpack32_array((uint32_t **) &
(launch_msg_ptr->cpus_per_node), &uint32_tmp,
buffer);
if (launch_msg_ptr->num_cpu_groups != uint32_tmp)
goto unpack_error;
safe_unpack32_array((uint32_t **) &
(launch_msg_ptr->cpu_count_reps), &uint32_tmp,
buffer);
if (launch_msg_ptr->num_cpu_groups != uint32_tmp)
goto unpack_error;
} else {
launch_msg_ptr->cpus_per_node = NULL;
launch_msg_ptr->cpu_count_reps = NULL;
}
safe_unpackstr_xmalloc(&launch_msg_ptr->nodes, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&launch_msg_ptr->script, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&launch_msg_ptr->work_dir, &uint16_tmp,
buffer);
safe_unpackstr_xmalloc(&launch_msg_ptr->err, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&launch_msg_ptr->in, &uint16_tmp, buffer);
safe_unpackstr_xmalloc(&launch_msg_ptr->out, &uint16_tmp, buffer);
safe_unpack16(&launch_msg_ptr->argc, buffer);
safe_unpackstr_array(&launch_msg_ptr->argv,
&launch_msg_ptr->argc, buffer);
safe_unpack16(&launch_msg_ptr->envc, buffer);
safe_unpackstr_array(&launch_msg_ptr->environment,
&launch_msg_ptr->envc, buffer);
if (select_g_alloc_jobinfo (&launch_msg_ptr->select_jobinfo)
|| select_g_unpack_jobinfo(launch_msg_ptr->select_jobinfo, buffer))
goto unpack_error;
return SLURM_SUCCESS;
xfree(launch_msg_ptr->nodes);
xfree(launch_msg_ptr->script);
xfree(launch_msg_ptr->work_dir);
xfree(launch_msg_ptr->err);
xfree(launch_msg_ptr->in);
xfree(launch_msg_ptr->out);
xfree(launch_msg_ptr->argv);
xfree(launch_msg_ptr->environment);
select_g_free_jobinfo(&launch_msg_ptr->select_jobinfo);
*msg = NULL;
return SLURM_ERROR;
static void
_pack_job_id_request_msg(job_id_request_msg_t * msg, Buf buffer)
{
xassert(msg != NULL);
pack32(msg->job_pid, buffer);
}
static int
_unpack_job_id_request_msg(job_id_request_msg_t ** msg, Buf buffer)
{
job_id_request_msg_t *tmp_ptr;
/* alloc memory for structure */
xassert(msg != NULL);
tmp_ptr = xmalloc(sizeof(job_id_request_msg_t));
*msg = tmp_ptr;
/* load the data values */
safe_unpack32(&tmp_ptr->job_pid, buffer);
return SLURM_SUCCESS;
unpack_error:
*msg = NULL;
return SLURM_ERROR;
}
static void
_pack_job_id_response_msg(job_id_response_msg_t * msg, Buf buffer)
{
xassert(msg != NULL);
pack32(msg->job_id, buffer);
}
static int
_unpack_job_id_response_msg(job_id_response_msg_t ** msg, Buf buffer)
{
job_id_response_msg_t *tmp_ptr;
/* alloc memory for structure */
xassert(msg != NULL);
tmp_ptr = xmalloc(sizeof(job_id_response_msg_t));
*msg = tmp_ptr;
/* load the data values */
safe_unpack32(&tmp_ptr->job_id, buffer);
return SLURM_SUCCESS;
unpack_error:
*msg = NULL;
return SLURM_ERROR;
}
static void
_pack_srun_ping_msg(srun_ping_msg_t * msg, Buf buffer)
{
xassert ( msg != NULL );
pack32 ( msg ->job_id , buffer ) ;
pack32 ( msg ->step_id , buffer ) ;
}
static int
_unpack_srun_ping_msg(srun_ping_msg_t ** msg_ptr, Buf buffer)
{
srun_ping_msg_t * msg;
xassert ( msg_ptr != NULL );
msg = xmalloc ( sizeof (srun_ping_msg_t) ) ;
*msg_ptr = msg;
safe_unpack32 ( & msg->job_id , buffer ) ;
safe_unpack32 ( & msg->step_id , buffer ) ;
return SLURM_SUCCESS;
unpack_error:
*msg_ptr = NULL;
xfree(msg);
return SLURM_ERROR;
}
static void
_pack_srun_node_fail_msg(srun_node_fail_msg_t * msg, Buf buffer)
{
xassert ( msg != NULL );
pack32 ( msg ->job_id , buffer ) ;
pack32 ( msg ->step_id , buffer ) ;
packstr ( msg ->nodelist, buffer ) ;
}
static int
_unpack_srun_node_fail_msg(srun_node_fail_msg_t ** msg_ptr, Buf buffer)
{
uint16_t uint16_tmp;
srun_node_fail_msg_t * msg;
xassert ( msg_ptr != NULL );
msg = xmalloc ( sizeof (srun_node_fail_msg_t) ) ;
*msg_ptr = msg;
safe_unpack32 ( & msg->job_id , buffer ) ;
safe_unpack32 ( & msg->step_id , buffer ) ;
safe_unpackstr_xmalloc ( & msg->nodelist, &uint16_tmp, buffer);
return SLURM_SUCCESS;
unpack_error:
*msg_ptr = NULL;
xfree( msg->nodelist );
xfree( msg );
return SLURM_ERROR;
}
static void
_pack_srun_timeout_msg(srun_timeout_msg_t * msg, Buf buffer)
{
xassert ( msg != NULL );
pack32 ( msg -> job_id , buffer ) ;
pack32 ( msg -> step_id , buffer ) ;
pack_time ( msg -> timeout, buffer );
}
static int
_unpack_srun_timeout_msg(srun_timeout_msg_t ** msg_ptr, Buf buffer)
{
srun_timeout_msg_t * msg;
xassert ( msg_ptr != NULL );
msg = xmalloc ( sizeof (srun_timeout_msg_t) ) ;
*msg_ptr = msg ;
safe_unpack32 ( & msg -> job_id , buffer ) ;
safe_unpack32 ( & msg -> step_id , buffer ) ;
safe_unpack_time ( & msg -> timeout , buffer );
return SLURM_SUCCESS;
unpack_error:
*msg_ptr = NULL;
xfree(msg);
return SLURM_ERROR;
}
static void
_pack_checkpoint_msg(checkpoint_msg_t *msg, Buf buffer)
{
xassert ( msg != NULL );
pack16 ( msg -> op, buffer ) ;
pack32 ( msg -> job_id, buffer ) ;
pack32 ( msg -> step_id, buffer ) ;
}
static int
_unpack_checkpoint_msg(checkpoint_msg_t **msg_ptr, Buf buffer)
{
checkpoint_msg_t * msg;
xassert ( msg_ptr != NULL );
msg = xmalloc ( sizeof (checkpoint_msg_t) ) ;
*msg_ptr = msg ;
safe_unpack16 ( & msg -> op , buffer ) ;
safe_unpack32 ( & msg -> job_id , buffer ) ;
safe_unpack32 ( & msg -> step_id , buffer ) ;
return SLURM_SUCCESS;
unpack_error:
*msg_ptr = NULL;
xfree(msg);
return SLURM_ERROR;
}
static void
_pack_checkpoint_resp_msg(checkpoint_resp_msg_t *msg, Buf buffer)
{
xassert ( msg != NULL );
packstr ( msg -> ckpt_strerror, buffer ) ;
}
static int
_unpack_checkpoint_resp_msg(checkpoint_resp_msg_t **msg_ptr, Buf buffer)
{
checkpoint_resp_msg_t * msg;
uint16_t uint16_tmp;
xassert ( msg_ptr != NULL );
msg = xmalloc ( sizeof (checkpoint_resp_msg_t) ) ;
*msg_ptr = msg ;
safe_unpackstr_xmalloc ( & msg -> ckpt_strerror, & uint16_tmp , buffer ) ;
return SLURM_SUCCESS;
unpack_error:
*msg_ptr = NULL;
xfree(msg);
return SLURM_ERROR;
}
void pack_ ( * msg , Buf buffer )
xassert ( msg != NULL );
pack16 ( msg -> , buffer ) ;
pack32 ( msg -> , buffer ) ;
packstr ( msg -> , buffer ) ;
int unpack_ ( ** msg_ptr , Buf buffer )
uint16_t uint16_tmp;
xassert ( msg_ptr != NULL );
msg = xmalloc ( sizeof ( ) ) ;
*msg_ptr = msg;
safe_unpack16 ( & msg -> , buffer ) ;
safe_unpack32 ( & msg -> , buffer ) ;
safe_unpackstr_xmalloc ( & msg -> x, & uint16_tmp , buffer ) ;
return SLURM_SUCCESS;
unpack_error:
xfree(msg -> x);
xfree(msg);
*msg_ptr = NULL;
return SLURM_ERROR;