196 lines
6.5 KiB
Diff
196 lines
6.5 KiB
Diff
|
diff -ru parted-1.6.21/python-parted-0.11.2/parted.py parted-1.6.21-fix/python-parted-0.11.2/parted.py
|
||
|
--- parted-1.6.21/python-parted-0.11.2/parted.py 2002-09-17 19:07:55.000000000 +0000
|
||
|
+++ parted-1.6.21-fix/python-parted-0.11.2/parted.py 2005-03-14 16:21:21.000000000 +0000
|
||
|
@@ -100,7 +100,23 @@
|
||
|
return self.list[i:j]
|
||
|
|
||
|
###############################################################################
|
||
|
-# PEDDEVICE
|
||
|
+# PEDCHSGEOMETRY, PEDDEVICE
|
||
|
+
|
||
|
+class CHSGeometry:
|
||
|
+ def __init__(self, obj):
|
||
|
+ self._o = obj
|
||
|
+
|
||
|
+ # Accessor Methods
|
||
|
+
|
||
|
+ def get_cylinders(self):
|
||
|
+ return _parted.chs_geometry_get_cylinders(self._o)
|
||
|
+
|
||
|
+ def get_heads(self):
|
||
|
+ return _parted.chs_geometry_get_heads(self._o)
|
||
|
+
|
||
|
+ def get_sectors(self):
|
||
|
+ return _parted.chs_geometry_get_sectors(self._o)
|
||
|
+
|
||
|
|
||
|
# Enum DeviceType
|
||
|
DEVICE_UNKNOWN = 0
|
||
|
@@ -143,17 +159,11 @@
|
||
|
def get_sector_size(self):
|
||
|
return _parted.device_get_sector_size(self._o)
|
||
|
|
||
|
- def get_heads(self):
|
||
|
- return _parted.device_get_heads(self._o)
|
||
|
-
|
||
|
- def get_sectors(self):
|
||
|
- return _parted.device_get_sectors(self._o)
|
||
|
-
|
||
|
- def get_cylinders(self):
|
||
|
- return _parted.device_get_cylinders(self._o)
|
||
|
+ def get_hw_geom(self):
|
||
|
+ return CHSGeometry(_parted.device_get_hw_geom(self._o))
|
||
|
|
||
|
- def get_geom_known(self):
|
||
|
- return _parted.device_get_geom_known(self._o)
|
||
|
+ def get_bios_geom(self):
|
||
|
+ return CHSGeometry(_parted.device_get_bios_geom(self._o))
|
||
|
|
||
|
def get_host(self):
|
||
|
return _parted.device_get_host(self._o)
|
||
|
diff -ru parted-1.6.21/python-parted-0.11.2/pyparted.c parted-1.6.21-fix/python-parted-0.11.2/pyparted.c
|
||
|
--- parted-1.6.21/python-parted-0.11.2/pyparted.c 2002-09-17 22:12:37.000000000 +0000
|
||
|
+++ parted-1.6.21-fix/python-parted-0.11.2/pyparted.c 2005-03-14 16:33:47.000000000 +0000
|
||
|
@@ -128,91 +128,104 @@
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_model(PyObject *self, PyObject *args)
|
||
|
+chs_geometry_get_cylinders(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyString_FromString(((PedDevice *)o->obj)->model);
|
||
|
+ return PyInt_FromLong(((PedCHSGeometry *)o->obj)->cylinders);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_path(PyObject *self, PyObject *args)
|
||
|
+chs_geometry_get_heads(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyString_FromString(((PedDevice *)o->obj)->path);
|
||
|
+ return PyInt_FromLong(((PedCHSGeometry *)o->obj)->heads);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_type(PyObject *self, PyObject *args)
|
||
|
+chs_geometry_get_sectors(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyInt_FromLong(((PedDevice *)o->obj)->type);
|
||
|
+ return PyInt_FromLong(((PedCHSGeometry *)o->obj)->sectors);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_sector_size(PyObject *self, PyObject *args)
|
||
|
+device_get_model(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyInt_FromLong(((PedDevice *)o->obj)->sector_size);
|
||
|
+ return PyString_FromString(((PedDevice *)o->obj)->model);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_heads(PyObject *self, PyObject *args)
|
||
|
+device_get_path(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyInt_FromLong(((PedDevice *)o->obj)->heads);
|
||
|
+ return PyString_FromString(((PedDevice *)o->obj)->path);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_sectors(PyObject *self, PyObject *args)
|
||
|
+device_get_type(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyInt_FromLong(((PedDevice *)o->obj)->sectors);
|
||
|
+ return PyInt_FromLong(((PedDevice *)o->obj)->type);
|
||
|
+}
|
||
|
+
|
||
|
+static PyObject *
|
||
|
+device_get_sector_size(PyObject *self, PyObject *args)
|
||
|
+{
|
||
|
+ PyPartedObject *o;
|
||
|
+
|
||
|
+ if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
+ return NULL;
|
||
|
+
|
||
|
+ return PyInt_FromLong(((PedDevice *)o->obj)->sector_size);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_cylinders(PyObject *self, PyObject *args)
|
||
|
+device_get_hw_geom(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyInt_FromLong(((PedDevice *)o->obj)->cylinders);
|
||
|
+ return PyPartedObject_new("PedCHSGeometry",
|
||
|
+ &((PedDevice *)o->obj)->hw_geom);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
-device_get_geom_known(PyObject *self, PyObject *args)
|
||
|
+device_get_bios_geom(PyObject *self, PyObject *args)
|
||
|
{
|
||
|
PyPartedObject *o;
|
||
|
|
||
|
if (!PyArg_ParseTuple(args, "O", &o))
|
||
|
return NULL;
|
||
|
|
||
|
- return PyInt_FromLong(((PedDevice *)o->obj)->geom_known);
|
||
|
+ return PyPartedObject_new("PedCHSGeometry",
|
||
|
+ &((PedDevice *)o->obj)->bios_geom);
|
||
|
}
|
||
|
|
||
|
static PyObject *
|
||
|
@@ -1248,15 +1261,16 @@
|
||
|
|
||
|
static PyMethodDef parted_methods[] = {
|
||
|
{ "init", init, METH_VARARGS, NULL },
|
||
|
+ { "chs_geometry_get_cylinders", chs_geometry_get_cylinders, METH_VARARGS, NULL },
|
||
|
+ { "chs_geometry_get_heads", chs_geometry_get_heads, METH_VARARGS, NULL },
|
||
|
+ { "chs_geometry_get_sectors", chs_geometry_get_sectors, METH_VARARGS, NULL },
|
||
|
{ "device_get_next", device_get_next, METH_VARARGS, NULL },
|
||
|
{ "device_get_model", device_get_model, METH_VARARGS, NULL },
|
||
|
{ "device_get_path", device_get_path, METH_VARARGS, NULL },
|
||
|
{ "device_get_type", device_get_type, METH_VARARGS, NULL },
|
||
|
{ "device_get_sector_size", device_get_sector_size, METH_VARARGS, NULL },
|
||
|
- { "device_get_heads", device_get_heads, METH_VARARGS, NULL },
|
||
|
- { "device_get_sectors", device_get_sectors, METH_VARARGS, NULL },
|
||
|
- { "device_get_cylinders", device_get_cylinders, METH_VARARGS, NULL },
|
||
|
- { "device_get_geom_known", device_get_geom_known, METH_VARARGS, NULL },
|
||
|
+ { "device_get_hw_geom", device_get_hw_geom, METH_VARARGS, NULL },
|
||
|
+ { "device_get_bios_geom", device_get_bios_geom, METH_VARARGS, NULL },
|
||
|
{ "device_get_host", device_get_host, METH_VARARGS, NULL },
|
||
|
{ "device_get_did", device_get_did, METH_VARARGS, NULL },
|
||
|
{ "device_get_length", device_get_length, METH_VARARGS, NULL },
|