1 #include <Python.h>
2 #include <time.h>
3 #include <uuid/uuid.h>
4 
_uuid_generate(PyObject * self,PyObject * args)5 static PyObject * _uuid_generate(PyObject *self, PyObject *args)
6 {
7   uuid_t u;
8   char uuid[37];
9   if (!PyArg_ParseTuple(args, "")) return NULL;
10   uuid_generate(u);
11   uuid_unparse(u, uuid);
12   return Py_BuildValue("s", uuid);
13 }
14 
15 static PyMethodDef _uuid_methods[] = {
16   {"generate", _uuid_generate, METH_VARARGS, "Generate UUID"},
17   {NULL, NULL, 0, NULL}
18 };
19 
inite2fsprogs_uuid(void)20 void inite2fsprogs_uuid(void)
21 {
22   (void) Py_InitModule("e2fsprogs_uuid", _uuid_methods);
23 }
24