PyObject *py_ped_constraint_new_from_min(PyObject *s, PyObject *args) { PyObject *in_min = NULL; PedGeometry *out_min = NULL; PedConstraint *constraint = NULL; _ped_Constraint *ret = NULL; if (!PyArg_ParseTuple(args, "O!", &_ped_Geometry_Type_obj, &in_min)) { return NULL; } out_min = _ped_Geometry2PedGeometry(in_min); if (out_min == NULL) { return NULL; } constraint = ped_constraint_new_from_min(out_min); if (constraint) { ret = PedConstraint2_ped_Constraint(constraint); } else { PyErr_SetString(CreateException, "Could not create new constraint from min"); return NULL; } ped_constraint_destroy(constraint); return (PyObject *) ret; }
/* The constraint for the volume header partition is different, because it must * contain the first sector of the disk. */ static PedConstraint* _get_extended_constraint (PedDisk* disk) { PedGeometry min_geom; if (!ped_geometry_init (&min_geom, disk->dev, 0, 1)) return NULL; return ped_constraint_new_from_min (&min_geom); }