summaryrefslogtreecommitdiffstats
path: root/isys/isys.c
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2007-12-03 12:59:39 -0500
committerJeremy Katz <katzj@redhat.com>2007-12-03 15:47:51 -0500
commitd6b03ab77abcf68c9dbb9f0c674c7dbf3548b786 (patch)
treef8d4b6f19989bc235780789eba6c3368e828a1c4 /isys/isys.c
parentacd7e206ae041101203d1bb0011a37f735bdbf04 (diff)
downloadanaconda-d6b03ab77abcf68c9dbb9f0c674c7dbf3548b786.tar.gz
anaconda-d6b03ab77abcf68c9dbb9f0c674c7dbf3548b786.tar.xz
anaconda-d6b03ab77abcf68c9dbb9f0c674c7dbf3548b786.zip
Use libblkid instead of custom filesystem probing
This patch gets rid of all of our custom filesystem type and label probing and switches it all over to using a simple binding to libblkid instead.
Diffstat (limited to 'isys/isys.c')
-rw-r--r--isys/isys.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c
index dd2266973..eed25e5a1 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -49,6 +49,8 @@
#include <libdhcp/ip_addr.h>
#include <libdhcp/pump.h>
+#include <blkid/blkid.h>
+
#include "nl.h"
#include "imount.h"
#include "isys.h"
@@ -115,6 +117,7 @@ static PyObject * doGetBiosDisk(PyObject * s, PyObject * args);
static PyObject * doSegvHandler(PyObject *s, PyObject *args);
static PyObject * doAuditDaemon(PyObject *s);
static PyObject * doPrefixToNetmask(PyObject *s, PyObject *args);
+static PyObject * doGetBlkidData(PyObject * s, PyObject * args);
static PyMethodDef isysModuleMethods[] = {
{ "ejectcdrom", (PyCFunction) doEjectCdrom, METH_VARARGS, NULL },
@@ -167,6 +170,7 @@ static PyMethodDef isysModuleMethods[] = {
{ "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL },
{ "auditdaemon", (PyCFunction) doAuditDaemon, METH_NOARGS, NULL },
{ "prefix2netmask", (PyCFunction) doPrefixToNetmask, METH_VARARGS, NULL },
+ { "getblkid", (PyCFunction) doGetBlkidData, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
} ;
@@ -1195,4 +1199,32 @@ static PyObject * doAuditDaemon(PyObject *s) {
return Py_None;
}
+static PyObject * doGetBlkidData(PyObject * s, PyObject * args) {
+ char * dev, * key;
+ blkid_cache cache;
+ blkid_dev bdev = NULL;
+ blkid_tag_iterate titer;
+ const char * type, * data;
+
+ if (!PyArg_ParseTuple(args, "ss", &dev, &key)) return NULL;
+
+ blkid_get_cache(&cache, NULL);
+
+ bdev = blkid_get_dev(cache, dev, BLKID_DEV_NORMAL);
+ if (bdev == NULL)
+ goto out;
+ titer = blkid_tag_iterate_begin(bdev);
+ while (blkid_tag_next(titer, &type, &data) >= 0) {
+ if (!strcmp(type, key)) {
+ blkid_tag_iterate_end(titer);
+ return Py_BuildValue("s", data);
+ }
+ }
+ blkid_tag_iterate_end(titer);
+
+ out:
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
/* vim:set shiftwidth=4 softtabstop=4: */