summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2001-01-08 23:51:15 +0000
committerMike Fulbright <msf@redhat.com>2001-01-08 23:51:15 +0000
commit5691c18b5d559d6cdf695ca376385007e574387e (patch)
tree194f3bd17d191a24f04c47e7687ba97986b56a02 /isys
parent6f670ec8ae8d1a246c66954100236c90e23ea96c (diff)
downloadanaconda-5691c18b5d559d6cdf695ca376385007e574387e.tar.gz
anaconda-5691c18b5d559d6cdf695ca376385007e574387e.tar.xz
anaconda-5691c18b5d559d6cdf695ca376385007e574387e.zip
Added support for LBA32 when we right out lilo.conf iff we need it because boot partition is over 1023 cyl. Also added warning if you put boot > 1023 cyl and we dont seem to be able to detect edd support on this system
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.c34
-rw-r--r--isys/isys.py7
2 files changed, 41 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c
index 92cc538df..82530b12b 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -28,6 +28,7 @@
#include <scsi/scsi_ioctl.h>
#include <sys/vt.h>
#include <sys/types.h>
+#include <linux/hdreg.h>
#include "Python.h"
@@ -87,6 +88,7 @@ static PyObject * doVtActivate(PyObject * s, PyObject * args);
static PyObject * doisPsudoTTY(PyObject * s, PyObject * args);
static PyObject * doSync(PyObject * s, PyObject * args);
static PyObject * doisIsoImage(PyObject * s, PyObject * args);
+static PyObject * dogetGeometry(PyObject * s, PyObject * args);
static PyMethodDef isysModuleMethods[] = {
{ "ejectcdrom", (PyCFunction) doEjectCdrom, METH_VARARGS, NULL },
@@ -134,6 +136,7 @@ static PyMethodDef isysModuleMethods[] = {
{ "isPsudoTTY", (PyCFunction) doisPsudoTTY, METH_VARARGS, NULL},
{ "sync", (PyCFunction) doSync, METH_VARARGS, NULL},
{ "isisoimage", (PyCFunction) doisIsoImage, METH_VARARGS, NULL},
+ { "getGeometry", (PyCFunction) dogetGeometry, METH_VARARGS, NULL},
{ NULL }
} ;
@@ -1383,3 +1386,34 @@ static PyObject * doisIsoImage(PyObject * s, PyObject * args) {
return Py_BuildValue("i", rc);
}
int fileIsIso(const char * file);
+
+static PyObject * dogetGeometry(PyObject * s, PyObject * args) {
+ int fd;
+ int rc;
+ char *dev;
+ char cylinders[16], heads[16], sectors[16];
+ char errstr[200];
+ struct hd_geometry g;
+
+ if (!PyArg_ParseTuple(args, "s", &dev)) return NULL;
+
+ fd = open(dev, O_RDONLY);
+ if (fd < 0) {
+ snprintf(errstr, sizeof(errstr), "could not open device %s", dev);
+ PyErr_SetString(PyExc_ValueError, errstr);
+ return NULL;
+ }
+
+ if (ioctl(fd, HDIO_GETGEO, &g)) {
+ close(fd);
+ snprintf(errstr, sizeof(errstr), "HDTIO_GETGEO ioctl() failed on device %s", dev);
+ PyErr_SetString(PyExc_ValueError, errstr);
+ return NULL;
+ }
+
+ snprintf(cylinders, sizeof(cylinders), "%d", g.cylinders);
+ snprintf(heads, sizeof(heads), "%d", g.heads);
+ snprintf(sectors, sizeof(sectors), "%d", g.sectors);
+
+ return Py_BuildValue("(sss)", cylinders, heads, sectors);
+}
diff --git a/isys/isys.py b/isys/isys.py
index f076555d1..a7956825f 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -342,3 +342,10 @@ def sync ():
def isIsoImage(file):
return _isys.isisoimage(file)
+
+def getGeometry(device):
+ makeDevInode(device, "/tmp/disk")
+ rc = _isys.getGeometry("/tmp/disk")
+ os.unlink("/tmp/disk")
+ return rc
+