home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / src / server / get-config.sm < prev    next >
Text File  |  2008-02-11  |  2KB  |  124 lines

  1. /* 
  2.  * (C) 2001 Clemson University and The University of Chicago 
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include <assert.h>
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <unistd.h>
  12. #include <fcntl.h>
  13.  
  14. #include "server-config.h"
  15. #include "pvfs2-server.h"
  16.  
  17. %%
  18.  
  19. machine pvfs2_get_config_sm
  20. {
  21.     state prelude
  22.     {
  23.         jump pvfs2_prelude_sm;
  24.         success => init;
  25.         default => final_response;
  26.     }
  27.  
  28.     state init
  29.     {
  30.         run getconfig_init;
  31.         default => final_response;
  32.     }
  33.  
  34.     state final_response
  35.     {
  36.         jump pvfs2_final_response_sm;
  37.         default => cleanup;
  38.     }
  39.  
  40.     state cleanup
  41.     {
  42.         run getconfig_cleanup;
  43.         default => terminate;
  44.     }
  45. }
  46.  
  47. %%
  48.  
  49. /*
  50.  * Function: getconfig_init
  51.  *
  52.  * Params:   server_op *b, 
  53.  *           job_status_s* js_p
  54.  *
  55.  * Pre:      fs_id mapping exists on server
  56.  *
  57.  * Post:     None
  58.  *
  59.  * Returns:  void
  60.  *
  61.  * Synopsis: Get information from config structure
  62.  *           then move to next state.
  63.  *           
  64.  */
  65.  
  66. static PINT_sm_action getconfig_init(
  67.         struct PINT_smcb *smcb, job_status_s *js_p)
  68. {
  69.     struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
  70.     struct server_configuration_s *user_opts = get_server_config_struct();
  71.     assert(user_opts);
  72.  
  73.     /* TODO: handle this properly later */
  74.     assert(user_opts->fs_config_buflen <= PVFS_REQ_LIMIT_CONFIG_FILE_BYTES);
  75.  
  76.     s_op->resp.u.getconfig.fs_config_buf_size =
  77.         (uint32_t)user_opts->fs_config_buflen;
  78.     s_op->resp.u.getconfig.fs_config_buf =
  79.         (char*)user_opts->fs_config_buf;
  80.  
  81.     js_p->error_code = 0;
  82.     return SM_ACTION_COMPLETE;
  83. }
  84.  
  85. /*
  86.  * Function: getconfig_cleanup
  87.  *
  88.  * Params:   server_op *b, 
  89.  *           job_status_s* js_p
  90.  *
  91.  * Pre:      None
  92.  *
  93.  * Post:     None
  94.  *
  95.  * Returns:  void
  96.  *
  97.  * Synopsis: cleans up string memory
  98.  *           response structure
  99.  */
  100.  
  101. static PINT_sm_action getconfig_cleanup(
  102.         struct PINT_smcb *smcb, job_status_s *js_p)
  103. {
  104.     return(server_state_machine_complete(smcb));
  105. }
  106.  
  107. struct PINT_server_req_params pvfs2_get_config_params =
  108. {
  109.     .string_name = "getconfig",
  110.     .perm = PINT_SERVER_CHECK_NONE,
  111.     .state_machine = &pvfs2_get_config_sm
  112. };
  113.  
  114. /*
  115.  * Local variables:
  116.  *  mode: c
  117.  *  c-indent-level: 4
  118.  *  c-basic-offset: 4
  119.  * End:
  120.  *
  121.  * vim: ft=c ts=8 sts=4 sw=4 expandtab
  122.  */
  123.  
  124.