#include <libintl.h>
#include <locale.h>
-#include <sys/mount.h>
#include <solv/solver.h>
Py_RETURN_FALSE;
}
-static PyObject* _pakfire_mount(PyObject* self, PyObject* args, PyObject* kwds) {
- char* kwlist[] = {
- "path",
- "target",
- "type",
- "flags",
- "options",
- NULL,
- };
-
- const char* path = NULL;
- const char* target = NULL;
- const char* type = NULL;
- int flags = 0;
- const char* options = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|zis", kwlist,
- &path, &target, &type, &flags, &options))
- return NULL;
-
- int r = mount(path, target, type, flags, options);
- if (r) {
- PyErr_SetFromErrnoWithFilename(PyExc_OSError, path);
- return NULL;
- }
-
- Py_RETURN_NONE;
-}
-
-static PyObject* _pakfire_umount(PyObject* self, PyObject* args) {
- const char* path = NULL;
-
- if (!PyArg_ParseTuple(args, "s", &path))
- return NULL;
-
- int r = umount(path);
- if (r) {
- PyErr_SetFromErrnoWithFilename(PyExc_OSError, path);
- return NULL;
- }
-
- Py_RETURN_NONE;
-}
-
static PyMethodDef pakfireModuleMethods[] = {
{"performance_index", (PyCFunction)performance_index, METH_VARARGS, NULL},
{"native_arch", (PyCFunction)_pakfire_native_arch, METH_NOARGS, NULL },
{"arch_supported_by_host", (PyCFunction)_pakfire_arch_supported_by_host, METH_VARARGS, NULL },
- {"mount", (PyCFunction)_pakfire_mount, METH_VARARGS|METH_KEYWORDS, NULL },
- {"umount", (PyCFunction)_pakfire_umount, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
if (PyModule_AddIntConstant(module, "PAKFIRE_EQ", PAKFIRE_EQ))
return NULL;
- // Mount Flags
- if (PyModule_AddIntConstant(module, "MS_NOATIME", MS_NOATIME))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_NODEV", MS_NODEV))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_NOEXEC", MS_NOEXEC))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_RDONLY", MS_RDONLY))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_RELATIME", MS_RELATIME))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_STRICTATIME", MS_STRICTATIME))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_BIND", MS_BIND))
- return NULL;
-
- if (PyModule_AddIntConstant(module, "MS_REMOUNT", MS_REMOUNT))
- return NULL;
-
return module;
}