summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2005-06-27 21:17:43 +0000
committerChris Lumens <clumens@redhat.com>2005-06-27 21:17:43 +0000
commit66e26cbfe6b118a8536bb1b72874865e75ebbcbf (patch)
tree98d2f661762518ff37535dc2f74e1e4256a2bf5d /isys
parentfb4043fed810b52570db5c698e3e260ff20e5ab8 (diff)
downloadanaconda-66e26cbfe6b118a8536bb1b72874865e75ebbcbf.tar.gz
anaconda-66e26cbfe6b118a8536bb1b72874865e75ebbcbf.tar.xz
anaconda-66e26cbfe6b118a8536bb1b72874865e75ebbcbf.zip
Added a clobberDevice method that is used before formatting a device to
get rid of any identifying information (such as labels).
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.c30
-rw-r--r--isys/isys.py3
2 files changed, 33 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c
index 6a08f7cb1..66fce0e78 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -89,6 +89,7 @@ static PyObject * doResetResolv(PyObject * s, PyObject * args);
static PyObject * doSetResolvRetry(PyObject * s, PyObject * args);
static PyObject * doLoadFont(PyObject * s, PyObject * args);
static PyObject * doLoadKeymap(PyObject * s, PyObject * args);
+static PyObject * doClobberExt2 (PyObject * s, PyObject * args);
static PyObject * doReadE2fsLabel(PyObject * s, PyObject * args);
static PyObject * doExt2Dirty(PyObject * s, PyObject * args);
static PyObject * doExt2HasJournal(PyObject * s, PyObject * args);
@@ -122,6 +123,7 @@ static PyMethodDef isysModuleMethods[] = {
{ "e2dirty", (PyCFunction) doExt2Dirty, METH_VARARGS, NULL },
{ "e2hasjournal", (PyCFunction) doExt2HasJournal, METH_VARARGS, NULL },
{ "e2fslabel", (PyCFunction) doReadE2fsLabel, METH_VARARGS, NULL },
+ { "e2fsclobber", (PyCFunction) doClobberExt2, METH_VARARGS, NULL },
{ "devSpaceFree", (PyCFunction) doDevSpaceFree, METH_VARARGS, NULL },
{ "raidstop", (PyCFunction) doRaidStop, METH_VARARGS, NULL },
{ "raidstart", (PyCFunction) doRaidStart, METH_VARARGS, NULL },
@@ -1009,6 +1011,34 @@ static PyObject * doSetResolvRetry(PyObject * s, PyObject * args) {
return Py_None;
}
+static PyObject * doClobberExt2 (PyObject * s, PyObject * args) {
+ char * device;
+ ext2_filsys fsys;
+ struct ext2_super_block sb;
+ int rc;
+
+ if (!PyArg_ParseTuple(args, "s", &device)) return NULL;
+
+ rc = ext2fs_open(device, EXT2_FLAG_FORCE, 0, 0, unix_io_manager, &fsys);
+
+ if (rc) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ memset(&sb, 0, sizeof(struct ext2_super_block));
+ rc = ext2fs_initialize (device, 0, &sb, unix_io_manager, &fsys);
+ if (rc) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ ext2fs_close(fsys);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyObject * doReadE2fsLabel(PyObject * s, PyObject * args) {
char * device;
ext2_filsys fsys;
diff --git a/isys/isys.py b/isys/isys.py
index 250ec9837..3d3446443 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -691,6 +691,9 @@ def readFSLabel(device, makeDevNode = 1):
label = readJFSLabel(device, makeDevNode)
return label
+def ext2Clobber(device, makeDevNode = 1):
+ _isys.e2fsclobber(device)
+
def ext2IsDirty(device):
makeDevInode(device, "/tmp/disk")
label = _isys.e2dirty("/tmp/disk");