OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

mtl_portals4_message.h
1 /*
2 * Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
3 * $COPYRIGHT$
4 *
5 * Additional copyrights may follow
6 *
7 * $HEADER$
8 */
9
10 #ifndef MTL_PORTALS4_MESSAGE_H
11 #define MTL_PORTALS4_MESSAGE_H
12
13 struct ompi_mtl_portals4_message_t {
14 opal_free_list_item_t super;
15 ptl_event_t ev;
16 void *buffer;
17 };
18 typedef struct ompi_mtl_portals4_message_t ompi_mtl_portals4_message_t;
19 OBJ_CLASS_DECLARATION(ompi_mtl_portals4_message_t);
20
21
22 static inline ompi_mtl_portals4_message_t*
23 ompi_mtl_portals4_message_alloc(const ptl_event_t *ev)
24 {
25 int rc;
26 opal_free_list_item_t *tmp;
27 ompi_mtl_portals4_message_t* message;
28
29 OPAL_FREE_LIST_GET(&ompi_mtl_portals4.fl_message,
30 tmp,
31 rc);
32 if (NULL == tmp) return NULL;
33
34 message = (ompi_mtl_portals4_message_t*) tmp;
35
36 message->ev = *ev;
37
38 if (0 == ev->mlength) {
39 message->buffer = NULL;
40 } else {
41 /* once we've finished processing the event, an AUTO_FREE
42 event might be next, rendering the data in ev.start
43 invalid. Copy it away... */
44 memcpy(message->buffer, ev->start, ev->mlength);
45 message->ev.start = message->buffer;
46 }
47
48 return message;
49 }
50
51 static inline void
52 ompi_mtl_portals4_message_free(ompi_mtl_portals4_message_t *message)
53 {
54 OPAL_FREE_LIST_RETURN(&ompi_mtl_portals4.fl_message,
55 &message->super);
56 }
57
58 #endif
opal_free_list_item_t
Definition: opal_free_list.h:47
ompi_mtl_portals4_message_t
Definition: mtl_portals4_message.h:13
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236