Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
pvfs2-osd/src/client/sysint/pint-sysdev-unexp.sm
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
118 lines (102 sloc)
2.69 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* (C) 2001 Clemson University and The University of Chicago | |
* | |
* See COPYING in top-level directory. | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#ifndef WIN32 | |
#include <unistd.h> | |
#include <sys/time.h> | |
#endif | |
#include <fcntl.h> | |
#include "state-machine.h" | |
#include "client-state-machine.h" | |
#include "job-time-mgr.h" | |
extern job_context_id pint_client_sm_context; | |
%% | |
machine pvfs2_sysdev_unexp_sm | |
{ | |
state post | |
{ | |
run sysdev_unexp_post; | |
default => cleanup; | |
} | |
state cleanup | |
{ | |
run sysdev_unexp_cleanup; | |
default => terminate; | |
} | |
} | |
%% | |
/* sysdev_unexp_cleanup() | |
* | |
* cleans up any resources consumed by this state machine and ends | |
* execution of the machine | |
*/ | |
static int sysdev_unexp_cleanup(struct PINT_smcb *smcb, job_status_s* js_p) | |
{ | |
return SM_ACTION_TERMINATE; | |
} | |
/* sysdev_unexp_post() | |
* | |
* posts an unexpected message job for the client | |
*/ | |
static int sysdev_unexp_post(struct PINT_smcb *smcb, job_status_s* js_p) | |
{ | |
struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); | |
PVFS_error ret; | |
job_id_t tmpid; | |
memset(js_p, 0, sizeof(job_status_s)); | |
ret = job_dev_unexp(sm_p->u.sysdev_unexp.info, (void *)smcb, 0, js_p, | |
&tmpid, JOB_NO_IMMED_COMPLETE, pint_client_sm_context); | |
if (ret < 0) | |
{ | |
PVFS_perror_gossip("PINT_sys_dev_unexp failed", ret); | |
return SM_ACTION_COMPLETE; | |
} | |
return SM_ACTION_DEFERRED; | |
} | |
PVFS_error PINT_sys_dev_unexp( | |
struct PINT_dev_unexp_info *info, | |
job_status_s *jstat, | |
PVFS_sys_op_id *op_id, | |
void *user_ptr) | |
{ | |
PVFS_error ret = -PVFS_EINVAL; | |
PINT_smcb *smcb = NULL; | |
PINT_client_sm *sm_p = NULL; | |
gossip_debug(GOSSIP_CLIENT_DEBUG, "PINT_sys_dev_unexp\n"); | |
/* we require more input args than the regular post method above */ | |
if (!info || !jstat || !op_id) | |
{ | |
return -PVFS_EINVAL; | |
} | |
ret = PINT_smcb_alloc(&smcb, PVFS_DEV_UNEXPECTED, | |
sizeof(struct PINT_client_sm), | |
client_op_state_get_machine, | |
client_state_machine_terminate, | |
pint_client_sm_context); | |
if (ret < 0) | |
{ | |
gossip_lerr("Error: failed to allocate SMCB " | |
"of op type %x\n", PVFS_DEV_UNEXPECTED); | |
return ret; | |
} | |
sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); | |
sm_p->u.sysdev_unexp.info = info; | |
sm_p->cred_p = NULL; | |
ret = PINT_client_state_machine_post(smcb, op_id, user_ptr); | |
return ret; | |
} | |
/* | |
* Local variables: | |
* mode: c | |
* c-indent-level: 4 | |
* c-basic-offset: 4 | |
* End: | |
* | |
* vim: ft=c ts=8 sts=4 sw=4 expandtab | |
*/ |