diff requests.h @ 134:a9b72021f053

Distributed memory management w/o free requests working
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 16:19:24 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/requests.h	Fri Sep 16 16:19:24 2011 +0200
     1.3 @@ -0,0 +1,103 @@
     1.4 +/* 
     1.5 + * File:   requests.h
     1.6 + * Author: msach
     1.7 + *
     1.8 + * Created on September 16, 2011, 3:11 PM
     1.9 + */
    1.10 +
    1.11 +#ifndef REQUESTS_H
    1.12 +#define	REQUESTS_H
    1.13 +
    1.14 +#include "ProcrContext.h"
    1.15 +
    1.16 +typedef struct _InterMasterReqst InterMasterReqst;
    1.17 +
    1.18 +//============= Requests ===========
    1.19 +//
    1.20 +
    1.21 +//VMS Request is the carrier for Slave to Master requests
    1.22 +// it has an embedded sub-type request that is pulled out
    1.23 +// inside the plugin's request handler
    1.24 +enum VMSReqstType   //For Slave->Master requests
    1.25 + { 
    1.26 +   semantic = 1,    //avoid starting enums at 0, for debug reasons
    1.27 +   createReq,
    1.28 +   dissipate,
    1.29 +   VMSSemantic      //goes with VMSSemReqst below
    1.30 + };
    1.31 +
    1.32 +struct _VMSReqst
    1.33 + {
    1.34 +   enum VMSReqstType  reqType;//used for dissipate and in future for IO requests
    1.35 +   void              *semReqData;
    1.36 +
    1.37 +   VMSReqst *nextReqst;
    1.38 + };
    1.39 +//VMSReqst
    1.40 +
    1.41 +//This is a sub-type of Slave->Master requests.
    1.42 +// It's for Slaves to invoke built-in VMS-core functions that have language-like
    1.43 +// behavior.
    1.44 +enum VMSSemReqstType   //These are equivalent to semantic requests, but for
    1.45 + {                     // VMS's services available directly to app, like OS
    1.46 +   createProbe = 1,    // and probe services -- like a VMS-wide built-in lang
    1.47 +   openFile,
    1.48 +   otherIO
    1.49 + };
    1.50 +
    1.51 +typedef struct
    1.52 + { enum VMSSemReqstType reqType;
    1.53 +   VirtProcr           *requestingPr;
    1.54 +   char                *nameStr;  //for create probe
    1.55 + }
    1.56 +VMSSemReq;
    1.57 +
    1.58 +//These are for Master to Master requests
    1.59 +// They get re-cast to the appropriate sub-type of request
    1.60 +enum InterMasterReqstType    //For Master->Master
    1.61 + {
    1.62 +   destVMSCore = 1,          //avoid starting enums at 0, for debug reasons
    1.63 +   destPlugin
    1.64 + };
    1.65 +
    1.66 +struct _InterMasterReqst //Doing a trick to save space & time -- allocate
    1.67 + {  // space for a sub-type then cast first as InterMaster then as sub-type
    1.68 +   enum InterMasterReqstType  reqType;
    1.69 +   InterMasterReqst *nextReqst;
    1.70 + };
    1.71 +//InterMasterReqst  (defined above in typedef block)
    1.72 +
    1.73 +
    1.74 +//These are a sub-type of InterMaster requests.  The inter-master req gets
    1.75 +// re-cast to be of this type, after checking
    1.76 +//This ones for requests between internals of VMS-core.. such as malloc
    1.77 +enum InterVMSCoreReqType   
    1.78 + {
    1.79 +   transfer_free_ptr = 1     //avoid starting enums at 0, for debug reasons
    1.80 + };
    1.81 +
    1.82 +//Doing a trick to save space & time -- allocate space
    1.83 +// for this, cast first as InterMaster then as this
    1.84 +typedef struct  
    1.85 + {
    1.86 +   enum InterMasterReqstType  reqType;  //duplicate InterMasterReqst at top
    1.87 +   InterMasterReqst *nextReqst;
    1.88 +   
    1.89 +   enum InterVMSCoreReqType  secondReqType;
    1.90 +   void                     *freePtr;  //pile up fields, add as needed
    1.91 + } InterVMSCoreReqst;
    1.92 +
    1.93 +//This is for requests between plugins on different cores
    1.94 +// Here, after casting, the pluginReq is extracted and handed to plugin
    1.95 +//Doing a trick to save space & time -- allocate space
    1.96 +// for this, cast first as InterMaster then as this
    1.97 +typedef struct  
    1.98 + {
    1.99 +   enum InterMasterReqstType  reqType;  //copy InterMasterReqst at top
   1.100 +   InterMasterReqst          *nextReqst;
   1.101 +   
   1.102 +   void                      *pluginReq; //plugin will cast to approp type
   1.103 + } InterPluginReqst;
   1.104 +
   1.105 +#endif	/* REQUESTS_H */
   1.106 +