Motr  M0
motr.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #include <Python.h>
24 #include "motr/ha.h" /* m0_motr_ha */
25 #include "module/instance.h"
26 #include "net/net.h"
27 #include "net/buffer_pool.h"
28 #include "reqh/reqh.h"
29 #include "rpc/rpc_machine.h"
30 #include "spiel/spiel.h"
31 
32 #define STRUCTS \
33  X(m0) \
34  X(m0_net_domain) \
35  X(m0_net_buffer_pool) \
36  X(m0_reqh) \
37  X(m0_reqh_init_args) \
38  X(m0_reqh_service) \
39  X(m0_rpc_machine) \
40  X(m0_motr_ha) \
41  X(m0_motr_ha_cfg) \
42  X(m0_spiel_tx) \
43  X(m0_spiel)
44 
45 #define X(name) \
46 static PyObject *name ## __size(PyObject *self, PyObject *args) \
47 { \
48  return PyLong_FromSize_t(sizeof(struct name)); \
49 }
50 STRUCTS
51 #undef X
52 
53 static PyMethodDef methods[] = {
54 #define X(name) { #name "__size", name ## __size, METH_VARARGS, NULL },
55 STRUCTS
56 #undef X
57  {NULL, NULL, 0, NULL}
58 };
59 
60 static struct PyModuleDef motrmodule = {
61  PyModuleDef_HEAD_INIT,
62  "motr", /* name of module */
63  NULL, /* module documentation, may be NULL */
64  -1, /* size of per-interpreter state of the module,
65  or -1 if the module keeps state in global variables. */
66  methods
67 };
68 
69 PyMODINIT_FUNC PyInit_motr(void)
70 {
71  return PyModule_Create(&motrmodule);
72 }
#define NULL
Definition: misc.h:38
static struct PyModuleDef motrmodule
Definition: motr.c:60
PyMODINIT_FUNC PyInit_motr(void)
Definition: motr.c:69
#define STRUCTS
Definition: motr.c:32
static STRUCTS PyMethodDef methods[]
Definition: motr.c:53