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 / doc / add-server-req < prev    next >
Text File  |  2010-04-30  |  3KB  |  81 lines

  1.  
  2.  
  3. Steps in adding a request to the server:
  4.  
  5. 1) select a request name and number
  6.         src/proto/pvfs2-req-proto.h
  7.  
  8. 2) add a request and response struct
  9.         src/proto/pvfs2-req-proto.h
  10.         add entry to unions: PVFS_server_req and PVFS_server_resp
  11.  
  12. 2a) add endecode functions if needed
  13.         src/proto/endecode-funcs.h
  14.             for each of these you add or modify you must also
  15.             add a stub in include/pvfs2-encode-stubs.h
  16.  
  17. 2b) update the protocol version number
  18.         src/proto/pvfs2-req-proto.h
  19.             increment PVFS2_PROTO_MINOR, assuming that the
  20.             addition of this new request does not break backwards
  21.             compatibility for other request types
  22.        
  23. 3) add entries to decode/encode functions
  24.         src/proto/PINT-le-bytefield.c
  25.             lebf_initialize() - need code here to set up a request so it
  26.                 can be encoded and expression for extra message size if any
  27.             lebf_encode_req()
  28.             lebf_encode_resp()
  29.             lebf_decode_req()
  30.             lebf_decode_resp()
  31.             lebf_decode_rel() (2 places)
  32.                 In this last entry, we free any resources allocated during
  33.                 decode - specifically array items
  34.                 This does not free resources allocated by SM code
  35.  
  36. 4) add request specific scratch space to PINT_server_op
  37.         src/server/pvfs2-server.h
  38.             PINT_server_op  -- only if required
  39.  
  40. 5) write state machine -- see details below
  41.         src/server/<reqname>.sm
  42.             each state machine added must have a delcaration in
  43.                 src/server/pvfs2-server.h
  44.  
  45. 6) update src/server/pvfs2-server-req.c
  46.                 add new entry to PINT_server_req_table[]
  47.                 reference the params structure from the state machine
  48.  
  49.  
  50. Writing State Machines
  51.  
  52. Every state machine passes a PINT_server_op in to each state function.
  53.     state machine initialized in src/server/pvfs2-server.c
  54.         server_state_machine_start
  55.             gets the s_op set up
  56.             decodes request message
  57.             sets s_op->req, s_op->resp
  58.  
  59. Each state machine must first run the pvfs2_prelude_sm
  60.     reads the attribs of the target object, if appropriate to s_op->attr
  61.     does basic permission checking
  62.     posts request to the scheduler
  63.  
  64. State machines typically submit jobs, defined in
  65.     src/io/job/job.h
  66.  
  67. Each state machine must run the pvfs2_final_response_sm
  68.     releases request from the scheduler
  69.     sends response to the client
  70.         s_op->resp must be filled in
  71.         return status in js_p->error_code
  72.  
  73. Cleanup must free any memory allocated by SM code
  74.  
  75. State functions return 0 or 1 on error-free completion,
  76.     0 indicates an asynchronous call has been made and must be waited for
  77.     1 indicates no async call was made and should proceed to next state
  78.     <0 indicates an error - use PVFS_EXXX codes defined in
  79.         include/pvfs2-types.h
  80.  
  81.