fixed a bug in pxshm
[charm.git] / src / arch / gemini_gni / machine-persistent.h
1 /** @file
2  * General implementation of persistent communication support
3  * @ingroup Machine
4  */
5
6 /**
7  * \addtogroup Machine
8 */
9 /*@{*/
10
11 #define PERSIST_BUFFERS_NUM             1
12
13 typedef struct  _PersistentBuf {
14   void *destAddress;
15   void *destSizeAddress;
16   gni_mem_handle_t    mem_hndl;
17 } PersistentBuf;
18
19 typedef struct _PersistentSendsTable {
20   int destPE;
21   int sizeMax;
22   PersistentHandle   destHandle;  
23   PersistentBuf     destBuf[PERSIST_BUFFERS_NUM];
24   void *messageBuf;
25   int messageSize;
26   char used;
27 } PersistentSendsTable;
28
29 typedef struct _PersistentReceivesTable {
30 #if 0
31   void *messagePtr[PERSIST_BUFFERS_NUM];      /* preallocated message buffer of size "sizeMax" */
32   unsigned int *recvSizePtr[PERSIST_BUFFERS_NUM];   /* pointer to the size */
33 #endif
34   PersistentBuf     destBuf[PERSIST_BUFFERS_NUM];
35   int sizeMax;
36   struct _PersistentReceivesTable *prev, *next;
37 } PersistentReceivesTable;
38
39 extern PersistentReceivesTable *persistentReceivesTableHead;
40 extern PersistentReceivesTable *persistentReceivesTableTail;
41
42 extern PersistentHandle  *phs;
43 extern int phsSize;
44
45 void *PerAlloc(int size);
46 void PerFree(char *msg);
47 int PumpPersistent();
48 void swapSendSlotBuffers(PersistentSendsTable *slot);
49 void swapRecvSlotBuffers(PersistentReceivesTable *slot);
50 void setupRecvSlot(PersistentReceivesTable *slot, int maxBytes);
51
52 /*@}*/