90 lines
2.9 KiB
Diff
90 lines
2.9 KiB
Diff
diff --git a/pydisk.c b/pydisk.c
|
|
index 51c2e27..20bb714 100644
|
|
--- a/pydisk.c
|
|
+++ b/pydisk.c
|
|
@@ -589,6 +589,28 @@ py_ped_partition_set_system (PyPedPartition *p, PyObject * args)
|
|
}
|
|
|
|
static PyObject *
|
|
+py_ped_partition_set_geometry (PyPedPartition *p, PyObject * args)
|
|
+{
|
|
+ PyPedConstraint *cs = NULL;
|
|
+ PedSector start, end;
|
|
+
|
|
+ if (!PyArg_ParseTuple(args, "O!LL", &PyPedConstraintType, &cs,
|
|
+ &start, &end))
|
|
+ return NULL;
|
|
+
|
|
+ py_ped_exception_string_clear ();
|
|
+
|
|
+ if (!ped_disk_set_partition_geom (p->disk->disk, p->part, cs->constraint,
|
|
+ start, end)) {
|
|
+ py_ped_set_error_from_ped_exception ();
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ Py_INCREF(Py_None);
|
|
+ return Py_None;
|
|
+}
|
|
+
|
|
+static PyObject *
|
|
py_ped_partition_set_name (PyPedPartition *p, PyObject * args)
|
|
{
|
|
char *name;
|
|
@@ -685,6 +707,8 @@ static struct PyMethodDef PyPedPartitionMethods[] = {
|
|
METH_VARARGS, NULL },
|
|
{ "set_name", (PyCFunction) py_ped_partition_set_name,
|
|
METH_VARARGS, NULL },
|
|
+ { "set_geometry", (PyCFunction) py_ped_partition_set_geometry,
|
|
+ METH_VARARGS, NULL },
|
|
{ "get_name", (PyCFunction) py_ped_partition_get_name,
|
|
METH_VARARGS, NULL },
|
|
{ "is_busy", (PyCFunction) py_ped_partition_is_busy,
|
|
diff --git a/pygeometry.c b/pygeometry.c
|
|
index fdd7614..8522161 100644
|
|
--- a/pygeometry.c
|
|
+++ b/pygeometry.c
|
|
@@ -24,6 +24,7 @@
|
|
#include "partedmodule.h"
|
|
#include "pygeometry.h"
|
|
#include "pyfilesystem.h"
|
|
+#include "pyconstraint.h"
|
|
|
|
/* geometry implementation */
|
|
|
|
@@ -157,6 +158,24 @@ py_ped_geometry_duplicate (PyPedGeometry * self, PyObject * args)
|
|
return (PyObject *) py_ped_geometry_obj_new (geom, self->dev, 0);
|
|
}
|
|
|
|
+static PyObject *
|
|
+py_ped_constraint_exact (PyPedGeometry * self, PyObject * args)
|
|
+{
|
|
+ PedConstraint *constraint;
|
|
+ PyPedConstraint *pyconstraint;
|
|
+
|
|
+ py_ped_exception_string_clear ();
|
|
+ constraint = ped_constraint_exact (self->geom);
|
|
+ if (constraint == NULL) {
|
|
+ py_ped_set_error_from_ped_exception ();
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ pyconstraint = py_ped_constraint_obj_new (constraint, self->dev, 0);
|
|
+
|
|
+ return (PyObject *) pyconstraint;
|
|
+}
|
|
+
|
|
static struct PyMethodDef PyPedGeometryMethods[] = {
|
|
{ "file_system_open",
|
|
(PyCFunction) py_ped_file_system_open, METH_VARARGS, NULL },
|
|
@@ -172,7 +191,8 @@ static struct PyMethodDef PyPedGeometryMethods[] = {
|
|
(PyCFunction) py_ped_geometry_set_end, METH_VARARGS, NULL },
|
|
{ "duplicate",
|
|
(PyCFunction) py_ped_geometry_duplicate, METH_VARARGS, NULL },
|
|
-
|
|
+ { "constraint_exact",
|
|
+ (PyCFunction) py_ped_constraint_exact, METH_VARARGS, NULL },
|
|
{ NULL, NULL, 0, NULL }
|
|
};
|
|
|